Code related to show category subcategory and their sub subcategory

<div class="inner-page2">
  <div class="col-main">
    <h1><img width="945" height="70"  src="<?php echo $this->getCurrentCategory()->getImageUrl(); ?>"/></h1>
    <div id="fishing-series" class="full-width comman">
      <p> <?php echo $this->getCurrentCategory()->getDescription(); ?></p>
      <?php $base_url=Mage::getUrl()?>
      <?php $this->getCurrentCategory()->getThumbnail(); ?>
      <?php
                        $_category = $this->getCurrentCategory();
                        $collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id);

                        $rootcat = $_category->entity_id;
                        $cat = Mage::getModel('catalog/category')->load($rootcat);
                        $child = $cat->getChildren();

                        $children= json_decode($child);
                        $children=explode(",", $child);

                        $cnt=count($children);
                         $helper = Mage::helper('catalog/category');
                                    $_helper = $this->helper('catalog/output');
                        ?>
      <?php
                                    $_category = $this->getCurrentCategory();
                                    $collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id);

                                    $rootcat = $_category->entity_id;
                                    $cat = Mage::getModel('catalog/category')->load($rootcat);
                                    $child = $cat->getChildren();
                                    if($child)
                                    {
                                                $helper = Mage::helper('catalog/category');
                                                $_helper = $this->helper('catalog/output');
                                    ?>
      <?
                                     $_iterator = 0;
                                       $_columnCount=3;
                                       $_collectionSize=3;
                                       $i=0;
                                     
                                    ?>
      <ul class="product-type">
        <?php      
                                                for($j=0;$j<$cnt;$j++)

                                                {
                                                ?>
        <?php $collection = Mage::getModel('catalog/category')->load($children[$j]); ?>
        <li>
          <div class="products-grid-home12"><a  href="<?php echo $helper->getCategoryUrl($collection);?>"><img  width="215" height="217" src="<?php echo Mage::getBaseUrl('media').'catalog/category/'.$collection->getThumbnail()  ?>" /></a></div>
          <div class="cont"><a  href="<?php echo $helper->getCategoryUrl($collection);?>">
            <?php  echo $collection->getName(); ?>
            </a></div>
        </li>
        <?php
                                                }
                                                ?>
      </ul>
      <?php }

                                                else
                                                { ?>
      <?php echo $this->getProductListHtml() ?>
      <?php
                                                }
                                                ?>
      <div class="clr"></div>
    </div>
  </div>
</div>

Comments