2

Is there a way to get the order object from this event

controller_action_postdispatch_checkout_onepage_saveOrder

Apparently it doesn't know about the order by using this: $observer->getEvent()->getOrder() .I know I could use the save order after or before event, but I would like to use that event . Is there a way to get the order object from that event ?

Thank you !

0

You can get order object on controller_action_postdispatch_checkout_onepage_saveorder event by like this,

$order = Mage::registry('hss_order');

You can find the usage of this event in below location,

app\code\core\Mage\Paypal\etc\config.xml

and

app\code\core\Mage\Paypal\Model\Observer.php in setResponseAfterSaveOrder method

  • but what happens If i disable the paypal module? , i'm not sure if this will still work :) thnx – Attila Naghi Nov 23 '17 at 8:25
  • Disable the PayPal module means? You did not mention that in your question :) @Chester – Keyur Shah Nov 23 '17 at 8:26
  • I know, but i would like to avoid this kind of dependencies. What happens if tomorrow it will be decide to not use anymore paypal payment method ? will this still work ? thnx – Attila Naghi Nov 23 '17 at 8:29
  • No, it will not work, but you can also do the same thing like magento. register the registry in checkout_submit_all_after and get the order object controller_action_postdispatch_checkout_onepage_saveorder event. If you don't want to set the dependency on PayPal – Keyur Shah Nov 23 '17 at 8:32

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.