Leftnav 在我的 Magento 网站的所有页面上都处于活动状态。但我想将它隐藏在特定的类别/类别中。
这是我的代码:
$cat = Mage::getModel('catalog/category')->load(3);
$subcats = $cat->getChildren();
foreach(explode(',',$subcats) as $subCatid)
{
$_category = Mage::getModel('catalog/category')->load($subCatid);
if($_category->getIsActive())
{
$sub_cat = Mage::getModel('catalog/category')->load($_category->getId());
$sub_subcats = $sub_cat->getChildren();
foreach(explode(',',$sub_subcats) as $sub_subCatid)
{
$_sub_category = Mage::getModel('catalog/category')->load($sub_subCatid);
if($_sub_category->getIsActive()) {
echo '<li class="sub_cat"><a href="'.$_sub_category->getURL().'" title="View products for "'.$_sub_category->getName().'" category">'.$_sub_category->getName().'</a></li>';
}
}
}
}
?>
提前致谢。