akano1
akano1

Reputation: 41614

how to show category images in cms page in magento

I'm trying to make a brand page to show all the brand images and descriptions on one page. I have created a brand category with the ID 3, all the brands go under that category, only the brand names show but the images and descriptions don't show,

any help would be appreciated.

 <?php    
    $brands = Mage::getModel('catalog/category')->load(3)->getChildrenCategories();
?>

<?php foreach($brands as $brand): ?>
    <ul>
    <li>
        <a href="<?php echo $brand->getUrl() ?>">
             <img src="<?php echo $brand->getImageUrl() ?>" />
             <?php echo htmlspecialchars($brand->getName()) ?>         
        </a>
            <?php echo htmlspecialchars($brand->getDescription()) ?>  
    </li>
    </ul>
 <?php endforeach ?> 

Upvotes: 0

Views: 1475

Answers (1)

Dushyant Joshi
Dushyant Joshi

Reputation: 3702

<?php    
    $brands = Mage::getModel('catalog/category')->load(3)->getChildrenCategories();
?>
<?php foreach($brands as $brand): ?>
<?php
    $cat= Mage::getModel('catalog/category')->load($brand->getId());
?>
    <ul>
    <li>
        <a href="<?php echo $cat->getUrl() ?>">
             <img src="<?php echo $cat->getImageUrl() ?>" />
             <?php echo htmlspecialchars($cat->getName()) ?>         
        </a>
            <?php echo htmlspecialchars($cat->getDescription()) ?>  
    </li>
    </ul>
 <?php endforeach ?> 

Upvotes: 1

Related Questions