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

后端 未结 4 1922
野的像风
野的像风 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:43

    The event is dispatched like this:

    Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
    

    So to get the last orderId, simply make your observer method like this:

    public function orderSuccessEvent($observer)
    {
        $observer->getData('order_ids'));
    }
    

提交回复
热议问题