Tuesday, 27 August 2013

To show a perticular root category's sub categories with thumbnail images in magento


<div class="product">

<?php
$children = Mage::getModel('catalog/category')->getCategories(3);
$j=1;
?>

<ul>

<?php
foreach ($children as $category):
$category=Mage::getModel('catalog/category')->load($category->getId());
?>
<li>
<div class="new_product">
<div class="pro_detail">
<p><?php echo $category->getName() ?> </p>
</div>
<div class="pro_img"> <a href="<?php echo $category->getUrl() ?>"> <img src="<?php echo Mage::getBaseUrl('media').'catalog/category/'.$category->getThumbnail()  ?>" width="54" height="66" /> </a>
</div>



</div>
</li>
<?php if($j%4=='0') {?>
</ul>
<ul>
<?php } $j++;  endforeach;  ?>
</ul>


</ul>
</div>

No comments:

Post a Comment