Magento:显示子子类在相同的顺序在管理后端树结构


Magento : showing sub sub categories in same order as in admin backend tree structure

我使用Magento 1.7.2,并从当前类别显示子类别和子子类别的列表。我的问题是,子子类不尊重相同的顺序在管理后端树结构。看起来它们是按照id排序的,从小id到大id。我需要他们显示,因为他们在管理后端订购。下面是我当前的代码:

<?php 
$currCat = Mage::registry('current_category');
$parentname = $currCat->getName();
$collection = Mage::getModel('catalog/category')->getCategories($currCat->getEntityId());
$subcats = $currCat->getChildren();
$_helper = $this->helper('catalog/output');
echo '<h2 class="titleCat"><strong>'.$parentname.'</strong></h2>';
?>
<?php 
$currCat = Mage::registry('current_category');
$parentname = $currCat->getName();
$collection = Mage::getModel('catalog/category')->getCategories($currCat->getEntityId());
$subcats = $currCat->getChildren();
$_helper = $this->helper('catalog/output');
echo '<h2 class="titleCat"><strong>'.$parentname.'</strong></h2>';
?>
<!-- We list sub sub categories -->
<div class="colLeftNav">
<ul class="colLeftSubCats">
<?php
foreach(explode(',',$subcats) as $subCatid)
{
$_category = Mage::getModel('catalog/category')->load($subCatid);
if($_category->getIsActive()) {
$sub_cat = Mage::getModel('catalog/category')->load($_category->getId());
$sub_subcats = $sub_cat->getChildren();
echo '<div class="subMainCat"><a href="'.$_category->getURL().'" title="Show products "'.$_category->getName().'" category">'.$_category->getName().'</a></div>';
foreach(explode(',',$sub_subcats) as $sub_subCatid)
{
$_sub_category = Mage::getModel('catalog/category')->load($sub_subCatid);
if($_sub_category->getIsActive()) {
echo '<li class="subCat"><a href="'.$_sub_category->getURL().'" title="show products "'.$_sub_category->getName().'" category">'.$_sub_category->getName().'</a></li>';
}
}
}
}
?>
</ul>
</div>

我几乎被困在这里,不知道如何解决这个问题。任何帮助都将非常感激……!

像这样?

$cat_id = 10;
$category = Mage::getModel('catalog/category')->load($cat_id);
$collection = Mage::getModel('catalog/category')->getCategories($cat_id, 0, true, true);
foreach ($collection as $cat) {
    echo $cat->getId().' '.$cat->getPosition().' '.$cat->getName().'<br/>';
}