如果类别处于活动状态,但“包含在导航菜单中”设置为“否”,我如何获取所有类别和子类别?
我尝试使用这个:
<?php
$_categories = Mage::getBlockSingleton('catalog/navigation');
foreach ($_categories->getStoreCategories() as $_category) {
$category = Mage::getModel('catalog/category');
$category->load($_category->getId());
$subcategories = explode(',', $category->getChildren());
?>
<dl>
<dt><?php echo $this->htmlEscape($_category->getName()); ?></dt>
<dd>
<ol>
<?php
foreach ($subcategories as $subcategoryId) {
$category->load($subcategoryId);
echo '<li><a href="' . $category->getURL() . '">' . $category->getName() . '</a></li>';
}
?>
</ol>
</dd>
</dl>
<?php
}
?>
但是如果一个类别的“包括在导航菜单中”是“否”,它就不会显示在首页上!