cancel
Showing results for 
Search instead for 
Did you mean: 

Subcategories not showing up under categories

Subcategories not showing up under categories

Hello all, 

 

I am wanting to have my subcategories appear under the main column of each category they are part of, I found a how to with code and followed it step by step (see code below). When I set the category to static block only with the CMS Block put on the correct one all I get is a blank area under the page title, I've even set the CMS Block to other static blocks and it shows up with no problems. Has anyone had a problem with this before?

 

Thanks,

Josh

 

Static Block

{{block type="catalog/navigation" template="catalog/navigation/subcategory_listing.phtml"}}

 

subcategory_listing.phtml 

<div class="category-products">
<ul class="products-grid">
<?php
$_categories=$this->getCurrentChildCategories();
if($_categories->count()):
$categorycount = 0;
foreach ($_categories as $_category):
if($_category->getIsActive()):
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
$catName = $this->getCurrentCategory()->getName();
if ($categorycount == 0){
$class = "first";
}
elseif ($categorycount == 3){
$class = "last";
}
else{
$class = "";
}
?>
<li class="item <?=$class?>">
<a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>"><img src="<?php echo $_category->getImageUrl() ?>" width="100" alt="<?php echo $this->htmlEscape($_category->getName()) ?>" /></a>
<h2><a href="<?php echo $_category->getURL() ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>"><?php echo $this->htmlEscape($_category->getName()) ?></a></h2>
</li>
<?php
endif;
if($categorycount == 3){
$categorycount = 0;
echo "</ul>\n\n<ul class=\"products-grid\">";
}
else{
$categorycount++;
}
endforeach;
endif;
?>
</ul>
</div>