How can I get only categories that are visible in frontend (Include in Navigation Menu -> set to yes). I’ve the following function to get the category names and urls.
function getCatLinks($id){
$_model = Mage::getModel('catalog/category');
$cats = $_model->load($id)->getChildren();
$catIds = explode(',',$cats);
$categories = array();
foreach($catIds as $catId) {
$category = $_model->load($catId);
if( $category->getIsActive() ) {
$categories[$category->getName()] = $category->getUrl();
}
}
ksort($categories, SORT_STRING);
return $categories;
}
Any help would be appreciated.
I guess you need: