4

guys.

I need to override 2 functions in different classes (CatalogSearch/Layer.php and CatalogSearch/Mysql4/Fulltext/Collection.php). So, I have a config file:

<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>

Hence, Layer.php has been overridden correctly , but Collection.php hasn't - '/local/My/Modulename/Model/CatalogSearch/Mysql4/Fulltext/Collection.php' was not even included. Why?

Thank you for any help.

lexa
  • 955
  • 2
  • 13
  • 18

1 Answers1

8

The resource models are probably handled separately, try this:

<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>
clockworkgeek
  • 37,650
  • 9
  • 89
  • 127
  • Exactly... This is maybe the last variation I didn't try. I think this is correct My_Modulename_Model_CatalogSearch_Mysql4_Fulltext_Collection – lexa Jul 04 '11 at 21:15
  • Look in `app/code/core/Mage/CatalogSearch/etc/config.xml` and you will see there are model declarations for `` and ``, this is where your rewrites will get merged to. It does not have a `` section so I doubt that will work. – clockworkgeek Jul 04 '11 at 21:19