2

How to Add top link after "My Wishlist". The link should be visible on activating my custom module.I'm using Magento 1.9. I added the following

   <reference name="top.links"> 
      <action method="addLink" translate="label title" module="mymodule"> 
           <label>My Link</label> 
           <url helper="mymodule/quote/history/"/> 
           <title>My Link</title> 
           <prepare>true<prepare/> 
           <position>2</position> 
       </action> 
   </reference>
5
  • Where did you add this code? Commented Feb 28, 2017 at 11:04
  • @JaiminSutariya app/design/frontend/base/default/layout/mymodule/mymodule.xml Commented Feb 28, 2017 at 11:07
  • Make sure you added your code under <default> tag, because your code is correct and it should work. Also make sure your layout xml files is being called. Commented Feb 28, 2017 at 11:12
  • yes @JaiminSutariya my code has <default> tag. Is there any other requirement other than clearing cache Commented Feb 28, 2017 at 11:14
  • No, there is no other requirements, it will be better if you can add your config.xml and helper mymodule/quote/history code to the question. Commented Feb 28, 2017 at 11:22

2 Answers 2

1

You can do this by (This is my complete module's layout file):

<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
     <reference name="top.links">
            <action method="addLink" translate="label title">
                <label>Custom Home Link</label>
                <url>home</url>
                <title>Custom Home Link</title>
                <prepare/>
                <urlParams/>
                <position>10</position>
            </action>
        </reference>
        </default>    
</layout>
8
  • I tried all these codes.. Still the links is not appearing in the front end.. :( Commented Feb 28, 2017 at 11:19
  • @DEEPESHKUMARR Please clear your cache and make sure your layout file is being called this is tested code.
    – Arunendra
    Commented Feb 28, 2017 at 11:22
  • @DEEPESHKUMARR let me know if this worked
    – Arunendra
    Commented Feb 28, 2017 at 11:34
  • No it's not working. I cleared cache as well Commented Feb 28, 2017 at 11:55
  • I added the same code in customer.xml file under theme modern. Then the link appeared.. Is it the proper way? Commented Feb 28, 2017 at 12:11
1

Please add this local.xml or any other module xml over fronted layout folder.

 <default>
        <!-- Mage_Customer -->
        <reference name="top.links">
            <action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
        </reference>
    </default>

Also you can follow below links for the same.

URL : http://excellencemagentoblog.com/blog/2011/09/07/magento-add-top-links-in-magento/

3

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.