Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 2 of 15
Vertical category menu
 
ad2joe
Member
 
Avatar
Total Posts:  60
Joined:  2007-08-31
 

Hello,

We can help, but we’d need more details, and maybe a screenshot of your home page.

Thanks, Joe.

 
Magento Community Magento Community
Magento Community
Magento Community
 
andrewmaier
Jr. Member
 
Avatar
Total Posts:  22
Joined:  2008-01-13
 

It’s up at http://magento.vertigocore.com (on a mediatemple gridserver).

Presently, my catalog.xml has:

<reference name="left.menu">
<block type="catalog/navigation" name="catalog.leftnavig" before="-" template="catalog/navigation/left_menu.phtml"/>
</reference>

my page.xml

<block type="core/text_list" name="left" as="left"/>
<block type="core/text_list" name="left.menu" as="leftMenu"/>

my 3columns.phtml

<!-- [start] left -->
<div class="column span-4">
<?=$this->getChildHtml('leftMenu')?>
<?=$this->getChildHtml('left')?>
</div>
<!-- [end] left -->

my templates/catalog/left_menu.phtml:

<?php
$_main_categories=$this->getStoreCategories(10);
if($_main_categories->count()):
?>

<div id="allCategories" class="blueShade">
<h3><span><?=$this->__('My categories')?></span></h3>
<div class="border-creator">
<div class="narrow-by">
<dl id="narrow-by-list">
<?foreach ($_main_categories as $_main_category):?>
<dt><a href="<?=$this->getCategoryUrl($_main_category)?>"<?if ($this->isCategoryActive($_main_category)):?> class="active"<?endif?>><?=$_main_category->getName()?></a></dt>
<dd>
<ol>
<? $_sub_categories=$this->_getChildCategories($_main_category, 10); ?>
<?foreach ($_sub_categories as $_sub_category):?>
<li>
  -><a href="<?=$this->getCategoryUrl($_sub_category)?>"<?if ($this->isCategoryActive($_sub_category)):?> class="active"<?endif?>><?=$_sub_category->getName()?></a></li>
<?endforeach?>
</ol>
</dd>
<?endforeach?>
</dl>
<script type="text/javascript\">decorateDataList(’narrow-by-list’)</script>
</div>
</div>
</div>
<?endif;?>

Sorry, I just don’t get it. I think everything checks out.

-A

 
Magento Community Magento Community
Magento Community
Magento Community
 
andrewmaier
Jr. Member
 
Avatar
Total Posts:  22
Joined:  2008-01-13
 

Got this working by activating categories! Sorry for the trouble.

 
Magento Community Magento Community
Magento Community
Magento Community
 
homeboy
Jr. Member
 
Total Posts:  3
Joined:  2008-02-24
 

Hi guys,

I was able to follow the above steps in the latest version and was able to have the Left navigation on the HOME PAGE. I utilized the left.phtml file provided with the installation. The only problem I am having is that that the left navigation shows up on the Product pages as well. so now I have two Category navigations.

this is what I did:

1.  LAYOUT/CATELOG.XML

<reference name="left.menu">
            <
block type="catalog/navigation" name="catalog.leftnav" template="catalog/navigation/homeleft.phtml"/>
        </
reference>

2.  LAYOUT/PAGE.XML

<block type="core/text_list" name="left.menu" as="leftMenu"/>

3.  TEMPALTE/PAGE/3COLUMNS.PHTML

<?=$this->getChildHtml('leftMenu')?>

I just want this to add a Left Navigation on the home page. Not on the Product/Catalog page...etc. I also noted that there is already a reference on the catalog.xml page for left nav BUT WHERE DO I define refernces for the home page?? is there an xml page, just lake catelog.xml that I can defiene things that I want to be on the home page??

See the attach screen on the effect of this.

Image Attachments
pppppppppppppz.JPG
 
Magento Community Magento Community
Magento Community
Magento Community
 
xian
Jr. Member
 
Total Posts:  6
Joined:  2008-02-13
 
Joe - 21 January 2008 03:39 PM

Hello,

I also created a variation of the vertical category menu display, that will show a list of main categories, with a subcategories for only the active one, and without empty main categories:

