简体   繁体   English

Magento:覆盖Mage_CatalogSearch_Model_Resource_Helper_Mysql4

[英]Magento: overriding Mage_CatalogSearch_Model_Resource_Helper_Mysql4

I spent almost two days on searching the web about this topic, but i don't know why my class doesn't override Mage_CatalogSearch_Model_Resource_Helper_Mysql4 (core/Mage/CatalogSearch/Model/Resource/Helper/Mysql4.php). 我花了将近两天的时间在网上搜索有关此主题的内容,但是我不知道为什么我的课程不会覆盖Mage_CatalogSearch_Model_Resource_Helper_Mysql4(core / Mage / CatalogSearch / Model / Resource / Helper / Mysql4.php)。

My class is 我的课是

class Company_Module_Model_Override_CatalogSearch_Resource_Helper_Mysql4 extends
    Mage_CatalogSearch_Model_Resource_Helper_Mysql4
{
}

the file is located in local/Company/Module/Model/Override/CatalogSearch/Resource/Helper/Mysql4.php 该文件位于本地/公司/模块/模型/替代/ CatalogSearch /资源/Helper/Mysql4.php

My config file is: 我的配置文件是:

<global>
    <models>
        <catalogsearch_resource_helper>
            <rewrite>
                    <mysql4>Company_Module_Model_Override_CatalogSearch_Resource_Helper_Mysql4</mysql4>
                </rewrite>
            </catalogsearch_resource_helper>
    </models>
</global>

The module override other modules without problems, so I cannot figure out how to solve... Any idea? 该模块可以覆盖其他模块而不会出现问题,因此我无法弄清楚如何解决...有任何想法吗? Thank you 谢谢

Enzo,而不是做所有这些事情,只需从核心目录app \\ code \\ core \\ Mage \\ CatalogSearch \\ Model \\ Resource \\ Helper复制Mysql.php并将其粘贴到本地目录app \\ code \\ local \\ Mage \\ CatalogSearch \\ Model \\资源\\助手,并相应地修改您的代码

I am posting here the solution I came up with. 我在这里发布我想出的解决方案。 The right override declaration in the config.xml file should be as following: config.xml文件中的正确覆盖声明应如下所示:

<global>
    <models>
        <catalogsearch_resource>
            <rewrite>
                  <helper_mysql4>Company_Module_Model_Override_CatalogSearch_Resource_Helper_Mysql4</helpr_mysql4>
            </rewrite>
        </catalogsearch_resource>
    </models>
</global>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Magento - CatalogSearch模块覆盖不起作用 - Magento - CatalogSearch Module overriding not working Magento - Mage注册表项“_resource_helper / core”已经存在 - Magento - Mage registry key “_resource_helper/core” already exists Magento覆盖Mage_Core_Model_Email类 - Magento overriding Mage_Core_Model_Email class 当预期使用Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection时,使用Mage_Catalog_Model_Resource_Product_Collection对象的Magento 1.9.0.1 - Magento 1.9.0.1 using Mage_Catalog_Model_Resource_Product_Collection object when Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection is expected 如何在Magento工作Mage :: helper? - How work Mage :: helper in Magento? Magento法师:: helper(&#39;目录/类别&#39;) - Magento Mage::helper('catalog/category') Magento中的/ app / code / core / Mage / Catalog / Model / Resource文件夹? - /app/code/core/Mage/Catalog/Model/Resource folders in Magento? Magento upsell_products引发错误“必须是Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection的实例” - Magento upsell_products raises error “must be an instance of Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection” 在magento上找不到Mage_Checkout_Model_Mysql4_Setup&#39; - Mage_Checkout_Model_Mysql4_Setup' not found on magento Magento-从Mage_Catalog_Model_Resource_Product_Collection对象访问值 - Magento - Accessing values from an Mage_Catalog_Model_Resource_Product_Collection object
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM