I've been racking my brain over this for more time than I'd like to admit right now.
Create a module to change the classes that are present in Magento's Topmenu.
app/etc/modules/Issl_Topmenu.xml
<?xml version="1.0"?>
<config>
<modules>
<Issl_Topmenu>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Catalog/>
<Mage_Page/>
</depends>
</Issl_Topmenu>
</modules>
</config>
app/code/local/Issl/Topmenu/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Issl_Topmenu>
<version>0.0.1</version>
</Issl_Topmenu>
</modules>
<global>
<blocks>
<page>
<rewrite>
<html_topmenu>Issl_Topmenu_Block_Page_Html_Topmenu</html_topmenu>
</rewrite>
</page>
</blocks>
</global>
</config>
app/code/local/Issl/Topmenu/Block/Page/Html/Topmenu.php
<?php
/**
* Topmenu navigation
*
* Update classes on the Topmenu navigation to be more in-keeping with style guides.
*
* @category ISSL
* @package ISSL_Topmenu
* @author ISSL <www.issl.co.uk>
*/
class Issl_Topmenu_Block_Page_Html_Topmenu extends Mage_Page_Block_Html_Topmenu {
/**/
}
Nada. It isn't crashing the page, but it isn't changing the template either. I've confirmed the module is loaded and enabled under System->Configuration->Advanced
and cache is completely disabled.
The issue is clearly something stupid - where am I going wrong??
To perform a simple override of an existing base class, simply copy the class to the same path inside the local codepool and do your customizations there:
FROM:
app\code\core\Mage\Page\Block\Html\Topmenu.php
TO:
app\code\local\Mage\Page\Block\Html\Topmenu.php
File:
class Mage_Page_Block_Html_Topmenu extends Mage_Core_Block_Template
{
// code..
public function getHtml($outermostClass = '', $childrenWrapClass = '')
{
// my custom code
Always remember to flush cache.
So as it turned out, the module was working correctly, but modifying Topmenu is a pain and not as simple (any more) as it could be, the function I was using is deprecated and for my purposes, it's probably simpler to create my own template. Many thanks to Vladimir for helping me get to the bottom of it.