共计 1015 个字符,预计需要花费 3 分钟才能阅读完成。
在订单成功页面,也即感谢页面,获取产品的SKU,价格等信息,以加强客户的印象,同时还用于其他的用途,话不多说,且看代码如下:
[php]
<?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>
[/php]