1

I have some custom module, on activating this module I want to show a "Custom Module Link" as a top link. Please refer the snapshot below.

How can I achieve this? This link should redirect to one of the Customer account navigation link.

toplink

2 Answers 2

1

Try this

<default>
    <reference name="top.links">
        <action method="addLink" translate="label title"><label>Custom</label><url>YOUR_URL_KEY</url><title>Custom</title><prepare/><urlParams/><position>10</position></action>
     </reference>
</default>
8
  • Where I have to add this? Commented Feb 28, 2017 at 8:06
  • in your module's layout file or local.xml @sree Commented Feb 28, 2017 at 8:11
  • I added the code in app/design/frontend/base/default/layout/mymodule/myModule.xml in the top just below <layout>. the code is not working.. I cleared the cache too.. Commented Feb 28, 2017 at 8:31
  • provide your code.. what you have added in <url> tag?? @sree Commented Feb 28, 2017 at 8:35
  • <default><reference name="top.links"><action method="addLink" translate="label title"><label>Custom</label><url>MyModule/customBlock/customFile/</url><title>Custom</title><prepare/><urlParams/><position>10</position></action></reference></default> <customer_account> <reference name="customer_account_navigation"><action method="addLink" translate="label" module="MyModule"> <name>MyModule_customBlock_customFile</name> <path>MyModule/customBlock/customFile/</path> <label>Custom</label> </action> </reference> </customer_account> Commented Feb 28, 2017 at 8:49
1

Top-links are generaly managed in Magento through layout.xml files. To add a link to top links, you need to add an xml code to layout files.

Please refere to this http://excellencemagentoblog.com/blog/2011/09/07/magento-add-top-links-in-magento/

EDIT:

Please put this code under <reference name="top.links"> and before closing tag </reference> in your local.xml

<action method="addLink" translate="label title">
    <label>Your label module</label>
    <url>your custom url</url>
    <title>Your title module</title>
    <prepare>true</prepare>
    <position>2</position>
</action>
1
  • I added like this.. But Not working <default><reference name="top.links"><action method="addLink" translate="label title"><label>Custom</label><url>MyModule/customBlock/custom‌​File/</url><title>Cu‌​stom</title><prepare>true<prepare‌​/><urlParams/><posit‌​ion>2</position></a‌​ction></reference></‌​default> <customer_account> <reference name="customer_account_navigation"><action method="addLink" translate="label" module="MyModule"> <name>MyModule_customBlock_customFile</name> <path>MyModule/customBlock/customFile/</path> <label>Custom</label> </action> </reference> </customer_account> Commented Feb 28, 2017 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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