1

I am trying to remove top menu from product and product display page. I created local.xml file and added below code.

<?xml version="1.0" ?>
<layout version = "0.1.0">
    <default>
        <catalog_category_default>
           <reference name="header">
              <remove name="top.menu" />
           </reference>
        </catalog_category_default>
    </default>
</layout>

But this is not working. How to remove? what is wrong in this code?

2 Answers 2

1

If you are mentioning category pages and product view pages, then try this in your local.xml file

 <?xml version="1.0" ?>
 <layout version = "0.1.0">
    <catalog_category_view>
        <remove name="top.menu" />
    </catalog_category_view>
    <catalog_product_view>
        <remove name="top.menu" />
    </catalog_product_view>
</layout>

Note : You should make sure that, local.xml file resides in the correct package/theme location

7
  • @PrashantTapase the code that you have shown above will not work in theory. Because it holds layout node inside default node. Commented Aug 19, 2015 at 8:22
  • ...and my code will work...100% sure. I tried it in my local instance. Commented Aug 19, 2015 at 8:25
  • @PrashantTapase you should try my code exactly as that. ie you dont need <?xml version="1.0" ?> <layout version = "0.1.0"> <default> to use this part Commented Aug 19, 2015 at 8:27
  • yup. glad to help you. Commented Aug 19, 2015 at 8:27
  • But as per my knowledge we need keep fix code <?xml version="1.0" ?> <layout version = "0.1.0"> <default> ......</default> </layout> and inbetween that we write code... Commented Aug 19, 2015 at 8:30
0

Try this:

<?xml version="1.0" ?>
<layout version = "0.1.0">
    <default>
        <reference name = "left">
            <action method = "unsetChild"><name>topMenu</name></action>
        </reference>
        <reference name = "header">
            <action method = "insert"><blockName>top.menu</blockName></action>
        </reference>
    </default>
</layout>

just change the reference name. that is unset the "left" and insert in "header".Hope it helps you.

4
  • your logic is correct but it is not working for me. i think my local.xml is not working. Commented Aug 17, 2015 at 10:27
  • this should work have you cleared magento cache
    – Bobadevv
    Commented Aug 17, 2015 at 10:39
  • @donika : Not working . I cleared my cache Commented Aug 17, 2015 at 10:46
  • this will not work, as far as I know Commented Aug 19, 2015 at 7:39

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.