人
我需要覆盖不同类中的2个函数(CatalogSearch / Layer.php和CatalogSearch / Mysql4 / Fulltext / Collection.php)。所以,我有一个配置文件:
<config>
<modules>
<my_modulename>
<version>0.1</version>
</my_modulename>
</modules>
<global>
<models>
<catalogsearch>
<rewrite>
<layer>My_Modulename_Model_CatalogSearch_Layer</layer>
<mysql4_fulltext_collection>My_Modulename_Model_CatalogSearch_Mysql4_Fulltext_Collection </mysql4_fulltext_collection>
</rewrite>
</catalogsearch>
</models>
</global>
</config>
因此,Layer.php已被正确覆盖,但Collection.php没有 - 甚至没有包含'/local/My/Modulename/Model/CatalogSearch/Mysql4/Fulltext/Collection.php'。为什么?
感谢您的帮助。
答案 0 :(得分:8)
资源模型可能是单独处理的,请尝试:
<global>
<models>
<catalogsearch>
<rewrite>
<layer>My_Modulename_Model_CatalogSearch_Layer</layer>
</rewrite>
</catalogsearch>
<catalogsearch_mysql4>
<rewrite>
<fulltext_collection>My_Modulename_Model_CatalogSearch_Mysql4_Fulltext_Collection</fulltext_collection>
</rewrite>
</catalogsearch_mysql4>
</models>
</global>