我试图通过magento的管理端获取添加的所有子类别。从获取的类别中,我想排除一个类别id。下面提供的是我用来获取所有子类别
的代码<?php
$allCategories = Mage::getModel('catalog/category')
->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('level',2)
->addIsActiveFilter();
?>
请让我知道是否排除类别id 69并显示所有其他级别2的类别。
请尝试下面的代码,
<?php
$allCategories = Mage::getModel('catalog/category')
->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('level',2)
->addAttributeToFilter('entity_id', array('nin' => 69))
->addIsActiveFilter();
?>
如果您有任何疑问请告诉我
谢谢