Magento - 按能见度过滤类别

时间:2011-12-02 08:17:20

标签: magento filter visibility categories

如何才能获得前端可见的类别(包含在导航菜单中 - >设置为是)。我有以下函数来获取类别名称和URL。

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;
}

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:6)

我想你需要:

$category->getIncludeInMenu();