if
(
$category
->hasChildren()) {
//判断是否有子目录
$ids
=
$category
->getChildren();
//提取子目录id清单
$subCategories
= Mage::getModel(
'catalog/category'
)->getCollection();
$subCategories
->getSelect()->where(
"e.entity_id in ($ids)"
);
//提取指定目录ids的上当清单
$subCategories
->addAttributeToSelect(
'name'
);
//指定查找目录名称
$subCategories
->load();
foreach
(
$subCategories
AS
$item
) {
echo
" - "
;
echo
'<a href="'
.
$item
->getUrl() .
'">'
;
//获取目录链接
echo
$item
->getName();
//获取目录名
echo
"</a>("
;
echo
$item
->getProductCount();
//获取目录下的产品数量
//echo $item->getChildrenCount(); //获取目录下子目录数量
echo
")"
;
echo
"<br/>"
;
}
}