且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

结帐开始观察员

更新时间:2023-11-29 22:19:52

每个控制器动作都会导致多个目标事件,这些事件在

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.

在标准一页结帐的情况下,完整操作名称为checkout_onepage_index,路由名称为checkout_onepage.

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()

您观察到的事件将取决于OneStepCheckout模块如何捕获路由.如果需要区分路由和模块,则基于getRouteName()的事件可能会很有用.您将要测试客户已登录"和客户已注销"方案.虽然predispatch事件是涉及重定向的逻辑的首选,但是您将需要在您的需求与复制购物车/报价+客户会话逻辑之间取得平衡.

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.