strawbicus
strawbicus

Reputation: 39

How to rewrite/extend a Magento class in an existing third party extension

I'm trying to extend the class of a third party Magento extension.

My module xml:

within config>modules> tags

<EDPA_MegaNavigation>

        <active>true</active>

        <codePool>local</codePool>

        <depends>
            <Infortis_UltraMegamenu />
        </depends>

    </EDPA_MegaNavigation>

My Config xml:

within config>global>blocks> tags

 <ultramegamenu>

       <rewrite>

           <Infortis_UltraMegamenu_Block_Navigation>EDPA_MegaNavigation_Block_Navigation</Infortis_UltraMegamenu_Block_Navigation>

       </rewrite>

   </ultramegamenu>

My extended class (Navigation.php) has

class EDPA_MegaNavigation_Block_Navigation extends Infortis_UltraMegamenu_Block_Navigation
{
########
}

Within system>configuration>advanced EDPA_MegaNavigation is listed and shows as enabled.

My target navigation.php within Infortis>UltraMegamenu>Block is not being rewritten.

Any help/guidance much appreciated.

Upvotes: 4

Views: 1735

Answers (2)

Amit Bera
Amit Bera

Reputation: 7611

Here the issue in if Infortis_UltraMegamenu module block tag is ultramegamenu then

<ultramegamenu>

       <rewrite>

           <navigation>EDPA_MegaNavigation_Block_Navigation</navigation>

       </rewrite>

   </ultramegamenu>

Upvotes: 4

Don
Don

Reputation: 333

Your <rewrite> doesn't look to be set up properly, it's supposed to reference another config node and not a direct class name. Check the UltraMegamenu's config.xml to get the node from it.

e.g. If UltraMegamenu is set up like:

<blocks>
    <ultramegamenu>
        <class>Infortis_UltraMegamenu_Block_Navigation</class>
    </ultramegamenu>
</blocks>

Then your rewrite child node would be "ultramegamenu" instead of the class name.

Upvotes: 0

Related Questions