【发布时间】:2015-07-05 19:51:45
【问题描述】:
我相信下面的代码存在配置问题,模块已激活,但观察者没有被事件触发。谁能发现问题?
app/etc/modules/James_CoreProductCheck.xml
<?xml version="1.0"?>
<config>
<modules>
<James_CoreProductCheck>
<active>true</active>
<codePool>local</codePool>
</James_CoreProductCheck>
</modules>
</config>
app/code/local/James/CoreProductCheck/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<James_CoreProductCheck>
<version>0.0.1</version>
</James_CoreProductCheck>
</modules>
<global>
<models>
<james_coreproductcheck>
<class>James_CoreProductCheck_Model</class>
</james_coreproductcheck>
</models>
<events>
<checkout_cart_product_add_after>
<observers>
<james_coreproduct_check_model_observer>
<type>singleton</type>
<class>James_CoreProductCheck_Model_Observer</class>
<method>check</method>
</james_coreproduct_check_model_observer>
</observers>
</checkout_cart_product_add_after>
</events>
</global>
</config>
app/code/local/James/CoreProductCheck/Model/Observer.php
class James_CoreProductCheck_Model_Observer {
public function check(Varien_Event_Observer $observer) {
Mage::log('Yet another product added', null, 'product-updates.log');
}
}
【问题讨论】:
-
1.使用相同的观察者检查其他扩展 2. 清除缓存
-
这似乎是一个缓存问题。请尝试刷新缓存存储并尝试