问题
Is there any way of checking if one specific category is active? I have a hard coded navigation and I want to show or hide a link depending on the active status of a specific category. Perhaps something like this:
// Check to see if the Sale category is active...
$specificCatID = '90';
if(isCategoryActive($specificCatID)){
// Specific category is active, do something
}
I have searched high and low, and have yet to get close to being able to solve this. Any help, much appreciated.
回答1:
I hope this will answer your question :)
$specificCatID = '90';
$category = Mage::getModel('catalog/category')->load($specificCatID);
if ($category->getIsActive()) {
}
来源:https://stackoverflow.com/questions/18274379/magento-check-if-specific-category-is-active