Php Magento模型重写是';行不通

Php Magento模型重写是';行不通,php,magento,Php,Magento,我想弄明白这件事快发疯了。该模块本身是一个已经存在的工作模块,因此我知道它与/app/etc/Modules/configs之类的东西无关。我知道重写不起作用,因为我在同一个函数的核心文件中放了一个类似的log语句,它是被命中的,而不是我重写的函数 Company/Module/etc/config.xml <global> <models> <core> <rewrite> <email_templa

我想弄明白这件事快发疯了。该模块本身是一个已经存在的工作模块,因此我知道它与/app/etc/Modules/configs之类的东西无关。我知道重写不起作用,因为我在同一个函数的核心文件中放了一个类似的log语句,它是被命中的,而不是我重写的函数

Company/Module/etc/config.xml

<global>
  <models>
    <core>
      <rewrite>
        <email_template_filter>Company_Module_Model_Email_Template_Filter</email_template_filter>
      </rewrite>
    </core>
  </models>
</global>

这不是用于筛选电子邮件模板的类。我假设您正在通过cms页面或cms块进行测试。
用于筛选此实体的类由配置路径
global/cms/page/template\u filter
global/cms/block/template\u filter
决定 该路径在
Mage\u Cms
config.xml
文件中定义:

    <cms>
        <page>
            <tempate_filter>cms/template_filter</tempate_filter>
        </page>
        <block>
            <tempate_filter>cms/template_filter</tempate_filter>
        </block>
    </cms>

因此,实际上,对于过滤块,您可以尝试覆盖
Mage\u Widget\u Model\u Template\u Filter

这不是用于过滤电子邮件模板的类。我假设您正在通过cms页面或cms块进行测试。
用于筛选此实体的类由配置路径
global/cms/page/template\u filter
global/cms/block/template\u filter
决定 该路径在
Mage\u Cms
config.xml
文件中定义:

    <cms>
        <page>
            <tempate_filter>cms/template_filter</tempate_filter>
        </page>
        <block>
            <tempate_filter>cms/template_filter</tempate_filter>
        </block>
    </cms>

因此,实际上,对于过滤块,您可以尝试覆盖
Mage\u Widget\u Model\u Template\u Filter

这将如何打印我们的
echo get\u类(Mage::getModel('core/email\u Template\u Filter')
?这是正确的(从技术上说,您应该更好地格式化它):不是缓存问题?@Marius我明白了:Mage\u Core\u Model\u Email\u Template\u filter这意味着你的重写过程有问题。模块未加载或
config.xml
格式不正确。请在问题中张贴您的整个模块。我是说文件
app/etc/modules/Company_Module.xml
app/code/local/Company/Module/etc/config.xml
以及您可能拥有的任何其他文件。但前两个是最重要的。也可以尝试清除缓存,但我认为这对你没有任何好处。K,所以现在我得到了Company_Module_Model_Email_Template_Filter,但是当我在我的网站上加载一个使用带有皮肤标记的CMS块的页面时,它仍然调用核心文件,而不是我的覆盖文件。这会打印我们的
echo get_类(Mage::getModel)吗('core/email\u template\u filter')
?这是正确的(从技术上讲,我的意思是,您应该对其进行更好的格式化):不是缓存问题?@Marius我明白了:Mage\u Core\u Model\u Email\u Template\u filter这意味着你的重写过程有问题。要么是你的模块没有加载,要么是
config.xml
格式不正确。请在问题中发布你的整个模块。我指的是文件。
app/etc/modules/Company\u module.xml
app/code/local/Company/Module/etc/config.xml
和您可能拥有的任何其他文件。但前两个文件是最重要的。也可以尝试清除缓存,但我认为这对您没有任何好处。K,所以现在我得到了Company\u Module\u Model\u Email\u Template\u过滤器,但当我在我的网站上加载一个使用带有皮肤标签的CMS块的页面时,它仍然存在ll调用核心文件,而不是我的覆盖文件。
    <cms>
        <page>
            <tempate_filter>widget/template_filter</tempate_filter>
        </page>
        <block>
            <tempate_filter>widget/template_filter</tempate_filter>
        </block>
    </cms>