How to add a link to the main menu in Magento?

Hello!

How do I add a link in the main menu of my Magento store? All the links in the main menu are created from the categories and I’d like to add a link to a simple page.

Thank you in advance!

16 answers

Profile photo of Malin Tisell 0.00 $tone November 14, 2011
Public

Hello Tom!

Thanks a lot for that. I’ve been following the video but can’t get it to work. Not sure if I’m writing the correct code at the correct place. Could you kindly give me the code that should be written in the top.phtml file?

Kind regards,
jungfrun

#2
Profile photo of tomc 0.00 $tone November 14, 2011
Public

You will need to locate and open “app/design/frontend/default/<yourtheme>/template/catalog/navigation/top.phtml” file.
Once opened, scroll down and you will see something that sort of look like this:

Code:

<ul id="nav">	<li><a href="<?php echo $this->getUrl('')?>"><span>        <?php echo $this->__('Homepage') ?></span></a></li>        <?php foreach ($this->getStoreCategories() as $_category): ?>        <?php echo $this->drawItem($_category) ?>        <?php endforeach ?></ul>

As you can see the Homepage link is an additional link I have added as an example. Now I will show you what it will look like to add a new additional link after the categorie links are shown:

Code:

<ul id="nav">	<li><a href="<?php echo $this->getUrl('')?>"><span>        <?php echo $this->__('Homepage') ?></span></a></li>        <?php foreach ($this->getStoreCategories() as $_category): ?>        <?php echo $this->drawItem($_category) ?>        <?php endforeach ?>        <li><a href="http://yourdomain.com/"><span>        <?php echo $this->__('New Link Here') ?></span></a></li></ul>

This way you can now change “http://yourdomain.com” to destination you would like to choose aswell as ‘New Link Here’ to the name of the link you would like to use.

#3
Profile photo of Daniel Löf 0.00 $tone November 15, 2011
Public

I tried this and it almost works. But I get a Parse error: syntax error, unexpected ‘}’ in //public_html/dev_bshop_temp/app/design/frontend/default/jm_fashira/template/catalog/navigation/top.phtml on line 187

I tried inserting the code snippet where it should be. Please see screenshot attached.

Attachment 17276

#4
Profile photo of Malin Tisell 0.00 $tone November 16, 2011
Public

Thank you for all your help Tom!
I got it to work with the link solution you presented in post no 4.
But now I have an other question. If I want to translate the menu, what do I do then? The solution you’re presenting above no. 6 would make it possible to translate but I can’t get it to work that way…

Thank you!
Best regards,
jungfrun

#6
Profile photo of tomc 0.00 $tone November 17, 2011
Public

You may need to quickly change some text in your Magento store. You don’t want to edit your .csv files and waste time trying to find the correct text line in those files. Now you’ll see what could be done…

1. Enter your Magento admin panel
2. Then go to “System”
3. Select “Cache Management”
4. Disable cache for “Translations”
5. Then go to the “System > Configuration > Developer” page
6. Expand the “Translate Inline” tab and enable it
7. Save the changes

Now you can see that some text blocks are in red boxes so that you can edit them. You can change text in the admin panel and at the front end.

NOTE: the change won’t affect .csv files; it’ll be saved in your database.

#7
Profile photo of Malin Tisell 0.00 $tone November 17, 2011
Public

Wonderful, thanks Tom!
Strangely, I translated one menu item and it worked fine. Then I added one more item and translated, but then the first translated item wouldn’t translate… Tried removing the second item but still the same… Really strange, so now I have one item that will not translate. Have you ever had that problem?
Also, do you know how to translate the "Home" button, and the text at the top "Welcome to Store!"?

Many thanks Tom!

#8
Profile photo of tomc 0.00 $tone November 17, 2011
Public

In the admin, try the inline translation tool under System > Configuration > (left sidebar dropdown) Website > (left sidebar, bottom) >Developer.

Turn on Inline Translation for Frontend.

In the first bar you can even designate what IP address will see the translation tool active on the frontend (absolutely necessary for live site). Then go to your website, hover over the text you wish to change, and click on the little book that shows up.

Fill in the appropriate fields, save, and refresh page.

#11
Profile photo of tomc 0.00 $tone November 24, 2011
Public

Try this . . . .

1. Enter your Magento admin panel
2. Then go to “System”
3. Select “Cache Management”
4. Disable cache for “Translations”
5. Then go to the “System > Configuration > Developer” page
6. Expand the “Translate Inline” tab and enable it
7. Save the changesNow you can see that some text blocks are in red boxes so that you can edit them.
You can change text in the admin panel and at the front end.

NOTE: the change won’t affect .csv files; it’ll be saved in your database.

#15

This question is now closed

Written By

Comments