【问题标题】:Overload Magento Report Collection on config.xml在 config.xml 上重载 Magento 报告集合
【发布时间】:2014-02-11 13:42:21
【问题描述】:

我正在尝试创建类 Mage_Reports_Model_Resource_Quote_Collection 的覆盖,我创建了我的自定义类并在 etc/config.xml 上对其进行了配置,但由于某种原因它无法正常工作..

这不是我的第一个覆盖类,我想我或多或少知道那里的事情是如何工作的,但也许它是扩展报告集合的一个边缘案例(?)

我应该在config.xml 上具体写什么?

我的代码是:

<models>
....
  <reports>
      <rewrite>
        <resource_quote_collection>Mage_Customization_Model_Reports_Resource_Quote_Collection</resource_quote_collection>
      </rewrite>
  </reports>
.....
</models>

谢谢:)

【问题讨论】:

    标签: xml magento overriding overloading extends


    【解决方案1】:

    试试这样:

    <reports_resource>
        <rewrite>
            <quote_collection>Mage_Customization_Model_Reports_Resource_Quote_Collection</quote_collection>
        </rewrite>
    </reports_resource>
    

    还有一些题外话。不要使用 Mage 作为您的命名空间。更有创意,把它留给核心开发者。

    【讨论】:

    • 谢谢,但它不起作用..关于我知道但我维护现有和非我的代码的命名空间..所以我别无选择;)我应该在哪里使用类Mage_Customization_Model_Reports_Resource_Quote_Collection 的路径?
    • 这很奇怪。它应该工作。确保您清除了缓存。
    • 清除.. 它应该在什么路径?
    • 什么意思是什么路径?我不明白。你是这个意思吗? Mage::getResourceModel('reports/quote_collection') ?
    • 文件系统上新类文件的路径,现在位于/app/code/local/Mage/Customization/Model/Reports/Resource/Quote/Collection.php
    猜你喜欢
    • 2014-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-25
    • 1970-01-01
    • 2015-05-26
    • 1970-01-01
    相关资源
    最近更新 更多