Example #1
0
 /**
  * Enter description here ...
  *
  * @param Varien_Object $object      Object to reindex
  * @param null|int      $storeId     Store id for reindex
  * @param array         $categoryIds Category Ids to reindex
  */
 public function rebuildIndex($object, $storeId = null, $categoryIds = null)
 {
     $rules = $this->_getRulesByCategoryIds($categoryIds, $storeId);
     foreach ($rules as $categoryId => $rule) {
         $ruleArray = @unserialize($rule);
         $ids = array();
         if (is_array($ruleArray) && count($ruleArray) > 1) {
             $object->setData('conditions', $ruleArray);
             $object->loadPost(array('conditions' => $ruleArray));
             $ids = $object->getMatchingProductIds();
         }
         $this->_saveCategories($ids, $categoryId);
     }
 }