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

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>
  • Where I have to add this? – sreelakshmi Feb 28 '17 at 8:06
  • in your module's layout file or local.xml @sree – Gopal Patel Feb 28 '17 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.. – sreelakshmi Feb 28 '17 at 8:31
  • provide your code.. what you have added in <url> tag?? @sree – Gopal Patel Feb 28 '17 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> – sreelakshmi Feb 28 '17 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>
  • 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> – sreelakshmi Feb 28 '17 at 9:45

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.