您的位置:首页 > 其它

在订单成功页面获取相应的产品信息

2011-12-20 23:58 246 查看
在订单成功页面,也即感谢页面,获取产品的SKU,价格等信息,以加强客户的印象,同时还用于其他的用途,话不多说,且看代码如下:

<?php
$_customerId = Mage::getSingleton('customer/session')->getCustomerId();
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
$order = Mage::getSingleton('sales/order');
$order->load($lastOrderId);
$_totalData =$order->getData();
$_sub = $_totalData['subtotal'];//USD ==> global_currency_code,base_currency_code order_currency_code
// Incase if it is simple do this ==> https://www.emjcd.com/u?AMOUNT= $_sub;
//print_r($order); print_r($_totalData);

$_order   = $this->getOrder();
$allitems = $order->getAllItems();
$index    = 1;
$cjData   = "";//Needed format ==> &ITEM1=3214sku&AMT1=13.49&QTY1=1&ITEM2=6577sku&AMT2=7.99&QTY2=2&
foreach($allitems as $item)
{
$cjData.="&ITEM".$index."=".$item->getSku()."&AMT".$index."=".$item->getPrice()."&QTY".$index."=".$item->getQtyToShip();
$index++;
}
?>
<div style="display:none;">
<img src="https://www.emjcd.com/u?CID=id&OID=<?php echo $this->getOrderId(); ?>&TYPE=type<?php echo $cjData; ?>&CURRENCY=USD&METHOD=IMG" height="1" width="20">
</div>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: