【发布时间】:2015-01-27 13:54:10
【问题描述】:
我正在使用 Magento 1.9.0.1。
我正在尝试创建一个非常简单的扩展来监听订单状态的变化。
这是我到目前为止所做的:
文件:/VivasIndustries/SmsNotification/etc/config.xml:
<?xml version="1.0"?>
<config>
<modules>
<VivasIndustries_SmsNotification>
<version>0.1.0</version>
</VivasIndustries_SmsNotification>
</modules>
<global>
<events>
<sales_order_save_after>
<observers>
<vivasindustries_smsnotification>
<class>smsnotification/observer</class>
<method>orderSaved</method>
</vivasindustries_smsnotification>
</observers>
</sales_order_save_after>
</events>
</global>
文件:/VivasIndustries/SmsNotification/Model/Observer.php:
<?PHP
class VivasIndustries_SmsNotification_Model_Observer
{
public function orderSaved(Varien_Event_Observer $observer)
{
Mage::log("Test")
}
}
文件:/app/etc/modules/VivasIndustries_SmsNotification.xml:
<?xml version="1.0"?>
<config>
<modules>
<VivasIndustries_SmsNotification>
<active>true</active>
<codePool>community</codePool>
<version>0.1.0</version>
</VivasIndustries_SmsNotification>
</modules>
</config>
我已经按照本指南完成了所有操作:http://www.danielhanly.com/blog/observing-order-status-changes-magento/
问题是当我检查我的 system.log 文件时,没有带有“Test”的行或文本。似乎它没有在日志文件中插入此文本,这让我认为当我更改订单状态/保存订单时它无法识别。
你能指出我的错误在哪里,并帮助我解决这个问题。
提前致谢!
【问题讨论】: