Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add Static Links to Top Navigation Menu in Magento

Tags:

php

magento

In my Magento install, I have a dropdown menu that is generated from a Products category in my ‘Categories’. It uses the code: <?php echo $this->getChildHtml('topMenu') ?> to display the menu.

However, at certain intervals, I’d like to add a static HTML link (list item with hyperlink) in to the menu.

How do I achieve this?

Many thanks for any pointers

like image 459
michaelmcgurk Avatar asked Apr 11 '12 17:04

michaelmcgurk


2 Answers

In the current version of Magento you can do this by creating a new category then redirecting that category to any URL you want (CMS page, Product page, offsite, etc.)

  1. Create a new Subcategory. Name this how you want it to show up in the menu. Make sure it has a unique URL key, it is active, and it is "In Navigation Menu". You can change where it shows up by changing it's location in the category menu by drag-n-drop to the place you want it to show.
  2. Go into URL Rewrite Management. Your new category should be the top system link that was just created. If not, filter the table by the id number of the new category. Go into this new redirection.
  3. Change the Redirect to Permanent and copy the Target Path. You will need this for the next step. Save your changes.
  4. Create a new custom URL Redirect with the following options and save it
    • Store: The store this applies to. Must match the store of the category you are redirecting
    • ID Path: URL you want the category to go to. (i.e. gift-cards)
    • Request Path: Paste the Target Path you copied from the previous step here
    • Target Path: URL you want the category to go to. (i.e. gift-cards)
    • Redirect: Set to Permanent 301
  5. Go to Index Management and refresh your Catalog URL Rewrites (if needed)

You should now be able to go to the Frontend and see the new category in the menu. Clicking on it will redirect you straight to the link you provided. I prefer this method over others because it gives you better control over where a static link gets placed and allows you to put a staticly linked menu item within sub-menus.

This video shows this technique step-by-step for Magento Go but the process is the same for all flavors of Magento. http://www.youtube.com/watch?v=5rSIQlRC8Xk

like image 151
Greg Demetrick Avatar answered Sep 22 '22 17:09

Greg Demetrick


Here is your answer: http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/navigation/add_home_link_to_menu_bar

like image 22
Gershon Herczeg Avatar answered Sep 18 '22 17:09

Gershon Herczeg