0
我試圖將跟蹤像素集成到magento成功頁面。爲了進行測試,我構建了以下代碼,並將其在模板文件夾中的success.phtml文件中的line> 45中實現。實際上變量都是空的。怎麼了?magento跟蹤像素簽出
<?php
<?php
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
$order = Mage::getSingleton('sales/order');
$order->load($lastOrderId);
$skus = array();
$qtys = array();
$amounts = array();
foreach ($order->getAllItems() as $item){
$skus[$item->getProductId()] = $item->getSku();
$names[$item->getProductId()] = $item->getName();
$qtys[$item->getProductId()] = $item->getQtyOrdered() * 1;
$amounts[$item->getProductId()] = $item->getRowTotal() * 100;//or $item->getPrice()*$item->getQtyOrdered();//but this will ignore any applied coupons
}
$skuspipe = implode("|", $skus);
$namespipe = implode("|", $names);
$qtyspipe = implode("|", $qtys);
$amountspipe = implode("|", $amounts);
<!--
OrderID: <?php echo $orderID; ?>
skus: <?php print_r($skus); ?>
names: <?php print_r($names); ?>
qtys: <?php print_r($qtys); ?>
amounts: <?php print_r($amounts); ?>
skupipe: <?php echo $skupipe; ?>
namespipe: <?php echo $namespipe; ?>
qtyspipe: <?php echo $qtyspipe; ?>
amountspipe: <?php echo $amountspipe; ?>
-->
謝謝!