I'm having issues with my coding, I'm trying to show my category's sub-categories thumbnails on the category page in all categoies.
The problem is that it's showing the same sub-category on different categories instead of just showing it into only its parent category.
CMS Block:
{{block type="core/template" template="subcategories.phtml" }}
.PHTML File:
<div class="clearfix title-container product-slider-container"></div>
<?php
$category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
$categories = $category->getCollection()
->addAttributeToSelect(array('name', 'thumbnail'))
->addAttributeToFilter('is_active', 1)
->addIdFilter($category->getChildren())
?>
<?php foreach ($categories as $category): ?>
<a href="<?php echo $category->getUrl() ?>"><img src="<?php echo Mage::getBaseUrl('media') . 'catalog' . DS . 'category' . DS . $category->getThumbnail() ?>"/></a>
<?php endforeach; ?>
This his my website where I have it set up, navigate to one of the categories in the Header menu.