Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento - Extending Topmenu.php block stops the topmenu.phtml template loading

Tags:

php

magento

I'm extending app/code/core/Mage/Page/Block/Html/Topmenu.php with the following xml:

<config>
    <modules>
        <Custom_Menu>
            <version>1.0</version>
        </Custom_Menu>
    </modules>
    <global>
        <blocks>
            <page>
                <rewrite>
                    <html_topmenu>Custom_Menu_Block_Page_Html_Topmenu</html_topmenu>
                </rewrite>
            </page>
        </blocks>
    </global>
</config>

And my class definition:

class Custom_Menu_Block_Page_Html_Topmenu extends Mage_Page_Block_Html_Topmenu
{

}

Even with my class not overriding any methods, the following template file just doesn't get processed:

app/design/frontend/base/default/template/page/html/topmenu.phtml

I'm not overriding the template file.

As soon as I disable my module, it starts working again.

Do I need to declare anything else in my xml file?

like image 722
MacroMan Avatar asked Sep 19 '12 09:09

MacroMan


1 Answers

Do this change in your config.xml file

<html_topmenu>Custom_Menu_Block_Html_Topmenu</html_topmenu>

and change your class name to

class Custom_Menu_Block_Html_Topmenu extends Mage_Page_Block_Html_Topmenu
{

}
like image 135
Abdul Avatar answered Sep 28 '22 16:09

Abdul