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

How do I limit the number of categories listed on the top navigation bar
 
purechemicals
Jr. Member
 
Total Posts:  23
Joined:  2010-08-18
 

This is the one issue that I have always had with magenta. I know this the issue is template specific but surely the developers must realise that people do want control over the number of categories displayed at the top.

Anyway on my site I have about 20 top level categories that I wish to use. I wish to have these all displayed on the left hand side but only about six of our top selling categories at the top.

I have tried various codes like the one in the link below but I can’t seem to get any to work.

http://www.magentocommerce.com/boards/viewthread/79139/

Any help would be appreciated.

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
purechemicals
Jr. Member
 
Total Posts:  23
Joined:  2010-08-18
 

Here is my current top.phtml which can be found at app/design/frontend/default/luxury-home/template/meganavigation/top.phtml

<script type="text/javascript">
jQuery(function(){
        jQuery
('.megamenu li:last-child').css('background','none');
        
jQuery(".megamenu").megamenu();
  
});
</script>
<?php
$_helper    
$this->helper('catalog/output');
?>
<?php $currentCategory 
Mage::registry('current_category'?>
<div class="nav-container1">
<
div id="nav1">
<
ul class="megamenu">
      <
li><a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->__('Home') ?>"><?php echo $this->__('Home'?></a></li>
      
<?php foreach ($this->getStoreCategories() as $_category): ?>
      
<li>
      
<?php $_collectionSize $_category->getChildren()->count(); ?>
        
<a href="<?=$this->getCategoryUrl($_category);?>" <?php if( $currentCategory && $currentCategory->getId() == $_category->getId()):  ?>class="active"<?php endif; ?>><span><?=$_category->getName();?></span></a>

        
<?php if($_collectionSize != 0): ?>
        <?php 
if($_collectionSize == 1): ?>
               
<div style="width: 320px; min-height:292px;*min-height:275px;">
        
<?php elseif($_collectionSize == 2): ?>
               
<div style="width: 450px; min-height:292px;*min-height:275px;">
        
<?php else: ?>
            
<div style="width: 580px; min-height:292px;*min-height:275px;">
        
<?php endif; ?>
        
<table>
        <
tr>
            <
td class="cateList">
            
<?php $_collectionSize $_category->getChildren()->count(); ?>
            
<table>
            
<?php $i=0;  foreach ($_category->getChildren() as $child): ?>
            <?php 
if ($i++%3==0): ?>
            
<tr>
            
<?php endif; ?>
            
<td class="child<?php echo $_category->getId(); ?>">
                
<?php $childCat Mage::getModel('catalog/category')->load($child->getId()); ?>
                
<div class="cateNaviLink-head"><a href="<?=$this->getCategoryUrl($childCat);?>"><?=$childCat->getName();?></a></div>
                
<?php  foreach ($child->getChildren() as $child1): ?>
                <?php $childCat1 
Mage::getModel('catalog/category')->load($child1->getId()); ?>
                    
<div class="cateNaviLink"><a href="<?=$this->getCategoryUrl($childCat1);?>"><?=$childCat1->getName();?></a></div>
                
<?php endforeach; ?>
            
</td>
            
<?php if ($i%3==|| $i==$_collectionSize): ?>
            
</tr>
            
<?php endif; ?>
            <?php 
endforeach; ?>
            
</table>
            </
td>
        </
tr>
        <
tr>
        <
td>
        <
div class="additional-container-bottom">
        <
div class="request-brochure"><a href="<?php echo $this->getUrl('contacts')?>">Contact Us</a></div>
        <
div class ="find-show-room"> <class="find-show-room" href="<?php echo $this->getUrl('catalogsearch/advanced/')?>">Advance Search</a></div>
        </
div>
        </
td>
        </
tr>
        </
table>
        </
div>
        
<?php endif; ?>
      
</li>
      
<?php endforeach; ?>
       
<li class="mm-item"><a href="<?php echo $this->getUrl('faq')?>">Wiki</a></li>
      </
ul>
</
div>
</
div>
 
Magento Community Magento Community
Magento Community
Magento Community
 
mtimion
Jr. Member
 
Total Posts:  8
Joined:  2012-07-29
 

why not add a custom attribute to the category like “show_in_menu” and apply that filter to the collection in the block?

 
Magento Community Magento Community
Magento Community
Magento Community
 
purechemicals
Jr. Member
 
Total Posts:  23
Joined:  2010-08-18
 

Thanks for the reply, but it has already been done by changing the coding above, I just needed someone to show me which code to change.

 
Magento Community Magento Community
Magento Community
Magento Community
 
purechemicals
Jr. Member
 
Total Posts:  23
Joined:  2010-08-18
 

No ideas anyone?

Six weeks later and I still can’t find an answer anywhere :(

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