Magento Theme: Changing topLinks

I’m building a webstore using Magento. I’ve used osCommerce in the past, but with this new store, I wanted to try a different e-commerce package. While creating the Magento theme, I could not figure out how to change/remove the the menu items on the top links on the site (My Account, Wishlist, Checkout, Login). It was actually quite easy.

In the header.phtml file (/app/design/frontend//default/template/page/html/header.phtml),
the following php code controls the displaying of the template:

<?php echo $this->getChildHtml('topLinks') ?>

Initially I thought that topLinks were set in the store administration, but I could not find it anywhere. After some reading, I found that the top menu items are controlled by xml files.

My Account, Login/Logout top menu items are controlled by the file /app/design/frontend/base/default/layout/customers.xml. The ‘Wishlist’ menu item are controlled by the file /app/design/frontend/base/default/layout/wishlist.xml. And the ‘Chekcout’ menu item are controlled by the file /app/design/frontend/base/default/layout/checkout.xml.

First, copy the relevant xml files to your layout folder (/app/design/frontend//default/layout/)
To remove the ‘My Account’ menu item to display, Comment out (or remove) the following:

<!--<default>
        <!-- Mage_Customer
        <reference name="top.links">
            <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>
        </reference>
</default> -->

Note: After editing the file, you must first clear Magento’s cache (System->Cache Management). I took me a while to figure this out. I could not understand why the changes were not being displayed.

Anyway, I hope this helps someone else.

Be Sociable, Share!

Checkout My New Site - T-shirts For Geeks