2

I want to add custom link in the 'top link' section(white list, Login, Account).

Basically i want to add "Blog" link at the top of the links. When user click on the link then its redirect to the external website.

My website URL is www.imageplus.pk.

Please help me how can i do this?

  • Did it work now? – Klettseb May 25 '16 at 8:05
0

To add a new link just do this

Open app/design/frontend/default/TEMPLATE/layout/customer.xml

Add the following at the bottom before closing tag.

    <default>
    <reference name="top.links">
      <action method="addLink" translate="label title">
        <label>Blog</label>
        <url>YOUR-BLOG-URL</url>
        <title>Bloh</title>
        <prepare/>
        <urlParams/>
        <position>2</position>
        <liParams />
       <aParams><![CDATA[target="_blank"]]></aParams>
      </action>
    </reference>
    </default>

Just replace URL with your blog url

<customer_logged_out>
    <reference name="top.links">
        <action method="removeLinkByUrl">
            <url helper="customer/getRegisterUrl" />
        </action>
    </reference>
</customer_logged_out>
  • now my blog link is showing but now i want to hide the "register" link and give a external hyperlink to blog to open in new window. thanks – Muneeb Ahmad Apr 27 '16 at 12:30
  • I have updated the answer, the Register url helper could also be "customer/getLoginUrl" – Klettseb Apr 27 '16 at 12:56
  • its open the url in same window, but i want to open it in new window. thanks – Muneeb Ahmad Apr 28 '16 at 4:01
  • Did you add target=_blank – Klettseb Apr 28 '16 at 4:45
  • this is my code: <action method="addLink" translate="label title"> <label>Blog</label> <url>tumblr.com</url> <title>Blog</title> <prepare/> <urlParams/> <position>100</position> <aParams><![CDATA[target="_blank"]]></aParams> </action> – Muneeb Ahmad Apr 28 '16 at 6:11
1

Top-links are managed in magento through layout xml files. To add a link to top links, we need to add xml code to layout files.

Add Blog link with external URL

<default>
    <reference name="top.links">
      <action method="addLink" translate="label title">
        <label>Blog</label>
        <url>http://www.linktoblog.com</url>
        <title>Blog</title>
        <prepare>true</prepare>
        <position>2</position>
      </action>
    </reference>
</default>

Remove register link

<customer_logged_out>
    <reference name="top.links">
        <action method="removeLinkByUrl">
            <url helper="customer/getRegisterUrl" />
        </action>
    </reference>
</customer_logged_out>

For more detail, you can refer below URLs:

http://excellencemagentoblog.com/blog/2011/09/07/magento-add-top-links-in-magento/ https://stackoverflow.com/a/8240780/2199172

Hope this will help you.

  • hi, thanks, now i can add the blog link at the top of links, but i want to hide the "register" link. and put the external hyperlink to the "blog" link. – Muneeb Ahmad Apr 27 '16 at 11:40
  • I have updated my answer – Shyam Apr 27 '16 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.