Magento - Filter Categories by Visibility

How can I get only the categories visible in the external interface (Enable in the navigation menu → set to "Yes"). I have the following function to get the names and URLs of categories.

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.

+4
source share
1 answer

I think you need:

 $category->getIncludeInMenu(); 
+6
source

Source: https://habr.com/ru/post/1384270/


All Articles