Magento Forum

Multiple Rewrites of Classes
 
TheLaw
Jr. Member
 
Total Posts:  10
Joined:  2008-11-30
 

Hello,

I have a community module with a class called Netzarbeiter_GroupsCatalog_Model_Resource_Eav_Mysql4_Product_Collection installed.
This class rewrites Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection.

However, I wanted to rewrite this class also. Magento only seems to use the rewrite from the last XML-File it reads. Is there a possibility to do it multiple times?

I would have no problem with rewriting the community module. However, using

<groupscatalog_resource_eav_mysql4>
          <
rewrite>
            <
product_collection>Foo_CustomerDiscount_Model_Resource_Eav_Mysql4_Product_Collection</product_collection>
          </
rewrite>
        </
groupscatalog_resource_eav_mysql4>

instead of

<catalog_resource_eav_mysql4>
          <
rewrite>
            <
product_collection>Foo_CustomerDiscount_Model_Resource_Eav_Mysql4_Product_Collection</product_collection>
          </
rewrite>
        </
catalog_resource_eav_mysql4>

does not work.

Any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

The Mage_Core_Model_Config class does not currently support multiple rewrite chaining.

What you should do is define that your module depends on the Netzarbeiter_GroupCatalog module, that will insure your module gets loaded AFTER the other one.  Then simply extend the class from the Netzarbeiter_GroupCatalog module.

 
Magento Community Magento Community
Magento Community
Magento Community
 
TheLaw
Jr. Member
 
Total Posts:  10
Joined:  2008-11-30
 

Thanks, seems to work fine.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top