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?

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

  • @PrashantTapase the code that you have shown above will not work in theory. Because it holds layout node inside default node. – Rajeev K Tomy Aug 19 '15 at 8:22
  • ...and my code will work...100% sure. I tried it in my local instance. – Rajeev K Tomy Aug 19 '15 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 – Rajeev K Tomy Aug 19 '15 at 8:27
  • yup. glad to help you. – Rajeev K Tomy Aug 19 '15 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... – Prashant Tapase Aug 19 '15 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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.