So I want this code to display the categories children and their children on my view.phtml page in app/frontend/default/default/catalog/category/
So when you see the category page you see ALL of the children from all the sub categories
Here is what I got, it is showing sub categories, but not their children.
<?php
$_category = $this->getCurrentCategory();
$collection = Mage::getModel('catalog/category')->getCategories($_category- >entity_id);
$helper = Mage::helper('catalog/category');
?>
<ul>
<?foreach ($collection as $cat):?>
<?php if($_category->getIsActive()):?>
<?php
$cur_category = Mage::getModel('catalog/category')->load($cat->getId());
$_img = $cur_category->getImageUrl();
?>
<li>
<a href="<?php echo $helper->getCategoryUrl($cat);?>">
<img src="<?php echo $_img?>" title="$cat->getName()"/>
<cite><?php echo $cat->getName();?></cite>
</a>
</li>
<?php endif?>
<?php endforeach;?>
Please try to use following code.
Main idea is get main level category. For each category get children categories.
Added later:
If apply fix for your code is look like following:
If you need more level (more sub-dir) rewrite this construction using recursive function.