Tag Archives: magento display category image on Home Page

magento display category image

<?php 
    $parentCategoryId = 204; // Category Id

    $cat = Mage::getModel('catalog/category')->load($parentCategoryId);
    $subcats = $cat->getChildren();

    foreach (explode(',', $subcats) as $subCatid) {
        $_category = Mage::getModel('catalog/category')->load($subCatid);

        if ($_category->getIsActive()) {         
        if($_category->getThumbnail()):
 ?>
    <a href="<?php echo $_category->getURL(); ?>" title="<?php echo $_category->getName(); ?>">
    <img src="<?php echo Mage::getBaseUrl('media').'catalog/category/'. $_category->getThumbnail(); ?>" alt=""  />
    </a>
<?php endif; ?> 

<?php } 
 } 
?>