コード例 #1
0
 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;
 }
コード例 #2
0
 /**
  * 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');
 }