我正在尝试在订单放入我的观察者后获取所有订单详细信息,但它没有显示出来。我必须使用某个事件吗?或者我缺少某种订单细节?
config.xml中
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<SmashingMagazine_LogProductUpdate>
<version>0.0.1</version>
</SmashingMagazine_LogProductUpdate>
</modules>
<!-- Configure our module's behavior in the global scope -->
<global>
<!-- Defining models -->
<models>
<!--
Unique identifier in the model's node.
By convention, we put the module's name in lowercase.
-->
<smashingmagazine_logproductupdate>
<!--
The path to our models directory, with directory
separators replaced by underscores
-->
<class>SmashingMagazine_LogProductUpdate_Model</class>
</smashingmagazine_logproductupdate>
</models>
<events>
<checkout_submit_all_after>
<observers>
<smashingmagazine_logproductupdate>
<class>SmashingMagazine_LogProductUpdate_Model_Observer</class>
<method>logUpdate</method>
</smashingmagazine_logproductupdate>
</observers>
</checkout_submit_all_after>
</events>
</global>
</config>
Observer.php
class SmashingMagazine_LogProductUpdate_Model_Observer
{
/**
* Magento passes a Varien_Event_Observer object as
* the first parameter of dispatched events.
*/
public function logUpdate(Varien_Event_Observer $observer)
{
//Get Info
$order = $observer->getEvent()->getOrder();
Mage::log(
"{$order}",
null,
'product-updates.log'
);
}
}
答案 0 :(得分:0)
尝试将配置更改为
...
<events>
<checkout_submit_all_after>
<observers>
<smashingmagazine_logproductupdate>
<type>singleton</type>
<class>logproductupdate/observer</class>
<method>logUpdate</method>
</smashingmagazine_logproductupdate>
</observers>
</checkout_submit_all_after>
...