Magento - 显示二级父母的类别?

时间:2012-05-23 10:05:19

标签: magento navigation sidebar

我有以下类别结构..

Defualt
    - Cat a
        - child a
        - child b
        - child c
        - child d
    - Cat b
        - child a
        - child b
        - child c

当您查看类别A或其任何子类别时,我想在左侧类别侧边栏中显示类别A中的所有类别,无论深度如何,只要您所在的页面包含在A类

同样的规则适用于B类。当您查看B类,它的子类别或子类别中的任何产品时,我希望B类中的子类别在任何深度的左侧边栏中显示。< / p>

我该怎么做?

1 个答案:

答案 0 :(得分:0)

这是模板:catalog / navigation / category_nav.phtml

<div class="block-category-nav">

  <div class="block-content">
    <ol>

    <?php //echo $this->renderCategoriesMenuHtml() // 1. Full categories tree ?>

    <?php // 2. Current category tree
    foreach ($this->getStoreCategories() as $_category){
        if($this->isCategoryActive($_category)) // ...only from active node
            echo $this->drawItem($_category,-1);
    }?>

    <?php /*/ 3. Current subcategories 
    foreach ($this->getCurrentChildCategories() as $_category){
        echo $this->drawOpenCategoryItem($_category);
    }*/?>

    </ol>
  </div>

</div>