I've edited the Topmenu.php file so that it adds foundation classes to the drop down menus. Works just fine, but it will probably get overwritten on an update. How do I enable it as a module?

How do I use local.xml to tell magento to use the new menu instead of the default one?

1 Answer 1


I assume you mean page/html/topmenu.phtml in the theme. You can edit the phtml file, as long as you have moved it from the default theme into your own theme.

However, if you want to be more elegant about it and use an observer, see below on a rough idea on how to do that.

If you search your layout files, you'll find that this file is the theme for the page/html_topmenu block.

Open app/code/core/Mage/Page/Block/Html/Topmenu.php and look at the getHtml that is called in the template file. In that function, you'll notice that there is an event thrown page_block_html_topmenu_gethtml_after. You could create a module that has an observer (google it, lots of resources on create modules/observers) and in this observer it could modify the menu to your liking.

  • nope - app/code/core/Mage/Page/Block/Html/Topmenu.php is the file I edited. So if I understand what you are getting at, let magento create the menu then use an observer to parse through the html and add my updates then? Nov 11, 2015 at 3:08
  • 1
    Okay, yeah, editing the actual php file in core is always a bad idea. You can move that to app/code/local/Mage/Page/Block/Html/Topmenu.php and be better, but the observer is the best way to go. If that doesn't work for you, the second best method is to create a module and overwriting Topmenu.php instead of copying it to local. Nov 11, 2015 at 3:12
  • just copying the updated file! well that was easy then! Nov 11, 2015 at 3:17

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.