<?php
$_category = $this->getCurrentCategory();
$collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id);
$helper = Mage::helper('catalog/category');
?>
<ul>
<?foreach ($collection as $cat):?>
<?php if($_category->getIsActive()):?>
<?php
$cur_category = Mage::getModel('catalog/category')->load($cat->getId());
$_img = $cur_category->getImageUrl();
?>
<li>
<a href="<?php echo $helper->getCategoryUrl($cat);?>">
<img src="<?php echo $_img?>" title="$cat->getName()"/>
<cite><?php echo $cat->getName();?></cite>
</a>
</li>
<?php endif?>
<?php endforeach;?>
</ul>
Friday, July 29, 2011
Show subcategory in a category page
If you're comfortable editing your theme, this code snippet will bring you a list of all sub-categories of the current category (from the session, so this should work anywhere in your theme). I typically use this in app/design/frontend/default/*theme_name*/template/catalog/category/view.phtml
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment