【发布时间】:2011-01-08 18:32:46
【问题描述】:
如果控制器被重写,为什么控制器动作预调度事件不会触发?这是store/app/code/core/Mage/Core/Controller/Varien/Action.php的sn-p:
abstract class Mage_Core_Controller_Varien_Action
{
// [...]
public function preDispatch()
{
// [...]
if ($this->_rewrite()) {
return; // [What is the purpose if this?]
}
// [...]
// [This is where my event needs to be firing, but this code never gets
// executed because the controller is rewritten]
Mage::dispatchEvent(
'controller_action_predispatch_'.$this->getFullActionName(),
array('controller_action'=>$this)
);
}
// [...]
}
我不知道从哪里着手解决这个问题。以前有人处理过这个吗?
【问题讨论】:
-
afaik 你甚至不能用 magento 重写抽象模型?只在本地/法师中整体替换它们?
标签: php magento event-handling controller extensibility