jcadima
6/13/2017 - 9:31 PM

List all product Subcategories , Names, URL, and Images

List all product Subcategories , Names, URL, and Images


<?php

$_helper = Mage::helper('catalog/category') ;
$categoryId = 4; // this is the parent category ID
// load the categories
$category = Mage::getModel('catalog/category')->load($categoryId) ;
// get all children categories onlly
$_categories = $category->getChildrenCategories() ;

?>

<div class="main-container col2-left-layout container">
    <div class="main">
        <div class="row">
            <?php echo $this->getChildHtml('breadcrumbs') ?>
            
            <div class="col-main col-md-9">
                <?php echo $this->getChildHtml('global_messages') ?>
                <?php echo $this->getChildHtml('content') ?>


		<?php if (count($_categories) > 0): ?>
		    <div id="brands_list" class="row">
		        <?php foreach($_categories as $_category): ?>
		            <div class="col-md-4">
		                <a href="<?php echo $_helper->getCategoryUrl($_category) ?>">
			                <?php echo $_category->getName() ; ?>
			            </a>
		            							            
		                <?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ; ?>	
						<img src="<?php echo $_category->getImageUrl() ;  ?>">					                                               
		            </div>
		        <?php endforeach; ?>
		    </div>
		<?php endif; ?>
        
            </div>
            <div class="col-left sidebar col-md-3"><?php echo $this->getChildHtml('left') ?></div>
        </div>
    </div>
</div>