thanks .............. but ...I have below code which is working up to 1st level not for more level in category tree could someone help me for the 3rd level and more........... level of the category tree...........that means if i I will click the parent category only that particular parent open with his children all other will on closed manner like Category1 -subcategory1 ----subsubcategory1 -subcategory2
Category2 -subcategory1 -subcategory2
<?php
$obj = new Mage_Catalog_Block_Navigation();
$store_cats = $obj->getStoreCategories();
$current_cat = $obj->getCurrentCategory();
$current_cat = (is_object($current_cat) ? $current_cat->getName() : '');
foreach ($store_cats as $cat) {
if ($cat->getName() == $current_cat) {
echo '<li class="current"><a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."</a>\n<ul>\n";
foreach ($obj->getCurrentChildCategories() as $subcat) {
echo '<li><a href="'.$this->getCategoryUrl($subcat).'">'.$subcat->getName()."</a></li>\n";
}
echo "</ul>\n</li>\n";
} else {
echo '<li><a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."</a></li>\n";
}
}
?>