Is there an observer in Magento to detect the start of the checkout process? This would include hitting the page checkout/onepage/
or checkout/onestepcheckout/
. I would like to avoid overriding controllers if possible.
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.