If you want to put this on the Home page too, you need to check if you have an active category, otherwise you’ll get a Cannot retrieve current category object message.

Put the code

<? if(Mage::registry('current_category')): ?>
before the line
<? if($_main_category->getName()===$res->getCurrentCategory()->name

And after the line

</dd>
put one extra
<? endif; ?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
adityak
Member
 
Total Posts:  63
Joined:  2008-02-10
India
 

Im using Joe’s code to create a vertical menu.
How can I rearrange the order in which the categories and sub-categories appear?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Bill007
Sr. Member
 
Avatar
Total Posts:  179
Joined:  2008-01-15
New Zealand
 

Actually you do it thru the back admin

GO Catalog>>Manage Categories

GO CHOOSE STORE its English for me

then just drag the category to the position you want it to assume
on your Stores Nav bar its all in AJAX

great little feature that is

Have fun

http://www.freeblog.co.nz

 
Magento Community Magento Community
Magento Community
Magento Community
 
JoshBelke
Member
 
Total Posts:  64
Joined:  2008-02-12
NY, NY
 

Thank you Joe for the code reference that does work beautifully.
I am trying to go 1 step further and have a combination of your two examples.
First I am splitting out the categories into their own visual groups.
Next, I am listing the subcategories in Joe’s example 1 open spread (minus the homepage category using the method in example two),
What i want to do is then list the products under each category on the left with the expansion//collapse capability from (joes) example two.
This is expanding, however the Product example shows under all child categories, not just the one selected.

<?php
$_main_categories
=$this->getStoreCategories(10);
$res=new Mage_Catalog_Model_Layer();
if(
$_main_categories->count()):
?>
<?foreach 
($_main_categories as $_main_category):
                 
$_sub_categories=$this->_getChildCategories($_main_category10); 
                    if(
$_sub_categories->count()): ?>
<div class="box layered-nav">
    <
div class="head"><h3><?=$this->__('My categories')?></h3><dt class="title" 
    
<? if ($this->isCategoryActive($_main_category)):?> class="active"<?endif?>><?=$_main_category->getName()?></dt>
                        </
div>
    <
div class="border-creator">
        <
div class="narrow-by">
            <
dl id="narrow-by-list">
                
                <
dt><a href="<?=$this->getCategoryUrl($_main_category)?>"<?if ($this->isCategoryActive($_main_category)):?> class="active"<?endif?>Show All <?=$_main_category->getName()?></a></dt>
                  <
dd>
                    <
ol>
                        
<? $_sub_categories=$this->_getChildCategories($_main_category10); ?>
                        <?foreach 
($_sub_categories as $_sub_category):?>
                            
<li>
                                &
nbsp;&nbsp;-><a href="<?=$this->getCategoryUrl($_sub_category)?>"
                                
<? if ($this->isCategoryActive($_sub_category)):?> class="active"<?endif?>><?=$_sub_category->getName()?></a></li>
                                
                                 
<? if(Mage::registry('current_category')): ?>
                        <? 
if($_main_category->getName()===$res->getCurrentCategory()->name || $_main_category->entity_id===$res->getCurrentCategory()->parent_id): ?>
                               
&nbsp;&nbsp;&nbsp;&nbsp;&nbspEx:Product  
                                <?endif
;?> 
                <?endif
;?>          
                        <?endforeach?>
                    
</ol>
                </
dd>
              </
dl>
              <
script type="text/javascript">decorateDataList('narrow-by-list')</script>
        
</div>
    </
div>
</
div>
<?endif;?> 
<?endforeach?>
<?endif
;?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
emagine
Member
 
Total Posts:  36
Joined:  2007-12-10
 

Lovely bit of code there! How would I adjust this to show my third level categories? For example:

Main Category
- Secondary cat
- Third level 1
- Third level 2
- Secondary cat 2
Main Category 2
Main Category 3

Ideally, once you click into the main category, it will show both the other mains, and all of the seconday categories. Once you click a secondary category, third level ones show for that click, leaving the secondaries and the main categories in place.

This make sense?

 
Magento Community Magento Community
Magento Community
Magento Community
 
JoshBelke
Member
 
Total Posts:  64
Joined:  2008-02-12
NY, NY
 

Finished it, its in the showcase area.

but I am doing it a bit differently.

Home (main category 1) <-- Invisibleallows items to be displayed on home page.
----------------------------

Assemblies (main category 2) <-- Invisible nothing in it
----------------------------

Modules (main category 3) <-- First visible with populated Subcategories

Show All Modules

       1.   Jungle gym 
SUS Ï†8 <-- Child Category 1 (always displayed)
                   
aSubcat 1  <-- Child Category 1.a
                   b
Subcat 2  <-- Child Category 1.b
                   c
Subcat 3  <-- Child Category 1.c  (displayed when Parent is chosen)
                          
igroup product a -> associated products in parts below <--Child Category 1.c.(displayed when Parent selected)
                          
igroup product b
                          i
group product c
                          i
group product d
                          i
group product e
       2.   Jungle gym 
SUS Ï†12
       3.   Jungle gym 
SUS Ï†20
       4.   Lets joint 
Profile20X10
       5.   Lets joint 
Profile25X25
       6.   Lets joint 
Profile50X25
       7.   Shared module 
SUS Profile

----------------------------

Parts (main category 4) <-- Second visible with subcategories below

Show All Parts

       1.   Quick Mount Chuck Attachment
       2.   Basic Frame
       3.   Mini Cylinder
       4.   Mini Cylinder Accessory
       5.   Container Cylinder
       6.   
Function Chuck
       7.   Suction Pad
       8.   Special Suction Pad
       9.   Suction Stem
      10.   Sliding Chuck
      11.   Vacuum Unit
      12.   Mini Air Nipper
      13.   Air Nipper
      14.   Accessories 
for Air
      15.   Product Confirmation Sensor
      16.   Deionizer Unit

Everything displays like above @ http://www.eins1.us

Thank you in advance,
~josh
-----------------------------------

NOTE* “_getChildCategories” now breaks since .8.17240 upgrade.

 
Magento Community Magento Community
Magento Community
Magento Community
 
AkyRhO2
Jr. Member
 
Total Posts:  6
Joined:  2008-03-12
Belgium
 

Hi,

I tried to implement the code above to print my categorie list, but i got this error :

Fatal errorCall to a member function count() on a non-object in /home/XXX/www/nolitech.be/app/design/frontend/default/nolitech/template/catalog/navigation/list.phtml on line 3

Sorry for this stupid question but i’m just discovering Magento wink

If anyone could help…

 
Magento Community Magento Community
Magento Community
Magento Community
 
ad2joe
Member
 
Avatar
Total Posts:  60
Joined:  2007-08-31
 

Hello AkyRhO2,

The code I shared in here only applies to magento v0.7.x, and not for latest ones.
I’m waiting for the production release to make an update, and I will share it.

Thanks, Joe.

 
Magento Community Magento Community
Magento Community
Magento Community
 
AkyRhO2
Jr. Member
 
Total Posts:  6
Joined:  2008-03-12
Belgium
 

Thank you Joe… I’ll find another way to do it wink

 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 
YoavKutner - 11 November 2007 10:06 PM

We should add more Magento design packages early next year.

Thanks

yoav

Hi, Yoav, is this going to be released soon?

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
shd-media
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2008-03-15
 

Hello,

i tried to put joes Menu to my Magento 1.0 Version, but I always get an Redirect-error. There must be an error in this code-block from left_menu.phtml:

<? $_sub_categories=$this->_getChildCategories($_main_category10); ?>
                        <?foreach 
($_sub_categories as $_sub_category):?>
                            
<li>
                                &
nbsp;&nbsp;-><a href="<?=$this->getCategoryUrl($_sub_category)?>"<?if ($this->isCategoryActive($_sub_category)):?> class="active"<?endif?>><?=$_sub_category->getName()?></a></li>
                        
<?endforeach?>

If I delete this block, the top catgeories are shown. But if I enter one catgeorei, I only see the subcategories under this one main_categorie. so it seems like this donesn`t work in Magento 1.0. Has anybody the same problem or fixed it for Magento 1.0?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 15