0
我正在一个侧栏的Magento的显示子类别如何设置活动类到php生成的链接?
echo '<div id="sidenavcat">';
$object = new Mage_Catalog_Block_Navigation();
$actualCategoryId = $object->getCurrentCategory()->getId();
$actualCategory = Mage::getModel('catalog/category')->load($actualCategoryId);
$subCategories = explode(',', $actualCategory->getChildren());
foreach ($subCategories as $subCategoryId)
{
$category = Mage::getModel('catalog/category')->load($subCategoryId);
if ($category->getIsActive())
{
echo '<li><a href="'.$category->getURL().'" style="text-decoration: none" class="active">'.$category->getName().'</a> </li>';
}
}
echo '</div>';
我怎么会去加入活性类的各路段上?
getIsActive()会查看该类别是否处于活动状态。您的解决方案将只显示不活动的类别。 –