I need to display all the subcategories in the top menu navigation in my custom module.
From the below code i m getting only the categories in the menu.
public function getMenu2($_cats, &$menu, $text = '', $parent = 0){ print_r($hasChild);
$hasChild = false;
$w1 = 50; $h1 = 50;
//Begin-Home page hover menu
$_categories = $this->getCategories();
$_subcategories = $_category->getChildrenCategories();
$menu2 = '<ul '.($parent==0?'class="recipecatmneu row"':'').'>';
$store_id = (int) Mage::app()->getStore()->getStoreId();
foreach($_cats as $item)
{
$langtxt = $item->getLanguage();
$langtxt = json_decode($langtxt, true);
if($store_id && is_array($langtxt) && @$langtxt[$store_id]){
$currentData = $langtxt[$store_id];
foreach($currentData as $k => $v){
if(!in_array($k, array('id' , 'filename' , 'category_id' , 'urlwrite'))) $item->setData($k, $v);
}
}
//begin code change to disable categories in hover
if($item->getParentid() == $parent && $item->getStatus()!=2){
//end code change to disable categories in hover
$hasChild = true;
$menu .= $menu2;
$menu2 = '';
$menu .= '<li>
<a class="image_gal" title="'.$item->getTitle().'" href="'.$item->getLink().'">
<img src="'.Mage::getBaseUrl('media') . $item->getFilename().'" alt="'.$item->getTitle().'" />
</a>
<a href="'.$item->getLink().'" title="'.$item->getTitle().'">'.$text.$item->getTitle().'</a>';
//$this->getMenu2($_cats, $menu, $text, $item->getCategoryId());
//End-Home page hover menu
$menu .= '</li>';
}
}
if($parent==0 || $hasChild){
$menu .= '</ul>';
}
}
How to get the subcategories/child categories here??