I am trying to display my subcategories images on my home page with the following code:
<?php
/**
* http://fishpig.co.uk - Magento Tutorials
* Display top level categories and subcategories
**/
$_helper = $this->helper('catalog/output');
$_category = $this->getCurrentCategory();
?>
<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<?php $currentCategory = Mage::registry('current_category') ?>
<?php if (count($_categories) > 0): ?>
<?php foreach($_categories as $_category): ?>
<div style="float: left; padding-right: 18px; ">
<?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ?>
<?php $_subcategories = $_category->getChildrenCategories() ?>
<?php if (count($_subcategories) > 0): ?>
<?php foreach($_subcategories as $_subcategory): ?>
<a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
<img src="<?php echo $_category->getImageUrl() ?>" width="200" height="200" />
</a>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
But the image shows the parent category instead, can be seen in www.colagenosnella.com.br. Any Thoughts? Thanks in advance.