Martin
Martin

Reputation: 2673

Magento category image

I want to get category image:

    <?php foreach ($this->getCurrentChildCategories() as $_category): ?>        
                url: <?php echo $_category->getURL() ?>
                name: <?php echo $this->htmlEscape($_category->getName()) ?>
                img: <?php echo $_category->getThumbnail()           /// returns nothing ?>
    <?php endforeach; ?>

Upvotes: 0

Views: 1381

Answers (1)

Martin
Martin

Reputation: 2673

Just make call on category model:

Mage::getModel('catalog/category')->load($_category->getId())->getThumbnail()

so:

<?php foreach ($_categories as $_category): ?>

                    url: <?php echo $_category->getURL() ?>
                    name: <?php echo $this->htmlEscape($_category->getName()) ?>
                    img: <?php echo Mage::getModel('catalog/category')->load($_category->getId())->getThumbnail() ?>

<?php endforeach; ?>

Upvotes: 1

Related Questions