首页 文章

在类别页面中没有子类别时显示父类别的子类别

提问于
浏览
0

在magento中,当我们点击一个类别时,它会将我们带到类别页面并在左侧的分层导航中显示所点击类别的子类别(如果存在) . 但是当我们点击没有子类别的类别时,它在该类别页面上显示为空左侧分层导航 . 我想要的是显示父类的子类别,如果当前类别没有子类别 . 为此我做了以下但不适合我 .

我试图添加以下内容

应用程序/代码/核心/法师/目录/型号/层/过滤/ Category.php

if(count($categoty->getChildrenCategories())){
    $categories = $categoty->getChildrenCategories();
}else{
    $categories = $categoty->getParentCategory()->getChildrenCategories();
}

并删除第#163行

$categories = $categoty->getChildrenCategories();

请建议我一个解决方案 . 任何帮助将不胜感激 .

1 回答

  • 0

    我找到了解决方案 . 我必须将上面的登录信息放在left.phtml中

    app/design/frontend/theme/template/catalog/navigation/left.phtml
    
    
     $categoty = Mage::registry('current_category');
        $categories = $category->getChildrenCategories();
        //$_categories = $this->getCurrentChildCategories();
    
         if(count($categoty->getChildrenCategories())){
            $_categories = $categoty->getChildrenCategories();
         }else{
             $_categories = $categoty->getParentCategory()->getChildrenCategories();
         }
    

    它就像一个魅力!希望它会帮助别人!

相关问题