Create a Left hand Navigation in Magento 1.4 1.4x for Modern theme
This is an updated set of instructions from the previous post for 1.3x. A few things have changed with 1.4x which rendered the original information obsolete. These instruction will allow you to create a left hand vertical navigation as seen here . For more info see credits / references at the end. These instructions work with the Modern theme. You will have to adjust for other themes.
Step 1
Create a new file called vert_nav.phtml in app / design / frontend / YOUR DESIGN / YOURTemplate / template / catalog / navigation
add the following to vert_nav.phtml
<div class="vertical-nav-container box base-mini">
<div class="vertical-nav">
<!--<div class="head">-->
<!--<h4>-->
<div class="block block-cart">
<div class="block-title">
<strong><span><?php echo $this->__('Categories') ?></span></strong>
</div><!--End block block-cart-->
<div class="block-content">
<!--</h4>-->
<!--</div>--><!--End Of head-->
<h4 class="no-display">
<?php echo $this->__('Category Navigation:') ?></h4>
<ul id="nav_vert">
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php echo $this->drawItem($_category) ?>
<?php endforeach ?> </ul>
</div>
</div><!--End Of vertical-nav-->
<?php echo $this->getChildHtml('topLeftLinks') ?>
</div><!--End Of vertical-nav-container box base-mini-->
Step 2
In app / design / frontend / YOUR DESIGN / YOURTemplate / layout / catalog.xml
<!--
Category default layout
-->
<catalog_category_default translate="label">
<label>Catalog Category (Non-Anchor)</label>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
<reference name="left">
<!-- <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>-->
<block type="catalog/navigation" before="-" name="catalog.vertnav" template="catalog/navigation/vert_nav.phtml"/>
NOTE: you are simply commenting out line 10 and adding line 11
Step 3
In in skin/frontend/YOURDESIGN/YOURtemplate/css/widgets.css
#nav { float:left; margin-top:15px; margin-left:15px; font-size:1.1em; }
/************** ALL LEVELS *************/ /* Style consistent throughout all nav levels */
#nav li { position:relative;text-transform:uppercase; text-align:left; }
#nav li.over { z-index:999; }
#nav a,
#nav a:hover { display:block; line-height:1.3em; text-decoration:none; }
#nav span { display:block; cursor:pointer; white-space:nowrap; }
#nav li ul span {white-space:normal; }
/************ 0 LEVEL ***************/
#nav li { float:left; margin:1px 8px 11px 1px; padding:3px 8px; }
#nav li.active a { color:#444; }
#nav a { float:left; background:url(../images/nav_top_level_arrow.gif) no-repeat 100% 50%; padding-right:11px; color:#444; font-weight:bold; }
#nav li.over a,
#nav a:hover { color:#444; }
#nav li.over,
#nav li.active { margin:0 7px 10px 0; border:1px solid #bbb; background:#ececec; }
/************ 1ST LEVEL ************/
#nav ul li,
#nav ul li.active,
#nav ul li.over { float:none; border:none; background:none; margin:0; padding:0; padding-bottom:1px; text-transform:none; }
#nav ul li.parent { background:url(../images/nav_parent_arrow.gif) no-repeat 100% 50%; }
#nav ul li.last { padding-bottom:0; }
#nav ul li.active { margin:0; border:0; background:none; }
#nav ul a,
#nav ul a:hover { float:none; padding:0; background:none; }
#nav ul li a { font-weight:normal !important; }
/************ 2ND LEVEL ************/
#nav ul { position:absolute; width:15em; top:22px; left:-10000px; border:1px solid #bbb; border-bottom:2px solid #999; padding:3px 8px; background:#fcfcfc; font-size:11px; }
/* Show menu */
#nav li.over > ul { left:-1px; }
#nav li.over > ul li.over > ul { left:100px; }
#nav li.over ul ul { left:-10000px; }
#nav ul li a { padding:3px 0; color:#444 !important; }
#nav ul li a:hover { padding:3px 0; color:#5a7f00 !important; }
/************ 3RD+ LEVEL ************/
#nav ul ul { top:5px; }
/**********************************************Vertical Nav ****************************************/
#nav_vert { padding:0 8px; font-size:1em; z-index:999; width:180px; background-color: #F6F6F6; }
/************** ALL LEVELS *************/ /* Style consistent throughout all nav levels */
#nav_vert li {
width:200px;
list-style:none;
position:relative;
text-align:left;
background-color: #F6F6F6;
border-bottom-width: thin;
border-bottom-style: solid;
border-bottom-color: #CCCCCC;
}
#nav_vert li.over { z-index:999; }
#nav_vert li.active { z-index:999; } /* to prevent the li separator from showing through on mouseover on li */
#nav_vert a { line-height:1.3em; }
#nav_vert a, #nav_vert a:hover { display:block; text-decoration:none; }
#nav_vert span { display:block; cursor:pointer; color: #000; }
/************ 1ST LEVEL ***************/
#nav_vert li { float:left; background:url(../images/nav_bg.gif) repeat-x 50%; height:30px; margin-right:1px; }
#nav_vert li.active a { color:#4c6a16; }
#nav_vert a {
float:left;
padding:5px 12px 6px 8px;
color:#4c6a16;
font-weight:bold;
font-family:Trebuchet MS;
font-size:13px;}
#nav_vert li.over a, #nav_vert a:hover { color:#CCCCCC; }
/************ 1ST LEVEL RESET ************/
#nav_vert ul li, #nav_vert ul li.active {
float:none;
height:auto;
background:none;
margin:0;
}
#nav_vert ul a, #nav_vert ul a:hover {
float:none;
padding:0;
background:none;
}
#nav_vert ul li a { font-weight:normal !important; }
/************ 2ND LEVEL ***********/
#nav_vert ul {
position: absolute;
width:200px;
margin-left:180px;
top:0px;
left:-10000px;
border:1px solid #666666;
}
/* Show menu */
#nav_vert li.over ul { left:0; }
#nav_vert li.over ul ul { left:-10000px; }
#nav_vert li.over ul li.over ul { left:100px; }
#nav_vert ul li a { background:#FFFFFF/*#ecf3f6*/; }
#nav_vert ul li a:hover { background: #F2F1D2; /*#d5e4eb;*/ }
#nav_vert ul li a span { background:url(../images/nav_divider.gif) repeat-x 0 100%; }
#nav_vert ul li a, #nav_vert ul li a:hover { color:#2f2f2f !important; }
#nav_vert ul span, #nav_vert ul li.last li span { padding:6px 15px 6px 15px; }
#nav_vert ul li.last span { background:none; }
/************ 3RD+ LEVEL ************/
#nav_vert ul ul { top:5px;}
#nav_vert ul ul ul { left:-10000px;}
#nav_vert li.over ul li.over ul ul { left:-10000px;}
#nav_vert li.over ul li.over ul li.over ul { left:100px; }
/* Fix for the IE bug */
#nav_vert iframe {
position: absolute;
left: -1px;
top: 0;
z-index: -1;
filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);
}
Step 4
copy top.phtml from the base/defualt/template/catalog/navigation to your custom template folder ie app/design/frontend/YOURDESIGN/YOURDESIGN/template/catolog/navigation/top.phtml replace top.phtml
Edit your copy of top.phtml so it look like this
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE_AFL.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category design * @package base_default * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> <?php /** * Top menu for store * * @see Mage_Catalog_Block_Navigation */ ?>
In other words delete all the active code.
Step 5
Add the category block to your home page.
lo on to the back end
CMS >> Pages >> Home Page >> design
in the Design Box paste this code
<reference name="left">
<!-- <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>-->
<block type="catalog/navigation" before="-" name="catalog.vertnav" template="catalog/navigation/vert_nav.phtml"/>
</reference>
If you are getting errors about toggleMenu or if the menu appears but the pop out sub-categories do not work you are probably seeing the results of magento dropping support for toggleMenu.
as a quick and dirty fix you can paste:
function toggleMenu(el, over)
{
if (over) {
Element.addClassName(el, 'over');
}
else {
Element.removeClassName(el, 'over');
}
}
in at the start of js/varien/menu.js
Note this is not upgrade proof..
References / credits:
The original post can be found here where one Peter Hamilton provided most of the clever work at a time when people were just starting to come to terms with Magento.
From this post I extracted the complete solutions and created the original wiki entry here this has now been updated by Bill007 to 1.4 compatable and a lot of this post is based on his alterations.
Details how to create an upgrade proof installation by Joshua Barrie full details of which can be read here
Having problems? We can install this for you for a small fee.. contact us for details
Rock solid speed and reliability
Robust, reliable, fully backed up, secure UK based Magento hosting for £175 per year. Full details here or Contact us
- Share this:
- StumbleUpon
Related posts:
- Create a left hand navigation / vertical category in Magento
- Create a left hand navigation / vertical category in Magento
- Magento: Move Related Products to centre column in Modern theme
- Remove side_logo_promo.gif from header in modern theme for Magento
- magento modern theme : HMTL code in the price of the additional product information
This entry was posted by admin on August 6, 2010 at 6:17 pm, and is filed under Magento. Follow any responses to this post through RSS 2.0.You can leave a response or trackback from your own site.
-
Magento 1.4.1.1
Ubuntu 10.0.4 PC Box
http://www.gtv9.com.au
Modern themeIt works fine on 1.4.1.1, but there were a few glitches …
1. An extra tag is required at the end of the code for vert_nav.phtml (extra line 22 needed), probably cropped when the original code was pasted in.
2. On my site vert_nav.phtml is now located at app/design/frontend/base/default/template/catalog/navigation/vert_nav.phtml (It did not work in the default/modern/template/catalog/ path?)
3. I pasted the css code into skin/frontend/default/modern/css/styles.css as it was easier to work on, having it in just one file.
3. It renders okay with Firefox/Ubuntu, Safari/OSX and Windows/IE8 but not with Windows/IE7 or IE6.If you visit my web site please give me a “Like” on the Facebook application, I need 10 “Likes” to progress my application to the next level .. thanks.
If you need copies of my css code just ask.
-
Magento 1.4.1.1
Ubuntu 10.0.4 PC Box
http://www.gtv9.com.au
Modern themeJust a few more points from my previous post…
1. The missing tag is a “closing div” (the Comments text ignores html code).
2. You will need to set admin/catalog/category “Is Anchor” to “No” otherwise it will not display the Vertical Nav Bar in the left hand column for that Category. -
@cypress @giorgos
the mechanism that powers the subcategories is togglemenu javascript function. Varien dropped this with 1.4. Check your browser for javascript errors. If you are getting errors complaining about the lack of togglemenu then you need to follow the final instructions in step 5.
empty cache
-
I am hoping that someone can help me here , the instructions works great , i followed everything and everything is as planned . i have one simple question , how can i make the same left menu appear on the top menu as well , my top menu disappered after configring this but i want the menu to get displayed on both places , any help is greatly appreciate it . Thanks
-
Hello! Most of this verticle menu works flawlessly for me. However, two things are not.
Many are posting that the verticle nav is showing up on the index page but no other pages. A previous poster said that you must set the link of those categories you wish the verticle nav to appear on to “Set as Anchor: No”. Upon inspecting the code I see “Catalog Category (Non-Anchor)” So it’s specifically set to this. But why? When I change the category pages to “Anchor: No” then the products associated with that category do not show up.
So, is there a way that we don’t have to change the category pages to “Anchor: No”?
Second, you may not have control over this issue but you may be able to help. When I go into my FTP and try and edit the menu.js file, it does not open up therefore I am having difficulties editing the javascript to allow the menu to toggle.
Thank you for this article and for all the help and support you have given to us magento users.
-
Hi Dana,
This is very strange. anchor / no anchor should not have any effect. I will go through this on a clean install and see if I can recreate the problem.. have you got a url I can take a look at? email me a link using the contact form if you can.
Regarding your ftp prob.. download the file.. edit then re upload.
If you cant upload it you have a permission problem somewhere.
Thanks for stopping by. -
I have implemented the code here:
http://bellabiondinella.com/shop/I should probably mention that I have no idea what vesion of magento I am using – or how to find that information (the installation was done directly from the hosting site)
Also when I uploaded vert_nav.phtml to the default/modern folder, I went to app/design/frontend/default/modern/template/catalog/ and created a new folder called navigation where I placed the file. I also tried uploading vert_nav.phtml to app/design/frontend/base/default/template/catalog/navigation but still no luck. There is another vertical navigation tutorial out there that actually works on all pages but the format doesn’t look really nice. Oh well, I will keep trying.
-
I have implemented the code here:
http://bellabiondinella.com/shop/I should probably mention that I have no idea what vesion of magento I am using – or how to find that information (the installation was done directly from the hosting site)
Also when I uploaded vert_nav.phtml to the default/modern folder, I went to app/design/frontend/default/modern/template/catalog/ and created a new folder called navigation where I placed the file. I also tried uploading vert_nav.phtml to app/design/frontend/base/default/template/catalog/navigation but still no luck. There is another vertical navigation tutorial out there that actually works on all pages but the format doesn’t look really nice. Oh well, I will keep trying.
-
works on magento 1.5.0 with the added -js/varien/menu hack .
Thank You , I had menu going previously but screwed it up while working on site and could not find your site again until after trying about twenty other methods posted on magento and other sites , I almost cracked .. But now I’m Ok !
Thanks for writing in descriptive method that is easy to understand and 100 % , All other sites only tell you about 90 % of how to install without saying “In = app / design / frontend / YOUR DESIGN / YOURTemplate / layout / catalog.xml= paste code . Instead they say = in catalog.xml -paste code ??? Which catalog.xml ??? There are dozens !!Thanks again..
-
@gary Thanks for the 1.5 conformation.
@dan Yes, but there are probably better ways of doing it… Just hack the css still it works.
This tutorial makes for a great show all sub menu : http://net.tutsplus.com/tutorials/javascript-ajax/create-a-simple-intelligent-accordion-effect-using-prototype-and-scriptaculous/
If I get a chance I will write this up in plain English as the instructions assume a lot of knowledge. -
in the css section find this bit and change top:5px; and { left:100px; } till it does want you want
/************ 3RD+ LEVEL ************/
#nav_vert ul ul { top:5px;}
#nav_vert ul ul ul { left:-10000px;}
#nav_vert li.over ul li.over ul ul { left:-10000px;}
#nav_vert li.over ul li.over ul li.over ul { left:100px; }
-
-
Thanks. I will write a article on how to creat a left vertical menu for magento like my airsoft guns webstore
-
- Create a left hand / verticle menu in magento | Dx3webs | UK Magento e-commerce hosting
- Probleme mit dem Modern Theme – rack::SPEED Support-Forum
- Notes on Magento benchmarking..
- Magetno fix : Cant add products to admin create order
- Magento fix : Invalid method Mage_Wishlist_Model_Item::canConfigure(Array
- Create a multi-store setup in Magento
- Magento fix: Fatal error: Method Varien_Object::__tostring() cannot take arguments in /magento/lib/Varien/Object.php
- Magento fix : Local file doesn’t exist
- Magento tip: after upgrade prices on product page simple product are gone……
- Add attribute to Grid or List view
- Magento tip : add Google Checkout button to side bar shopping cart
- Magento Tip: Add simple product url to grouped product items

This didn’t work for me (the menu is not showing up in the left sidebar on my homepage – or any other) – I’m using Magento 1.4.0.1
If I comment/delete everything in top.phtml I’m left without any menu whatsoever and if I leave it as is, the top navigation menu gets stylized by widgets.css
I’m using the f002 theme (Magento Classic)