我想创建controller_action_predispatch事件:Magento的:controller_action_predispatch不工作
这是我兆字节/ Pushnotification的/ etc/config.xml文件中的代码
<events>
<controller_action_predispatch_mbyte_pushnotification_index_index>
<observers>
<Mbyte_Pushnotification>
<class>Mbyte_Pushnotification/Observer</class>
<method>indexPreDispatch</method>
</Mbyte_Pushnotification>
</observers>
</controller_action_predispatch_mbyte_pushnotification_index_index>
</events>
我的控制器代码:字节/ Pushnotification /控制器/ IndexController.php文件代码
class Mbyte_Pushnotification_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
Mage::log('Run',null,'log.log');
}
}
观察文件的代码:
class Mbyte_Pushnotification_Model_Observer {
public function indexPreDispatch($observer)
{
Mage::log('Check',null,'observer.log');
}}
controller_action_predispatch不起作用。 有什么我做错了吗?
它不会纠正你的错误,但投出您$观察者像'公共职能indexPreDispatch(Varien_Event_Observer $观察员)' – apouey 2014-10-03 08:08:07
我试过这个,但没有为我工作 – 2014-10-03 09:15:09