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

Need your help on the vertical category menu
 
Lies
Member
 
Total Posts:  58
Joined:  2008-05-07
 

This code allow to have a vertical category menu. I would like to change small thing on it. At the moment the feature is made in this way:

Main category A
Main category B

when you click on one of the main category then it display the subcategory. What I want is to display Main category and below it the subcategory. Now subcategory are hidden until you click on the main category to open them.

I really need some help on this please! Thanks!

?>
<div class="vertical-nav-container box base-mini">
    <
div id="vertical-nav">
        <
div class="head">
            <
h4><?php echo $this->__('Categories'?></h4>
        </
div>
        <
ul id="nav_vert">
            
<?php foreach ($this->getStoreCategories() as $_category): ?>
            <?php $open 
$this->isCategoryActive($_category); ?>
            <?php $potential 
$_category->hasChildren(); ?>
            
<li><a href="<?php echo $this->getCategoryUrl($_category); ?>"<?php if($openecho ' class="open"'} ?><?php if($potentialecho ' class="potential"'} ?> ><?php if($potential&&$openecho ' 'elseif($potentialecho ' '}else{ echo '  '}?><?php echo $_category->getName();?></a>
                
<?php if ($open && $potential): ?>
                
<ul>
                    
<?php foreach ($_category->getChildren() as $subcategory): ?>
                    <?php $subCat 
Mage::getModel('catalog/category')->load($subcategory); ?>
                    <?php $open 
$this->isCategoryActive($subCat); ?>
                    <?php $potential 
$subCat->hasChildren(); ?>
                    
<li><a href="<?php echo $this->getCategoryUrl($subCat); ?>"<?php if($openecho ' class="subopen"'} ?><?php if($potentialecho ' class="potential"'} ?><?php if(!$potential&&$openecho ' class="final"'} ?> ><?php if($potential&&$openecho ''elseif($potentialecho '> '}?><?php echo $subCat->getName(); ?></a>
                        
<?php if ($open && $potential): ?>
                        
<ul>
                            
<?php foreach ($subcategory->getChildren() as $subsubcategory): ?>
                            <?php $subsubCat 
Mage::getModel('catalog/category')->load($subsubcategory); ?>
                            <?php $open 
$this->isCategoryActive($subsubCat?>
                            
<li><a href="<?php echo $this->getCategoryUrl($subsubCat); ?>" <?php if($openecho ' class="final"'} ?>><?php echo $subsubCat->getName(); ?></a></li>
                            
<?php endforeach; ?>
                        
</ul>
                        
<?php endif; ?>
                    
</li>
                    
<?php endforeach; ?>
                
</ul>
                
<?php endif; ?>
            
</li>
            
<?php endforeach ?>
        
</ul>
    </
div>
</
div>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Ben Marks
Guru
 
Avatar
Total Posts:  452
Joined:  2008-10-09
Charleston, SC
 

Take a look @ http://www.magentocommerce.com/extension/763/vertical-navigation-with-css-classes

 
Magento Community Magento Community
Magento Community
Magento Community
 
Lies
Member
 
Total Posts:  58
Joined:  2008-05-07
 

thanks for you answer bluebin, the vertical menu extension you provided me looks its the as what I have.  As you can see you have to click on the main category in order to show the subcategory, I want to display the subcategory without clicking on the main category. I want them to be visible by default just like this :

Main category A
Subcategory 1
Subcategory 2

Then when you click on subcategory1, I want it to open the the third level.(subsub-category1)

do you have any idea ? I need to tweak the code above to make it work.

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ben Marks
Guru
 
Avatar
Total Posts:  452
Joined:  2008-10-09
Charleston, SC
 

Try this one

 
Magento Community Magento Community
Magento Community
Magento Community
 
Lies
Member
 
Total Posts:  58
Joined:  2008-05-07
 

I know already this but its not what I’m looking for, I have already the menu that I want, I just want someone help me to customize the code displayed in my first post.

Thanks for your help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brandlive_br
Guru
 
Avatar
Total Posts:  653
Joined:  2008-05-19
Buenos Aires, Argentina
 

Try this:

Look for where it says ‘<?php if($open) { echo ' class="open"'; } ?>’ and change it with this: ‘<?php echo ' class="open"'; ?>’

If that doesn’t work try to post a link to your website so I can have a look at the css.

--
Ezequiel

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top