Magento 事件观察器未在 centos 中触发

标签 magento centos

它在我的本地 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;
    }



}
?>

最佳答案

这个配置中肯定没有问题。如果你的模块在 Windows 下工作,我假设模块中的某个地方有大写字符(小/大字符)的问题。这可能是模块名称、命名空间、类名称、Caitlinhavener_Dynamicprice.xml 或其他文件路径等的错误字符。对于 Windows,大小写字母之间没有区别,但对于 Unix,这很重要。您可以在另一个模块中尝试您的观察者来检查它。对不起我的英语。

关于Magento 事件观察器未在 centos 中触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18865399/

相关文章:

java - 使用替代品在 centos 上安装 java

linux - 安装 fs 有错误,建议运行 e2fsck

php - Magento 2 : category Url Rewrite to Cms page

html - 背景 slider

api - 使用 magento API V2 限制结果数量

docker 错误初始化 graphdriver : driver not supported

magento - 我如何在 Magento 中获取估计的运输邮政编码?

javascript - Magento - 在我的 <head> 部分中找不到哪些源文件加载 .js

linux - 如何在linx vps/dedicated server上安装浏览器和浏览网站

windows - 无法从 Centos vm ping 窗口 vm。我怎样才能解决这个问题?