当我尝试为checkout_type_onepage_save_order
事件编写观察者时,如下所示
<events>
<checkout_type_onepage_save_order>
<observers>
<Appeal_Consignor_Model_Observer>
<type>singleton</type>
<class>consignor/observer</class>
<method>savedata</method>
</Appeal_Consignor_Model_Observer>
</observers>
</checkout_type_onepage_save_order>
</events>
上面的代码我试过frontend
了global
。
即使我也尝试过。
<events>
<checkout_type_onepage_save_order>
<observers>
<Appeal_Consignor_Model_Observer>
<type>singleton</type>
<class>Appeal_Consignor_Model_Observer</class>
<method>savedata</method>
</Appeal_Consignor_Model_Observer>
</observers>
</checkout_type_onepage_save_order>
</events>
完整的config.xml文件如下
<?xml version="1.0"?>
<config>
<modules>
<Appeal_Consignor>
<version>1.0.1</version>
</Appeal_Consignor>
</modules>
<global>
<models>
<consignor>
<class>Appeal_Consignor_Model</class>
</consignor>
</models>
<resources>
<consignor_setup>
<setup>
<module>Appeal_Consignor</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</consignor_setup>
<consignor_write>
<connection>
<use>core_write</use>
</connection>
</consignor_write>
<consignor_read>
<connection>
<use>core_read</use>
</connection>
</consignor_read>
</resources>
<helpers>
<consignor>
<class>Appeal_Consignor_Helper</class>
</consignor>
</helpers>
</global>
<frontend>
<routers>
<consignor>
<use>standard</use>
<args>
<module>Appeal_Consignor</module>
<frontName>consignor</frontName>
</args>
</consignor>
</routers>
<events>
<checkout_type_onepage_save_order>
<observers>
<Appeal_Consignor_Model_Observer>
<type>singleton</type>
<class>Appeal_Consignor_Model_Observer</class>
<method>savedata</method>
</Appeal_Consignor_Model_Observer>
</observers>
</checkout_type_onepage_save_order>
</events>
</frontend>
<adminhtml>
<layout>
<updates>
<consignor>
<file>consignor.xml</file>
</consignor>
</updates>
</layout>
</adminhtml>
</config>
但是以下错误即将到来。我清除了缓存 1000 次,也手动删除了 var 缓存文件夹文件。
2012-07-23T11:04:09+00:00 ERR (3): Warning: include(Appeal_Consignor_Model_Observer.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in E:\xampp\htdocs\magento\includes\src\Varien_Autoload.php on line 93
2012-07-23T11:04:09+00:00 ERR (3): Warning: include() [<a href='function.include'>function.include</a>]: Failed opening 'Appeal_Consignor_Model_Observer.php' for inclusion (include_path='E:\xampp\htdocs\magento\includes\src;.;E:\xampp\php\PEAR') in E:\xampp\htdocs\magento\includes\src\Varien_Autoload.php on line 93