如何按级别显示类别?

问题描述

| 我想在列表页面上显示当前类别的子类别(如果有),但是如果没有子类别并且当前类别不是主要类别,则显示相同级别的类别。
<?php
        //print_r($_category); exit;

        $Curr_cat_id = $_category->getEntityId();

        $children = Mage::getModel(\'catalog/category\')->getCategories($Curr_cat_id);

        if($children){

            foreach($children as $sub_cat)
            {
               $subCat = Mage::getModel(\'catalog/category\')->load($sub_cat->getId());

               ?>

                <a href=\"<?php echo $this->getUrl().$sub_cat->getRequestPath(); ?>\" >
                    <?php echo $sub_cat->getName(); ?>
                </a><br />

             <?php

            } // end of foreach

        } // end of if

        //else{

          // this is where i want the same level categories if in case there are no sub-categories and also the current category is not a main category.

        //}

    ?>
    

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)