<?php $currentCat = Mage::registry('current_category');
if ( $currentCat->getParentId() == Mage::app()->getStore()->getRootCategoryId() )
{
$loadCategory = $currentCat;
}
else
{
$loadCategory = Mage::getModel('catalog/category')->load($currentCat->getParentId());
}
$subCategories = explode(',', $loadCategory->getChildren());
foreach ( $subCategories as $subCategoryId )
{
$cat = Mage::getModel('catalog/category')->load($subCategoryId);
if($cat->getIsActive())
{
if ($currentCat->getEntityId() == $subCategoryId)
{
echo '<b>'.$cat->getName().'</b><br />';
}
else
{
echo '<a href="'.$cat->getURL().'">'.$cat->getName().'</a> ('.$cat->getProductCount().')<br />';
}
}
}
?>
问问题
1579 次