Thursday 11 July 2013

To show root category's subcategories with thumbnail image in Magento


<div class="product_boxx">
<div id="list_x">
<div class="new_pro">
<ul>
<?php

$children = Mage::getModel('catalog/category')->getCategories(2);
$i=1;
foreach ($children as $category):
$category=Mage::getModel('catalog/category')->load($category->getId());
?>


<li>
<div class="new_promain">
<div class="pro_img"> <a href="<?php echo $category->getUrl() ?>"> <img src="<?php echo Mage::getBaseUrl('media').'catalog/category/'.$category->getThumbnail()  ?>" width="100" height="100" /> </a></div>

<div class="pro_detail">
<p><?php echo $category->getName() ?> </p>
</div>


</div>
</li>


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

1 comment:

  1. Hello
    I like your blog,

    Your Solutions are very important to me.

    So please
    Tell me where i have to write this code?

    Now i have a project with magento go
    do you have any idea of customization of magento go?

    Regards
    Ramesh

    ReplyDelete