Organizational Research By

Surprising Reserch Topic

magento block override from two different modules


magento block override from two different modules  using -'magento,override,block'

Hi I have some issues in overriding a magento core block. In my module I need to override Mage_Catalog_Block_Navigation

<blocks>
  <catalog>
    <rewrite>
            <navigation>Mycompany_Mymodule_Catalog_Block_Navigation</navigation>
        </rewrite>
  </catalog>
</blocks>


but this is already overridden by another magento extension from another company:

<blocks>
  <catalog>
    <rewrite>
        <navigation>Othercompany_Othermodule_Block_Navigation</navigation>
    </rewrite>
  </catalog>
</blocks>


Both extension overrides different methods and they don't know abut each other, but magento reads the second company overrides and not my. I don't want to use module dependencies. Is there any way to not break the two extensions functionality.
    

asked Oct 19, 2015 by sujata naik
0 votes
5 views



Related Hot Questions

2 Answers

0 votes

Yes, you have to decide which one officially overwrites the core Block. Have that one inherit the one that isn't doing the override, and have that one inherit the core one.

My_Custom_Block extends Other_Custom_Block
Other_Custom_Block extends Mage_Core_Block
Mage_Core_Block extends Whatever_Magento_Wants

Edit the config.xml files so that only My_Custom_Block is the one that is overriding the core Block.

EDIT Here's the XML you need:


  
    
            Mycompany_Mymodule_Catalog_Block_Navigation
        
  

answered Oct 19, 2015 by kotmus2002
0 votes

Thx Max. I think, like your example, that the "My_Custom_Block" should be the last hierarchic class, so you don't touch anythings in "Other_Custom_Block" class.

Then you have only to comment the rewrite rule in "Other Company" config.xml.

answered Oct 19, 2015 by loknath.ganji

...