How to add a custom link to the top navigation in Magento

By default, Magento's top navigation contains links to your product categories. But what if you want to add a custom link there? In this article we will show you how to add a custom link to the top navigation in Magento.

The file that contains the code for the top navigation is called top.phtml and its location may vary depending on your template. For the default Magento template the full path to the file is:

app/design/frontend/base/default/template/catalog/navigation/top.phtml

You can edit the file by downloading it with your favorite FTP client, opening it with a text editor (e.g. Notepad), making the changes and then uploading it back to your Magento directory.

Another way to edit the file would be to connect to your account via SSH and open it with vim or nano. The customers have free SSH access to their accounts and can edit the file directly on the server.

A third way of editing the file would be to use some of the tools your control panel provides. The customers can edit the file using the File Manager in their control panel.

Once you open the file, scroll down to its bottom and find this section:

<div class="nav-container">

<ul id="nav">

<?php echo $_menu ?>

</ul>

</div>

To add a link that will appear in the top navigation, you need to add the following line inside the <ul> tags:

<li><a href="http://somedomain.com"><span>Your Link</span></a></li>

Let's say that you want to create a link called Web Hosting that will open the site http://www.yourserver.com. The above section in the top.phtml file should look like this:

 

<div class="nav-container">

<ul id="nav">

<?php echo $_menu ?>

<li><a href="http://www.yourserver.com"><span>Web Hosting</span></a></li>

</ul>

</div>

 

Flush the Magento cache and reload your front page to see the new link in your Magento top navigation.

 
  • 0 brukere syntes dette svaret var til hjelp
Var dette svaret til hjelp?

Relaterte artikler

How to add and edit admin users and user roles in Magento

In addition to the admin account that's created while installing your Magento you can add more...

How to add and edit CMS static blocks in Magento

To add and edit static blocks, log in to the admin panel of your store and go to CMS...

Magento Security Tips

E-commerce Site VulnerabilitiesMost e-commerce platforms and payment gateways possess the same...

Magento Version

You may want to know wich version of Magento that you are running.  An easy way to do it is from...

How to add and manage currencies in Magento

In Magento you can allow customers to view the prices of the products in your shop in different...