0
我有代码输出在magento中的类别的ID,但希望这些结果按字母顺序输出。任何人都可以提出建议Magento输出类别和子类别按字母顺序
<?php
$parentCategoryId = 201;
$cat = Mage::getModel('catalog/category')->load($parentCategoryId);
$subcats = $cat->getChildren();
// Get 1 Level sub category of Parent category
foreach(explode(',',$subcats) as $subCatid)
{
$_category = Mage::getModel('catalog/category')->load($subCatid);
if($_category->getIsActive()) {
echo '<li><a href="'.$_category->getURL().'" title="View the products for the "'.$_category->getName().'" category">'.$_category->getName().'</a>';
echo '</li>';
}
}
?>