Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 3
Add link to CMS page in top.links
 
tin_soldier
Jr. Member
 
Total Posts:  26
Joined:  2008-08-29
 

I want to add a link to the cms customer service page within top.links. I know I can add the following action to customer.xml but what is the correct code to place after url helper ?

<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>
<action method="addLink" translate="label title” module="customer"><label>Customer Service</label><url helper=”customer/getAccountUrl”/><title>Customer Service</title><prepare/><urlParams/><position>200</position></action>
</reference>

Any help greatly appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
tin_soldier
Jr. Member
 
Total Posts:  26
Joined:  2008-08-29
 

Actually, figured it out myself. For anyone who need it, the correct syntax is:

<action method="addLink" translate="label title” module="customer"><label>Customer Service</label><url>customer-service</url><title>Customer Service</title><prepare/><urlParams/><position>200</position></action>

 
Magento Community Magento Community
Magento Community
Magento Community
 
RobOrr
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2008-06-04
 

I’d be interested in learning more about what you did and how you did it.  Did you make your modification in the source files?  Is there a way this can be done through the admin interface?

 
Magento Community Magento Community
Magento Community
Magento Community
 
jofgav
Jr. Member
 
Avatar
Total Posts:  30
Joined:  2008-04-09
UK
 

Version 1.1.6
I would suggest looking in /app/design/frontend/default/default/layout/page.xml
Find:

<block type="page/template_links" name="top.links" as="topLinks"/>
Change to it from a self closing tag to the following:
<block type="page/template_links" name="top.links" as="topLinks">
</
block>

Add an action within this tag.  In my case I was adding a home link to the start.
I added:

<action method="addLink" translate="label title"><label>Shop</label><url>/</url><title>Shop</title><prepare/><urlParams/><position>1</position></action>

Complete code:

<block type="page/template_links" name="top.links" as="topLinks">
<
action method="addLink" translate="label title"><label>Shop</label><url>/</url><title>Shop</title><prepare/><urlParams/><position>1</position></action>
</
block>

Please be careful with quotes. I notice one of those posted previously contained ” which make your code syntax highlighting look odd.

 
Magento Community Magento Community
Magento Community
Magento Community
 
existence
Jr. Member
 
Total Posts:  9
Joined:  2007-12-14
 

Strange. I added this in myself and it doesn’t work… nothing displays at all just the core menu items.

 
Magento Community Magento Community
Magento Community
Magento Community
 
2Koncepts
Jr. Member
 
Avatar
Total Posts:  15
Joined:  2008-10-27
Portland, OR
 

Hi Everyone,

I read all the other posts and tried some of their suggestions, but nothing worked so here is a summary of how I did it.

Step-by-step… how to add a link to the top-links page that contains: My Account | My Wishlist | My Cart | Checkout | Log In

You can see an example of our link “Why Tungsten Carbide?” here: http://www.ringcartel.com

First… open this file: app\design\frontend\default\YOUR_THEME\layout\customer.xml

Next… add this code (see below) almost anywhere in the file, the <position>5</position> can be raised or lowered depending on where you want the link to fall in the list:

<default>
<!-- Mage_Customer -->
<reference name="top.links">
<action method="addLink" translate="label title” module="customer"><label>YOUR LABEL</label><url>YOUR-PAGE</url><title>YOUR CUSTOM TITLE</title><prepare/><urlParams/><position>5</position></action>
</reference>
</default>

Last… to make the page “YOUR-PAGE” you will need to access the magento admin area and make a page using CMS > Manage Pages then click the Add New Page link in the top right corner.

This is very simple, but can be tricky at first… let me know if there is any errors, suggestions, or questions.

 
Magento Community Magento Community
Magento Community
Magento Community
 
2Koncepts
Jr. Member
 
Avatar
Total Posts:  15
Joined:  2008-10-27
Portland, OR
 

I did notice one problem using the above method. When a user clicks on the “Contact Us” link first and then on the “Why Tungsten Carbide?” link it goes the the incorrect page. To fix this I hard coded the “YOUR-PAGE” link to include the whole URL like this: “http://ringcartel.com/store/index.php/tungsten-carbide” instead of this “tungsten-carbide”

I’m not sure if there is a better way… I assume it has something to do with the “url handler” so any suggestions would be great.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Juan R
Jr. Member
 
Total Posts:  9
Joined:  2008-09-26
 
2Koncepts - 09 November 2008 10:42 AM

I did notice one problem using the above method. When a user clicks on the “Contact Us” link first and then on the “Why Tungsten Carbide?” link it goes the the incorrect page. To fix this I hard coded the “YOUR-PAGE” link to include the whole URL like this: “http://ringcartel.com/store/index.php/tungsten-carbide” instead of this “tungsten-carbide”

I’m not sure if there is a better way… I assume it has something to do with the “url handler” so any suggestions would be great.

Use <prepare>true</prepare>

<action method="addLink" translate="label title” module="customer"><label>Customer Service</label><url>customer-service</url><title>Customer Service</title><prepare>true</prepare><urlParams/><position>1000</position></action>

 
Magento Community Magento Community
Magento Community
Magento Community
 
asleo
Jr. Member
 
Total Posts:  6
Joined:  2008-09-13
 
jofgav - 28 October 2008 01:55 AM

Version 1.1.6
I would suggest looking in /app/design/frontend/default/default/layout/page.xml
[CUT]
Add an action within this tag.  In my case I was adding a home link to the start.
I added:

