I'm using Magento 1.4 and I want to remove the "Checkout" and "My Cart" links from the top navigation menu. I know I have to change something in a layout file but I'm not sure which one. I searched for "checkout" and "addLink" but found nothing related to those two links.
3 Answers
The best way is to not touch the core layout files, instead your best bet is to create custom theme with only one layout file local.xml like described here To remove the links from the top menu you would need to add these lines in your local.xml file:
<default> <reference name="top.links"> <remove name="checkout_cart_link" /> </reference> </default>
I believe this will remove the checkout and my cart links from the top menu. If this doesn't work, try changing top.links with topLinks since in page.xml it is declared as="topLinks"
<reference name="topLinks"> <remove name="checkout_cart_link" /> </reference>

- 2,173
- 1
- 22
- 24
To change this in a custom package/theme, copy the layout file checkout.xml
from $MAGENTO/app/design/frontend/base/default/layout/checkout.xml
to $MAGENTO/app/design/$PACKAGE/$THEME/layout/checkout.xml
Then find the following lines:
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
in that file.
Then just comment those lines out (put <!--
at the beginning of each line and put -->
at the end of each line).
In terms of CSS selectors, this would be: layout > default > referance[name='top.links'] > block > action
-
1I know this topic is very old now but the other solution should be accepted as the best answer. While it will work just fine, this method requires an additional step which is bulky and overkill. Providing as many solutions through your local.xml will save you space, time and a lot of headache while developing. Any way to make life easier in a win in my book. – Jared Eitnier Aug 08 '12 at 13:52
-
1You should always avoid duplicating native layout files into your theme when the same can be achieved using just a single local.xml file as per the first answer given. This is simply because if you create an override you are going to have problems come upgrade when your theme's layout files don't have access to any changes in block names or paths template files that inevitably come up! – BenLeah Feb 01 '14 at 21:01
In order to do BOTH the Checkout link and the Top Cart you'll need to put these within the <default> </default>
of your local.xml in your layout folder (app/design/frontend/THEME/THEMENAME/layout/
)
// Checkout Link
<reference name="topLinks">
<remove name="checkout_cart_link" />
</reference>
// Top Cart Link
<reference name="header">
<action method="unsetChild"><alias>topCart</alias></action>
</reference>

- 661
- 5
- 15