How can I trigger controllerless core Magento modules that watch <controller_action_predispatch> in <frontend> in config.xml from external script

若如初见. 提交于 2019-12-04 16:53:04

You will need to manually dispatch the events with the original params e.g.

Mage::dispatchEvent(
    'controller_action_predispatch',
    array('controller_action',Mage::app()->getRequest()
);

See Mage_Core_Controller_Varien_Action::preDispatch() (link) for more info. Note that the pre- and post-dispatch methods dispatch dynamic events based on routename params which may or may not be a concern.

If you rewrite the external script as a custom controller and action then all the events will fire naturally. However, you must have a reason for making it external in the first place.

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