It is quite necessary to display the subcategories in your magento store for easy navigation purposes. Sometimes customers are so lazy to go deep in your navigation in which they can’t reach your deepest navigation.
So to display subcategories in magento, the following code is working well.
So to display subcategories in magento, the following code is working well.
You might also want these:
- Magento is not showing upsells, related products, and cross sells?
- Magento: Retrieving Category URL and Name for specific products
- Editing Magento Pages
- Updating magento order by batch
Code to display subcategory in Magento:
<?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>
1 comments:
Hi,
Do you know how to display only categories which are "include in navigation Menu" ?
Many thanks.
Post a Comment