예제 #1
0
 /**
  * Remove hidden items from a product or category collection
  *
  * @param Mage_Eav_Model_Entity_Collection_Abstract|Mage_Core_Model_Mysql4_Collection_Abstract $collection
  */
 public function _removeHiddenCollectionItems($collection)
 {
     // Loop through each category or product
     foreach ($collection as $key => $item) {
         $catData = Mage::getModel("catalog/category")->load($item->getEntityId());
         // If it is a category
         if ($item->getEntityTypeId() == 3 && $item->getLevel() != 2) {
             if (strtolower($catData->getUrlKey()) != 'get-the-look' && strtolower($catData->getUrlKey()) != 'new-arrivals') {
                 if ($this->getProductCountCustom($catData) <= 0) {
                     $collection->removeItemByKey($key);
                 }
             }
         }
     }
 }