Magento: Obtain Id for order, listening to the event checkout_onepage_controller_success_action

后端 未结 4 1910
野的像风
野的像风 2021-01-15 16:24

When I look at the event checkout_onepage_controller_success_action and works, but I can not get the Id of the newly created order.

Anyone have any idea

4条回答
  •  时光取名叫无心
    2021-01-15 16:46

    This is an answer provided by Branko Ajzele and I've just successfully tested:

            $order = new Mage_Sales_Model_Order();
        $incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
        $order->loadByIncrementId($incrementId);
    

    Thanks to him and hope it'll work.

提交回复
热议问题