Magento – How to edit navigation bar’s html

magento-1.7templatetheme

I am trying to change the html of my navigation bar ( like adding some div tags etc ) but not getting it how to do this so far i did this.

I know template for top menu is topmenu.phtml and it is using the file app/code/core/Mage/Catalog/Block/Navigation.php. So as we should not change the core files i copied this file to the directory app/code/local/Mage/Catalog/Block/Navigation.php.

Now the change i am doing here is not reflecting in the frontend i have tried refreshing the cache already.

It woul be great if anybody can tell me about the various actions here and which action to edit for changing the html of topmenu navigation bar i have 3 level categories i.e level-0,level-1 and level-2.

Thanks in advance

Best Answer

Since the template does nothing but call the block method (getMenuHtml()) to render the HTML, you might be best off to just replace the navigation template with your own block and template that does what you wish. By doing this you isolate any changes from default into their own files/module and you avoid having to rewrite core files.

There are a million ways to do a better job than the core team when it comes to this specific block. Giving someone a template that does nothing but call a method that renders unseen HTML is hardly even a template in the first place. Just replace it.