且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Magento Checkout成功页面产品价格和SKU检索

更新时间:2023-11-30 11:10:58

是的,你说得对@leek

Yeah you are right @leek

但是,如果要使用CJ添加高级设置,请遵循此方法.

But if you want to add advanced setup with CJ then follow this method.

<!-- Start of CJ Integration Part -->
<?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>
<!-- End of CJ Integration Part -->

它工作得很好.