Magento – How to show a Category Image on the Product Page

catalogimageproduct

I've built a new Page-Template in Magento. On this template I will show the Category-Image and after that, the product grid (as standard). How can I get the Category-Image for my Template?

From my Template:

<div class="col-main grid4-3 grid-col2-main in-col2">
    <?php echo $this->getChildHtml('global_messages') ?>
    <div class="worlds-image"">Category Image</div>
    <?php echo $this->getChildHtml('content') ?>
</div>

Best Answer

If you want to get the thumbnail image of the current category that you are browsing, then use the following code:

<?php $categoryImage = Mage::getModel('catalog/layer')->getCurrentCategory()->getThumbnail(); //Get the file name of the Image stored for the category ?>

<img src="<?php echo Mage::getBaseUrl('media').'catalog/category/'.$categoryImage  ?>" />
Related Topic