<action method="addLink" translate="label title"><label>Shop</label><url>/</url><title>Shop</title><prepare/><urlParams/><position>1</position></action>

Complete code:
<block type="page/template_links" name="top.links" as="topLinks">
<
action method="addLink" translate="label title"><label>Shop</label><url>/</url><title>Shop</title><prepare/><urlParams/><position>1</position></action>
</
block>

Thanks! But i don’t get the text “Home” (I use “Home” instead of “Shop”, but have the same problem when using “Shop") to be translated. I have a multi store using many languages, but it shows “Home” on the link in all the store views. I have searched a lot, and have not been able to get the “Home” text to use the translation from the different language packs. Please help!

PS: I am using Version 1.1.6.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jofgav
Jr. Member
 
Avatar
Total Posts:  30
Joined:  2008-04-09
UK
 

Hi Asle, In response to your PM.

Please try my solution over here at How do I add a Home/Shop link AND have it display in the correct language? (multi-lang site question)

In a nutshell instead of using “Store” in you’re custom link’s text you, need to use:-

<?php echo $this->__('Store'?>
Once you’ve done this you can add your translations to your custom themes as I describe by creating a translate.csv for each of your languages.

If you get stuck let me know…
I sometimes write these things in a hurry… pizza to eat, home-made at that! O_o

 
Magento Community Magento Community
Magento Community
Magento Community
 
asleo
Jr. Member
 
Total Posts:  6
Joined:  2008-09-13
 
jofgav - 03 December 2008 11:51 AM

Hi Asle, In response to your PM.

Please try my solution over here at How do I add a Home/Shop link AND have it display in the correct language? (multi-lang site question)

In a nutshell instead of using “Store” in you’re custom link’s text you, need to use:-

<?php echo $this->__('Store'?>
Once you’ve done this you can add your translations to your custom themes as I describe by creating a translate.csv for each of your languages.

If you get stuck let me know…
I sometimes write these things in a hurry… pizza to eat, home-made at that! O_o

Thank you! But i am trying to place the “Home” link in the header menu (left for “My account"), but it seems like the example you link to, is for the category menus.

I will try to experiment a little more, maybe i get lucky! grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
jofgav
Jr. Member
 
Avatar
Total Posts:  30
Joined:  2008-04-09
UK
 

Oops, I see what you mean now. Not really sure. I’ve not come across that yet so good luck!

 
Magento Community Magento Community
Magento Community
Magento Community
 
oakRunk
Sr. Member
 
Total Posts:  117
Joined:  2008-09-15
 
Asle Ommundsen - 02 December 2008 12:26 PM

jofgav - 28 October 2008 01:55 AM
Version 1.1.6
I would suggest looking in /app/design/frontend/default/default/layout/page.xml
[CUT]
Add an action within this tag.  In my case I was adding a home link to the start.
I added:
<action method="addLink" translate="label title"><label>Shop</label><url>/</url><title>Shop</title><prepare/><urlParams/><position>1</position></action>

Complete code:
<block type="page/template_links" name="top.links" as="topLinks">
<
action method="addLink" translate="label title"><label>Shop</label><url>/</url><title>Shop</title><prepare/><urlParams/><position>1</position></action>
</
block>

Thanks! But i don’t get the text “Home” (I use “Home” instead of “Shop”, but have the same problem when using “Shop") to be translated. I have a multi store using many languages, but it shows “Home” on the link in all the store views. I have searched a lot, and have not been able to get the “Home” text to use the translation from the different language packs. Please help!

PS: I am using Version 1.1.6.

When you set up your multiple store views you would need separate customer.xml file for each. Then replace word “home” with the translated version yourself. Go to admin->configuration->(choose your store view)->design and tell magento to use this for that store view.

Is that what you are looking for?

 
Magento Community Magento Community
Magento Community
Magento Community
 
korpz
Jr. Member
 
Total Posts:  1
Joined:  2009-01-23
 

Awesome! helped alot thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
sei
Member
 
Total Posts:  35
Joined:  2008-08-13
 
Juan R - 27 November 2008 03:14 AM

2Koncepts - 09 November 2008 10:42 AM
I did notice one problem using the above method. When a user clicks on the “Contact Us” link first and then on the “Why Tungsten Carbide?” link it goes the the incorrect page. To fix this I hard coded the “YOUR-PAGE” link to include the whole URL like this: “http://ringcartel.com/store/index.php/tungsten-carbide” instead of this “tungsten-carbide”

I’m not sure if there is a better way… I assume it has something to do with the “url handler” so any suggestions would be great.

Use <prepare>true</prepare>

<action method="addLink" translate="label title” module="customer"><label>Customer Service</label><url>customer-service</url><title>Customer Service</title><prepare>true</prepare><urlParams/><position>1000</position></action>

This worked! But the position stopped working after this… Just in case somebody gets here I got it to work by removing <urlParams/> from the code.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Discovery
Enthusiast
 
Total Posts:  767
Joined:  2007-12-29
 

You might like this.

I needed a toplink to the legacy site. I put the link in with:

<action method="addLink" translate="label title” module="customer"><label>CRM Site</label><url>B2B2</url><title>CRM Site</title><prepare>true</prepare><urlParams/><position>90</position></action>

I then went under URL re-write and added in a rule for B2B2
I set this to 301 and entered the off-site URL.

The redirect now works.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 3