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

Displaying other categories when the current category is the bottom of the tree
 
simonyoung
Member
 
Total Posts:  34
Joined:  2007-08-31
 

Hi

How is it possible to display the other categories at the same level when you are at the bottom of the category tree?  i.e. show all of the categories at this level?

In 1.1.6 the category list just doesn’t show when you get to a list of products with no more subcategories - this is a classic place where people may wish to navigate back up the tree.

Current code for left.phtml is as follows - as you can see there is a hole where the list of categories should be at the bottom level.  Can anybody help?

<?php $_categories=$this->getCurrentChildCategories() ?>

<?php 
if($_categories->count()): ?>
<div class="block block-layered-nav">
    <
div class="block-title">
        <
h3><?php echo $this->__('Browse By'?></h3>
    </
div>
    <
div class="block-content">
        <
dl>
            <
dt><?php echo $this->__('Category'?></dt>
            <
dd>
                <
ol>
                
<?php foreach ($_categories as $_category): ?>
                    <?php 
if($_category->getIsActive()): ?>
                    
<li>
                        <
a href="<?php echo $this->getCategoryUrl($_category) ?>"<?php if ($this->isCategoryActive($_category)): ?> class="current"<?php endif; ?>><?php echo $this->htmlEscape($_category->getName()) ?></a> (<?php echo $_category->getProductCount() ?>)
                    </
li>
                    
<?php endif; ?>
                <?php 
endforeach ?>
                
</ol>
            </
dd>
        </
dl>
    </
div>
</
div>
<? else: ?> 

<div class="block block-layered-nav">
    <
div class="block-title">
        <
h3><?php echo $this->__('Browse By'?></h3>
    </
div>
    <
div class="block-content">
        <
dl>
            <
dt><?php echo $this->__('Category'?></dt>
            <
dd>
            
                <
ol>
                    
need to retrieve parent categories
                
</ol>
            
            </
dd>
        </
dl>
    </
div>
</
div>

<? endif; ?>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top