Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Correct way to add Link to Top Section in Magento

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 2
    • 0
    • 784
    Comment on it

    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.

     

     

    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:

    Correct way to add Link to Top Section in Magento

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: