Hello Readers,
In this blog, I’m going to show you the correct way to add an extra link to the existing top links section under Account.
Existing top links are: My Cart, My Account, Checkout, My Wishtlist, Login etc
These Top-links are managed in magento through layout xml files, See the below image.
![](http://findnerd.s3.amazonaws.com/imagedata/6423/6423.png)
Top Links=> Above top links are coming from different layout xml files.
My Account & login: these link is found in the customer.xml file.
My Cart and Checkout: are coming from checkout.xml
My Wishlist: is coming from wishlist.xml
Add New Link To The Existing Top Links
Suppose i need to add a new link for a CMS page called Contact Us. To do this open a layout file, let say customer.xml and add the below code:
<default>
<reference name="top.links">
<action method="addLink" translate="label title">
<label>Contact Us</label>
<url>contacts</url>
<title>Contact</title>
<prepare>true</prepare>
<position>2</position>
</action>
</reference>
</default>
The above code is correct way to add new link.
Output:
![](http://findnerd.s3.amazonaws.com/imagedata/6426/6426.png)
0 Comment(s)