Get Order Increment Id in Magento

前端 未结 10 1735
生来不讨喜
生来不讨喜 2020-12-03 21:19

I\'m trying to get the Order Increment Id in Magento, on the success.phtml page so that I can use this for affiliate tracking.

I\'m using the following code, but it

10条回答
  •  被撕碎了的回忆
    2020-12-03 21:51

    $order in your code is the last order ID...as the function name implies. If this isn't the value you want, then use it to load an order, and then use the getter on that:

    $order = Mage::getModel('sales/order');
    $order->load(Mage::getSingleton('sales/order')->getLastOrderId());
    $lastOrderId = $order->getIncrementId();
    

提交回复
热议问题