Add links to the NavMain Menu in Zen Cart


As part of the navigation in Zen Cart, the NavMain menu is in the top, left hand corner in a default installation.

image

When a customer has logged in and with one one or more products in their Shopping Cart, the NavMain menu looks like this:
Zen Cart NavMain Menu

The Home link in the NavMain menu is set to the Zen Cart store front.  There are occasions when you may wish to alter this behaviour.  For example, if your online store is in a sub directory of your main website, you might be looking to set Home to link to your main website and an additional link Store to lead to Zen Cart online store.

This is achieved by modifying the tpl_header.php file.

  1. Open the tpl_header.php file located in the /includes/templates/template_default/common/ directory.
  2. Find this section of code:
    <div id="navMain">
    <ul class="back">
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li>
  3. To change the existing Home link to read Store, update the section of code as follows:
    <div id="navMain">
    <ul class="back">
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?>Store</a></li>

    Replace Store with whatever you wish your online store link to be.

  4. To add an additional link to your main website Home, update the section of code as follows:
    <div id="navMain">
    <ul class="back">
    <li><a href="http://www.domain.com/">Home</a></li>
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?>Store</a></li>

    Replace http://www.domain.com with your main website address and replace Home with the link name you would like to use.

  5. Save the modified tpl_header.php file to your override folder. This will be /includes/templates/CUSTOM/common/ where CUSTOM represents the name of your current template folder.

Add link to NavMain

     
   
     

,

  1. #1 by Kenny Marley on 14 April, 2010 - 8:36 pm

    This is what I wanted! Perfect. Thank you very much. Now My Website and Store are linked in a more professional manner. This tip makes my site look better, no more ugly link text on my Main Page going back to the website.

    Thanks,
    Kenny M.

  2. #2 by kerrin hardy on 14 April, 2010 - 9:08 pm

    Hi Kenny

    Thanks for letting me know the tip was useful :)

    Cheers
    Kerrin

  3. #3 by Ronnie on 15 April, 2010 - 7:39 pm

    How do you add an image here ? (like a shopping cart pic)

  4. #4 by kerrin hardy on 15 April, 2010 - 10:38 pm

    Hi Ronnie

    Include your image as a list item, like:

    <div id="navMain">
    <ul class="back">
    <li><a href="http://www.domain.com/">Home</a></li>
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?>Store</a></li>
    <li><a href="index.php?main_page=shopping_cart"><img src="images/cart.gif" /></a></li>

    Don’t forget to update the name and path of the image to suit your store.

    Cheers
    Kerrin

  5. #5 by Chris on 6 July, 2010 - 8:29 am

    Where is it says Home Login Shopping Cart i would like to change Shopping Cart to read Basket

    So i got onto the forums and other site and found this tutorial but it doesn’t work:

    http://tutorials.zen-cart.com/index.php?article=260

    I went to includes/languages/english/english.php

    found this line:
    define(‘HEADER_TITLE_CART_CONTENTS’, ‘Shopping Cart’);

    and changed it to

    define(‘HEADER_TITLE_CART_CONTENTS’, ‘Basket’);

    to my surprise its not working

    Any ideas please?

  6. #6 by Glenn Herbert on 13 July, 2010 - 3:43 am

    You refer to the wrong filename (english.php) – it should be header.php, where you would find that line. Do you have a file in
    /includes/languages/english/your_template/header.php?
    If so, that would be used and /includes/languages/english/header.php would be ignored. You need to edit the template override copy of the file.

    Line #12 : define(‘HEADER_TITLE_CART_CONTENTS’, ‘Shopping Cart’);

  7. #7 by kerrin hardy on 7 August, 2010 - 3:33 pm

    @Glenn, thanks for stopping by. We really appreciate you sharing your Zen Cart expertise with us. :)

    @Chris, hope that you have been able to change your site to Basket now.

  8. #8 by Julie G on 29 September, 2011 - 1:32 pm

    Thanks so much for this very well put together “how to”! I need picture instructions on everything! :) I want to thank all the commenters who were also very helpful! You guys are all amazing!

  9. #9 by Paul on 5 November, 2011 - 9:09 am

    I cant get this to work. Link does not appear in the green header.

    I am using a imported template so I assume you adjust the common file in that template?

    v1.3.9h

  10. #10 by Evolver on 5 December, 2011 - 1:43 pm

    Hi,
    This was the easiest set of instructions that I’ve found. I was able to add an additional link to the header tab but it have made the font at least two sizes larger and now there are 2 lines in the header. The top line says home (normal-sized font) bottom line of header has the rest of the links.

    using v1.3.9

    Please advise

    Thanks!

(will not be published)

Notify me of followup comments via e-mail. You can also subscribe without commenting.