0

Hi guys i am working in magento 1.14 enterprise. i am trying to get order id after order place in multishipping checkout for that i am using this event

sales_order_place_after

i also tried this one as well

checkout_submit_all_after

but i am getting nothing in this event i want to get order id

here is my code for config

        <sales_order_place_after>
        <observers>
            <Webkul_Marketplace_Model_Observer>
                <type>singleton</type>
                <class>Webkul_Marketplace_Model_Observer</class>
                <method>afterPlaceOrder</method>
            </Webkul_Marketplace_Model_Observer>
        </observers>
    </sales_order_place_after>

and this code for function

 public function afterPlaceOrder($observer) {
    $helper = Mage::helper('marketplace');
    $lastOrderId = $observer->getOrder()->getId();

}

Its giving me error in this line Call to a member function getId() to null can anyone please tell me what i am missing why my observer is giving me nothing i have checked the same scenario in onepage and its working fine there.

0

I am Not sure about sales_order_place_after event.

But checkout_submit_all_after is always fire for multi shipping checkout .

But there are some logic change at parameters default checkout onepage and multi shipping checkout's checkout_submit_all_after event.

multi shipping checkout

For multi shipping checkout's ,you goto two parameters at observer.

First one is Orderids of your checkout by $observer->getEvent()->getOrders()

Second,one is quote object of your checkout by $observer->getEvent()->getQuote()

see:

Mage::dispatchEvent('checkout_submit_all_after', array('orders' => $orders, 'quote' => $this->getQuote()));

Default onepage checkout

Getting 3 parameters:

  • Order object of current place order : by $observer->getEvent()->getOrder()

  • Quote object of current place order : by $observer->getEvent()->getQuote()

  • recurring profilesobject of current place order by $observer->getEvent()->getRecurringProfiles()

See at:

Mage::dispatchEvent( 'checkout_submit_all_after', array('order' => $order, 'quote' => $this->getQuote(), 'recurring_profiles' => $profiles) );

So there are some logical changes are need at your observer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.