I've just written a small custom menu module for a site I'm working on, and need it to replace the current base/default catalog.topnav. My module's config.xml looks like this:

<?xml version="1.0"?>
                <mymenu module="mymenu">

... and my layout update file magz_mymenu.xml is as follows:

<?xml version="1.0"?>
        <reference name="top.menu">
            <action method="unsetChild"><name>catalog.topnav</name></action>
            <block type="page/html_topmenu" name="catalog.topnav" template="magz/page/html/topmenu.phtml"/>

Now this currently works and renders as it should on the frontend, but I want to know:

  1. Am I doing this correctly?
  2. Is there a difference between action method="unsetChild" and remove name=?

Thank you

1 Answer 1


Am I doing this correctly?

What you're doing is "correct", however if what you want to do is replace the html_topmenu block with your own version, you don't need the layout, just the block rewrite in your config.xml will do.

That way the standard Magento layout will load the block with the alias page/html_topmenu and this alias will resolve to your block instead of the default block.

Is there a difference between action method="unsetChild" and remove name=?

Yes. Please see this question.

  • Great, thank you Robbie. The thing is that I have all of my custom templates contained within a similar folder structure inside of app/design/frontend/magz/default/template/magz/.... So I would have to have the block reference the correct template magz/page/html/topmenu.phtml instead of page/html/topmenu.phtml ... I'm unsure what is best practice here, as my theme inherits rwd/default.
    – maGz
    Commented Jun 1, 2016 at 9:44
  • And thank you for the clarification between the 2 block removal methods. I do understand now when to use which :)
    – maGz
    Commented Jun 1, 2016 at 9:46

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.