Beispiel #1
0
 /**
  * Specify category filter for product collection
  *
  * @param   Mage_Catalog_Model_Category $category
  * @return  Enterprise_Search_Model_Resource_Collection
  */
 public function addCategoryFilter(Mage_Catalog_Model_Category $category)
 {
     $this->addFqFilter(array('category_ids' => $category->getId()));
     parent::addCategoryFilter($category);
     return $this;
 }
Beispiel #2
0
 /**
  * Apply filter by category id
  *
  * @param Mage_Catalog_Model_Resource_Product_Collection $collection
  */
 protected function _applyCategoryFilter(Mage_Catalog_Model_Resource_Product_Collection $collection)
 {
     $categoryId = $this->getRequest()->getParam('category_id');
     if ($categoryId) {
         $category = $this->_getCategoryById($categoryId);
         if (!$category->getId()) {
             $this->_critical('Category not found.', Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
         }
         $collection->addCategoryFilter($category);
     }
 }
Beispiel #3
0
 /**
  * Specify category filter for product collection
  *
  * @param   Mage_Catalog_Model_Category $category
  * @return  Celebros_Conversionpro_Model_Resource_Collection
  */
 public function addCategoryFilter(Mage_Catalog_Model_Category $category)
 {
     //@todo get the engine from this class's getEngine().
     $engine = Mage::getResourceSingleton('conversionpro/fulltext_engine');
     $helper = Mage::helper('conversionpro');
     $answer_id = $helper->getAnswerIdByCategoryId($category->getId());
     if (isset($answer_id)) {
         $this->addFqFilter(array('category' => $answer_id));
     }
     parent::addCategoryFilter($category);
     return $this;
 }