Esempio n. 1
0
 /**
  * Check if event can be matched by process
  * Overwrote for check is flat catalog product is enabled and specific save
  * attribute, store, store_group
  *
  * @param Mage_Index_Model_Event $event
  * @return bool
  */
 public function matchEvent(Mage_Index_Model_Event $event)
 {
     /** @var $productFlatHelper Mage_Catalog_Helper_Product_Flat */
     $productFlatHelper = $event->getFlatHelper() ?: Mage::helper('Mage_Catalog_Helper_Product_Flat');
     if (!$productFlatHelper->isAvailable() || !$productFlatHelper->isBuilt()) {
         return false;
     }
     $data = $event->getNewData();
     if (isset($data[self::EVENT_MATCH_RESULT_KEY])) {
         return $data[self::EVENT_MATCH_RESULT_KEY];
     }
     $entity = $event->getEntity();
     switch ($entity) {
         case Mage_Catalog_Model_Resource_Eav_Attribute::ENTITY:
             $result = $this->_matchAttributeEvent($event, $productFlatHelper);
             break;
         case Mage_Core_Model_Store::ENTITY:
             $result = $this->_matchStoreEvent($event);
             break;
         case Mage_Core_Model_Store_Group::ENTITY:
             $result = $this->_matchStoreGroupEvent($event);
             break;
         default:
             $result = parent::matchEvent($event);
             break;
     }
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);
     return $result;
 }