I have two sites in a multi-site Magento EE installation. I must rewrite the _getHtml function of the Mage_Page_Block_Html_Topmenu class for just one of the sites. Is it possible to target this rewrite to a single site, or am I going about this wrong?

The config.xml for the overwriting Page module is as follows:

<!-- Foo used as module name for posting purposes -->
            <depends><!-- no dependencies --></depends>

Currently this rewrite is affecting both sites' topmenu blocks. I would like to use the default _getHtml function for one site, and use my rewrite for the other. Is this possible in a multi-site setup?

1 Answer 1


A simple way of doing this would be in your function to check what store you are in and then choosing either your new code or simply calling the parent function.

But you could also change the code from a rewrite to use either page_block_html_topmenu_gethtml_after or page_block_html_topmenu_gethtml_before and then when you are on a site that you want to change the html then you can do this via an observer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.