Php 从magento中的类别集合中排除类别id
我正在尝试获取通过magento的管理端添加的所有子类别。从获取的类别中,我想排除一个类别id。下面提供了我用于获取所有子类别的代码Php 从magento中的类别集合中排除类别id,php,magento,Php,Magento,我正在尝试获取通过magento的管理端添加的所有子类别。从获取的类别中,我想排除一个类别id。下面提供了我用于获取所有子类别的代码 <?php $allCategories = Mage::getModel('catalog/category') ->getCollection() ->addAttributeToSelect('*')
<?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();
?>
如果您有任何疑问,请告诉我
谢谢