它适用于我的本地 Windows 机器,但不适用于 centos 服务器。
我的配置是我的文件夹结构是
Caitlinhavener\Dynamicprice\Model\Observer.php Caitlinhavener\Dynamicprice\etc\config.xml
我的配置文件是:
<?xml version="1.0"?>
<config>
<modules>
<Caitlinhavener_Dynamicprice>
<version>0.1.0</version>
</Caitlinhavener_Dynamicprice>
</modules>
<global>
<models>
<chdispatcher>
<class>Caitlinhavener_Dynamicprice_Model</class>
</chdispatcher>
</models>
</global>
<frontend>
<events>
<checkout_cart_product_add_after>
<observers>
<modify_to_custom_price>
<type>singleton</type>
<class>chdispatcher/observer</class>
<method>modifyPrice</method>
</modify_to_custom_price>
</observers>
</checkout_cart_product_add_after>
</events>
</frontend>
</config>
观察者.php
<?php
Mage::log('Im here')
or exit("unable to log");
class Caitlinhavener_Dynamicprice_Model_Observer
{
public function modifyPrice(Varien_Event_Observer $obs)
{
echo "inside";exit;
}
}
?>