Observer for Checkout Start

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 20:10:47

Every controller action will result in multiple targeted events which are fired in Mage_Core_Controller_Varien_Action (link), the superclass for all action controllers. These events variously involve the "full action name," derived from module router configuration + controller path + action, as well as the route name which is being requested.

In the case of standard onepage checkout, the full action name is checkout_onepage_index and the route name is checkout_onepage.

renderLayout():

controller_action_layout_render_before_'.$this->getFullActionName()

preDispatch():

controller_action_predispatch_' . $this->getRequest()->getRouteName() controller_action_predispatch_' . $this->getFullActionName()

postDispatch():

controller_action_postdispatch_' . $this->getRequest()->getRouteName() controller_action_postdispatch_' . $this->getFullActionName()

Which events you observe will depend on how the OneStepCheckout module captures routes. The getRouteName()-based events may be useful if you need to distinguish between routes and modules. You'll want to test "customer is logged in" and "customer is logged out" scenarios. While the predispatch events are preferred for logic which involves a redirect, you'll want to balance your needs against duplicating cart/quote + customer session logic.

Renon Stewart

Take a look @ controller_action_predispatch_checkout_onepage_index event

See 'Proceed to Checkout' Event for Magento?

Why do you want to do it that late? Depending on what you are checking, you might do it after adding them to the cart? checkout_cart_save_before

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!