Exemplo n.º 1
0
 /**
  * Before collection load
  *
  * @return Mage_XmlConnect_Model_Mysql4_Category_Collection
  */
 protected function _beforeLoad()
 {
     $this->addNameToResult();
     $this->addAttributeToSelect('thumbnail');
     $this->addIsActiveFilter();
     return parent::_beforeLoad();
 }
Exemplo n.º 2
0
 /**
  * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection $collection
  * @return RicoNeitzel_VertNav_Block_Navigation
  * @deprecated Now the count is added directly in _getCategoryChildren()
  * @see        _getCategoryChildren()
  */
 protected function _addProductCount($collection)
 {
     if ($collection instanceof Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection) {
         if ($collection->isLoaded()) {
             $collection->loadProductCount($collection->getItems());
         } else {
             $collection->setLoadProductCount(true);
         }
     } else {
         $this->_getProductCollectionResource()->addCountToCategories($collection);
     }
     return $this;
 }
 /**
  * Limit catalog categories collection
  *
  * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection $collection
  */
 public function limitCatalogCategories($collection)
 {
     $collection->addPathsFilter($this->_role->getAllowedRootCategories());
 }
Exemplo n.º 4
0
 /**
  * Add index to category collection
  *
  * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection|Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Flat_Collection $collection
  * @param int $customerGroupId
  * @param int $websiteId
  * @return Enterprise_CatalogPermissions_Model_Mysql4_Permission_Index
  */
 public function addIndexToCategoryCollection($collection, $customerGroupId, $websiteId)
 {
     if ($collection instanceof Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Flat_Collection) {
         $tableAlias = 'main_table';
     } else {
         $tableAlias = 'e';
     }
     $collection->getSelect()->joinLeft(array('permission_index' => $this->getTable('permission_index')), 'permission_index.category_id = ' . $tableAlias . '.entity_id AND
          permission_index.website_id = ' . (int) $websiteId . ' AND
          permission_index.customer_group_id = ' . (int) $customerGroupId, array());
     if (!Mage::helper('enterprise_catalogpermissions')->isAllowedCategoryView()) {
         $collection->getSelect()->where('permission_index.grant_catalog_category_view = ' . Enterprise_CatalogPermissions_Model_Permission::PERMISSION_ALLOW);
     } else {
         $collection->getSelect()->where('permission_index.grant_catalog_category_view != ' . Enterprise_CatalogPermissions_Model_Permission::PERMISSION_DENY . '
                          OR permission_index.grant_catalog_category_view IS NULL');
     }
     return $this;
 }