public function getCategoryCollection() { $collection = parent::getCategoryCollection(); $role = Mage::getSingleton('aitpermissions/role'); if ($role->isPermissionsEnabled()) { $allowedCategoryIds = array(); foreach ($role->getAllowedCategoryIds() as $allowedCategoryId) { $category = Mage::getModel('catalog/category')->load($allowedCategoryId); $categoryPath = $category->getPath(); $categoryPathIds = explode('/', $categoryPath); $allowedCategoryIds = array_merge($allowedCategoryIds, $categoryPathIds); } if (!empty($allowedCategoryIds)) { $collection->addIdFilter($allowedCategoryIds); $this->setData('category_collection', $collection); } } return $collection; }
/** * Adds some extra params to categories collection * * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */ public function getCategoryCollection() { return parent::getCategoryCollection()->addAttributeToSelect('url_key')->addAttributeToSelect('is_anchor'); }