Magento Themes and Magento Extensions

Magento – Add Remove top links using Layout.xml

Share

Magento – Add Remove top links using Layout.xml

Removing or Adding top links in the header section of the theme is very easy via Layout.xml files. However we need to edit multiple files to accomplish this task like wishlist.xml, customer.xml, checkout.xml etc.

1. To Remove Wishlist link from top links

Open the file /app/design/frontend/package/theme/layout/wishlist.xml and find the lines given below, simply comment these lines to remove the wishlist link.

<!--<reference name="top.links">
     <block type="wishlist/links" name="wishlist_link"/>
     <action method="addLinkBlock"><blockName>wishlist_link</blockName></action>
</reference>-->

2. To remove My Account link

Open the file /app/design/frontend/package/theme/layout/customer.xml and find the lines and comment these lines

<!--<action method="addLink" translate="label title" module="customer"><label>My Account</label>
<url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/>
<position>10</position>
</action>-->

3. Add Home Link in top menu

Open the file /app/design/frontend/package/theme/layout/customer.xml and search the line

‘<default><reference name=”top.links”>’

Under the ‘<reference name=”top.links”>’ add these lines

<action method="addLink" translate="label title" module="customer">
<label>Home</label><url helper="core/url/getHomeUrl"/><title>Home</title><prepare/><urlParams/>
<position>10</position>
</action>

4. To Remove or Add Checkout and My Cart link in top menu

To show or hide the Checkout and My Cart link in the top links just comment or un-comment these lines in /app/design/frontend/package/theme/layout/checkout.xml file

<?php
//My Cart link
<action method="addCartLink"></action>

//Checkout link
<action method="addCheckoutLink"></action>
?>

Comments are closed.