Ejemplo n.º 1
0
 /**
  * Check if event can be matched by process.
  * Overwrote for specific config save, store and store groups save matching
  *
  * @param Mage_Index_Model_Event $event
  * @return bool
  */
 public function matchEvent(Mage_Index_Model_Event $event)
 {
     $data = $event->getNewData();
     if (isset($data[self::EVENT_MATCH_RESULT_KEY])) {
         return $data[self::EVENT_MATCH_RESULT_KEY];
     }
     $entity = $event->getEntity();
     if ($entity == Mage_Core_Model_Store::ENTITY) {
         $store = $event->getDataObject();
         if ($store && ($store->isObjectNew() || $store->dataHasChangedFor('group_id'))) {
             $result = true;
         } else {
             $result = false;
         }
     } elseif ($entity == Mage_Core_Model_Store_Group::ENTITY) {
         $storeGroup = $event->getDataObject();
         $hasDataChanges = $storeGroup && ($storeGroup->dataHasChangedFor('root_category_id') || $storeGroup->dataHasChangedFor('website_id'));
         if ($storeGroup && !$storeGroup->isObjectNew() && $hasDataChanges) {
             $result = true;
         } else {
             $result = false;
         }
     } else {
         $result = parent::matchEvent($event);
     }
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);
     return $result;
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     parent::__construct();
     $this->engine = new Algolia_Algoliasearch_Model_Resource_Engine();
     $this->config = Mage::helper('algoliasearch/config');
     $this->logger = Mage::helper('algoliasearch/logger');
 }
Ejemplo n.º 3
0
 /**
  * Match Event
  * @param Mage_Index_Model_Event $event
  * @see Mage_Index_Model_Indexer_Abstract::matchEvent()
  * @return bool
  */
 public function matchEvent(Mage_Index_Model_Event $event)
 {
     $data = $event->getNewData();
     $resultKey = 'rewards_customer_points_match_result';
     if (isset($data[$resultKey])) {
         return $data[$resultKey];
     }
     $result = null;
     $entity = $event->getEntity();
     if ($entity == self::REWARDS_TRANSFER_ENTITY || $entity == self::REWARDS_CUSTOMER_ENTITY) {
         if ($event->getType() == Mage_Index_Model_Event::TYPE_DELETE) {
             $result = true;
         } else {
             if ($event->getType() == Mage_Index_Model_Event::TYPE_SAVE) {
                 /* @var $transfer TBT_Rewards_Model_Transfer */
                 $result = true;
             } else {
                 $result = false;
             }
         }
     } else {
         $result = parent::matchEvent($event);
     }
     $event->addNewData($resultKey, $result);
     return $result;
 }
Ejemplo n.º 4
0
 public function __construct()
 {
     /**
      * Add the customer groups as a matched entity in addition to category or product entity.
      */
     $this->_matchedEntities[Mage_Customer_Model_Group::ENTITY] = array(Mage_Index_Model_Event::TYPE_SAVE);
     parent::__construct();
 }
Ejemplo n.º 5
0
 protected function _construct()
 {
     //$this->_init('solrsearch/indexer_solr');
     $this->batchDirectory = Mage::getBaseDir('var') . '/solrbridge_processes/';
     if (!is_dir($this->batchDirectory)) {
         mkdir($this->batchDirectory, 0777);
     }
     return parent::_construct();
 }
Ejemplo n.º 6
0
 public function matchEvent(Mage_Index_Model_Event $event)
 {
     $data = $event->getNewData();
     if (isset($data[self::EVENT_MATCH_RESULT_KEY])) {
         return $data[self::EVENT_MATCH_RESULT_KEY];
     }
     $result = parent::matchEvent($event);
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);
     return $result;
 }
Ejemplo n.º 7
0
 public function matchEvent(Mage_Index_Model_Event $event)
 {
     $data = $event->getNewData();
     if (isset($data[self::EVENT_MATCH_RESULT_KEY])) {
         return $data[self::EVENT_MATCH_RESULT_KEY];
     }
     $entity = $event->getEntity();
     if ($entity == Mage_Core_Model_Store::ENTITY) {
         $store = $event->getDataObject();
         if ($store && $store->isObjectNew()) {
             $result = true;
         } else {
             $result = false;
         }
     } else {
         $result = parent::matchEvent($event);
     }
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);
     return $result;
 }
Ejemplo n.º 8
0
 /**
  * Check if event can be matched by process.
  * Rewrited for checking configuration settings save (like price scope).
  *
  * @param Mage_Index_Model_Event $event
  * @return bool
  */
 public function matchEvent(Mage_Index_Model_Event $event)
 {
     $data = $event->getNewData();
     if (isset($data[self::EVENT_MATCH_RESULT_KEY])) {
         return $data[self::EVENT_MATCH_RESULT_KEY];
     }
     if ($event->getEntity() == Mage_Core_Model_Config_Data::ENTITY) {
         $data = $event->getDataObject();
         if ($data && in_array($data->getPath(), $this->_relatedConfigSettings)) {
             $result = $data->isValueChanged();
         } else {
             $result = false;
         }
     } elseif ($event->getEntity() == Mage_Customer_Model_Group::ENTITY) {
         $result = $event->getDataObject() && $event->getDataObject()->isObjectNew();
     } else {
         $result = parent::matchEvent($event);
     }
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);
     return $result;
 }
Ejemplo n.º 9
0
 /**
  * Check if event can be matched by process
  * Overwrote for check is flat catalog category is enabled and specific save
  * category, store, store_group
  *
  * @param Mage_Index_Model_Event $event
  * @return bool
  */
 public function matchEvent(Mage_Index_Model_Event $event)
 {
     /** @var $categoryFlatHelper Mage_Catalog_Helper_Category_Flat */
     $categoryFlatHelper = Mage::helper('catalog/category_flat');
     if (!$categoryFlatHelper->isAccessible() || !$categoryFlatHelper->isBuilt()) {
         return false;
     }
     $data = $event->getNewData();
     if (isset($data[self::EVENT_MATCH_RESULT_KEY])) {
         return $data[self::EVENT_MATCH_RESULT_KEY];
     }
     $entity = $event->getEntity();
     if ($entity == Mage_Core_Model_Store::ENTITY) {
         if ($event->getType() == Mage_Index_Model_Event::TYPE_DELETE) {
             $result = true;
         } elseif ($event->getType() == Mage_Index_Model_Event::TYPE_SAVE) {
             /** @var $store Mage_Core_Model_Store */
             $store = $event->getDataObject();
             if ($store && ($store->isObjectNew() || $store->dataHasChangedFor('group_id') || $store->dataHasChangedFor('root_category_id'))) {
                 $result = true;
             } else {
                 $result = false;
             }
         } else {
             $result = false;
         }
     } elseif ($entity == Mage_Core_Model_Store_Group::ENTITY) {
         /** @var $storeGroup Mage_Core_Model_Store_Group */
         $storeGroup = $event->getDataObject();
         if ($storeGroup && ($storeGroup->dataHasChangedFor('website_id') || $storeGroup->dataHasChangedFor('root_category_id'))) {
             $result = true;
         } else {
             $result = false;
         }
     } else {
         $result = parent::matchEvent($event);
     }
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);
     return $result;
 }
Ejemplo n.º 10
0
 /**
  * Check if event can be matched by process.
  * Rewrited for checking configuration settings save (like price scope).
  *
  * @param Mage_Index_Model_Event $event
  * @return bool
  */
 public function matchEvent(Mage_Index_Model_Event $event)
 {
     $data = $event->getNewData();
     $resultKey = 'catalog_product_price_match_result';
     if (isset($data[$resultKey])) {
         return $data[$resultKey];
     }
     $result = null;
     if ($event->getEntity() == Mage_Core_Model_Config_Data::ENTITY) {
         $data = $event->getDataObject();
         if (in_array($data->getPath(), $this->_relatedConfigSettings)) {
             $result = $data->isValueChanged();
         } else {
             $result = false;
         }
     } elseif ($event->getEntity() == Mage_Customer_Model_Group::ENTITY) {
         $result = $event->getDataObject()->isObjectNew();
     } else {
         $result = parent::matchEvent($event);
     }
     $event->addNewData($resultKey, $result);
     return $result;
 }
Ejemplo n.º 11
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 = Mage::helper('catalog/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();
     if ($entity == Mage_Catalog_Model_Resource_Eav_Attribute::ENTITY) {
         /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
         $attribute = $event->getDataObject();
         $addFilterable = $productFlatHelper->isAddFilterableAttributes();
         $enableBefore = $attribute && ($attribute->getOrigData('backend_type') == 'static' || $addFilterable && $attribute->getOrigData('is_filterable') > 0 || $attribute->getOrigData('used_in_product_listing') == 1 || $attribute->getOrigData('is_used_for_promo_rules') == 1 || $attribute->getOrigData('used_for_sort_by') == 1);
         $enableAfter = $attribute && ($attribute->getData('backend_type') == 'static' || $addFilterable && $attribute->getData('is_filterable') > 0 || $attribute->getData('used_in_product_listing') == 1 || $attribute->getData('is_used_for_promo_rules') == 1 || $attribute->getData('used_for_sort_by') == 1);
         if ($attribute && $event->getType() == Mage_Index_Model_Event::TYPE_DELETE) {
             $result = $enableBefore;
         } elseif ($attribute && $event->getType() == Mage_Index_Model_Event::TYPE_SAVE) {
             if ($enableAfter || $enableBefore) {
                 $result = true;
             } else {
                 $result = false;
             }
         } else {
             $result = false;
         }
     } else {
         if ($entity == Mage_Core_Model_Store::ENTITY) {
             if ($event->getType() == Mage_Index_Model_Event::TYPE_DELETE) {
                 $result = true;
             } else {
                 /* @var $store Mage_Core_Model_Store */
                 $store = $event->getDataObject();
                 if ($store && $store->isObjectNew()) {
                     $result = true;
                 } else {
                     $result = false;
                 }
             }
         } else {
             if ($entity == Mage_Core_Model_Store_Group::ENTITY) {
                 /* @var $storeGroup Mage_Core_Model_Store_Group */
                 $storeGroup = $event->getDataObject();
                 if ($storeGroup && $storeGroup->dataHasChangedFor('website_id')) {
                     $result = true;
                 } else {
                     $result = false;
                 }
             } else {
                 $result = parent::matchEvent($event);
             }
         }
     }
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);
     return $result;
 }
 public function __construct()
 {
     parent::__construct();
     $this->config = Mage::helper('algoliasearch/config');
     $this->queue = Mage::getSingleton('algoliasearch/queue');
 }
 /**
  * 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)
 {
     $data = $event->getNewData();
     if (isset($data[self::EVENT_MATCH_RESULT_KEY])) {
         return $data[self::EVENT_MATCH_RESULT_KEY];
     }
     $entity = $event->getEntity();
     if ($entity == Mage_Catalog_Model_Resource_Eav_Attribute::ENTITY) {
         /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
         $attribute = $event->getDataObject();
         if (!$attribute) {
             $result = FALSE;
         } elseif ($event->getType() == Mage_Index_Model_Event::TYPE_SAVE) {
             $result = $attribute->dataHasChangedFor('is_searchable');
         } elseif ($event->getType() == Mage_Index_Model_Event::TYPE_DELETE) {
             $result = $attribute->getIsSearchable();
         } else {
             $result = FALSE;
         }
     } else {
         if ($entity == Mage_Core_Model_Store::ENTITY) {
             if ($event->getType() == Mage_Index_Model_Event::TYPE_DELETE) {
                 $result = TRUE;
             } else {
                 /* @var $store Mage_Core_Model_Store */
                 $store = $event->getDataObject();
                 if ($store && $store->isObjectNew()) {
                     $result = TRUE;
                 } else {
                     $result = FALSE;
                 }
             }
         } else {
             if ($entity == Mage_Core_Model_Store_Group::ENTITY) {
                 /* @var $storeGroup Mage_Core_Model_Store_Group */
                 $storeGroup = $event->getDataObject();
                 if ($storeGroup && $storeGroup->dataHasChangedFor('website_id')) {
                     $result = TRUE;
                 } else {
                     $result = FALSE;
                 }
             } else {
                 if ($entity == Mage_Core_Model_Config_Data::ENTITY) {
                     $data = $event->getDataObject();
                     if ($data && (in_array($data->getPath(), $this->_relatedConfigSettingsReindex) || in_array($data->getPath(), $this->_relatedConfigSettingsUpdate))) {
                         $result = $data->isValueChanged();
                     } else {
                         $result = FALSE;
                     }
                 } else {
                     $result = parent::matchEvent($event);
                 }
             }
         }
     }
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);
     return $result;
 }
Ejemplo n.º 14
0
 public function __construct()
 {
     parent::__construct();
     $this->engine = new Algolia_Algoliasearch_Model_Resource_Engine();
 }
Ejemplo n.º 15
0
 /**
  * Check if event can be matched by process.
  * Overwrote for specific config save, store and store groups save matching
  *
  * @param Mage_Index_Model_Event $event
  * @return bool
  */
 public function matchEvent(Mage_Index_Model_Event $event)
 {
     $data = $event->getNewData();
     $resultKey = 'catalog_category_product_match_result';
     if (isset($data[$resultKey])) {
         return $data[$resultKey];
     }
     $result = null;
     $entity = $event->getEntity();
     if ($entity == Mage_Core_Model_Store::ENTITY) {
         $store = $event->getDataObject();
         if ($store->isObjectNew() || $store->dataHasChangedFor('group_id')) {
             $result = true;
         } else {
             $result = false;
         }
     } elseif ($entity == Mage_Core_Model_Store_Group::ENTITY) {
         $storeGroup = $event->getDataObject();
         $hasDataChanges = $storeGroup->dataHasChangedFor('root_category_id') || $storeGroup->dataHasChangedFor('website_id');
         if (!$storeGroup->isObjectNew() && $hasDataChanges) {
             $result = true;
         } else {
             $result = false;
         }
     } else {
         $result = parent::matchEvent($event);
     }
     $event->addNewData($resultKey, $result);
     return $result;
 }
Ejemplo n.º 16
0
 /**
  * Retrieve resource instance
  *
  * @return Enterprise_TargetRule_Model_Mysql4_Index
  */
 protected function _getResource()
 {
     return parent::_getResource();
 }
Ejemplo n.º 17
0
 public function __construct()
 {
     parent::__construct();
     $this->_config = Mage::helper('nanowebg_elasticsearch/elasticsearch')->getEngineConfig();
     $this->_stores = explode(",", $this->_config['stores']);
 }
Ejemplo n.º 18
0
 public function __construct()
 {
     $this->mapping = Mage::helper('merlinsearch/mapping');
     parent::__construct();
 }
Ejemplo n.º 19
0
 protected function _construct()
 {
     $this->_init('solrsearch/indexer_thumb');
     return parent::_construct();
 }
Ejemplo n.º 20
0
 /**
  * Check if event can be matched by process.
  * Overwrote for specific config save, store and store groups save matching
  *
  * @param Mage_Index_Model_Event $event
  * @return bool
  */
 public function matchEvent(Mage_Index_Model_Event $event)
 {
     $data = $event->getNewData();
     if (isset($data[self::EVENT_MATCH_RESULT_KEY])) {
         return $data[self::EVENT_MATCH_RESULT_KEY];
     }
     $entity = $event->getEntity();
     if ($entity == Mage_Core_Model_Store::ENTITY) {
         /* @var $store Mage_Core_Model_Store */
         $store = $event->getDataObject();
         if ($store && $store->isObjectNew()) {
             $result = true;
         } else {
             $result = false;
         }
     } else {
         if ($entity == Mage_Core_Model_Store_Group::ENTITY) {
             /* @var $storeGroup Mage_Core_Model_Store_Group */
             $storeGroup = $event->getDataObject();
             if ($storeGroup && $storeGroup->dataHasChangedFor('website_id')) {
                 $result = true;
             } else {
                 $result = false;
             }
         } else {
             if ($entity == Mage_Core_Model_Config_Data::ENTITY) {
                 $configData = $event->getDataObject();
                 if ($configData && in_array($configData->getPath(), $this->_relatedConfigSettings)) {
                     $result = $configData->isValueChanged();
                 } else {
                     $result = false;
                 }
             } else {
                 $result = parent::matchEvent($event);
             }
         }
     }
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);
     return $result;
 }
Ejemplo n.º 21
0
 /**
  * Check if event can be matched by process.
  * Overwrote for specific config save, store and store groups save matching
  *
  * @param Mage_Index_Model_Event $event
  * @return bool
  */
 public function matchEvent(Mage_Index_Model_Event $event)
 {
     $data = $event->getNewData();
     $resultKey = 'cataloginventory_stock_match_result';
     if (isset($data[$resultKey])) {
         return $data[$resultKey];
     }
     $result = null;
     $entity = $event->getEntity();
     if ($entity == Mage_Core_Model_Store::ENTITY) {
         /* @var $store Mage_Core_Model_Store */
         $store = $event->getDataObject();
         if ($store->isObjectNew()) {
             $result = true;
         } else {
             $result = false;
         }
     } else {
         if ($entity == Mage_Core_Model_Store_Group::ENTITY) {
             /* @var $storeGroup Mage_Core_Model_Store_Group */
             $storeGroup = $event->getDataObject();
             if ($storeGroup->dataHasChangedFor('website_id')) {
                 $result = true;
             } else {
                 $result = false;
             }
         } else {
             if ($entity == Mage_Core_Model_Config_Data::ENTITY) {
                 $configData = $event->getDataObject();
                 $path = $configData->getPath();
                 if (in_array($path, $this->_relatedConfigSettings)) {
                     $result = $configData->isValueChanged();
                 } else {
                     $result = false;
                 }
             } else {
                 $result = parent::matchEvent($event);
             }
         }
     }
     $event->addNewData($resultKey, $result);
     return $result;
 }
Ejemplo n.º 22
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)
 {
     if (!Mage::helper('catalog/product_flat')->isBuilt()) {
         return false;
     }
     $data = $event->getNewData();
     $resultKey = 'catalog_product_flat_match_result';
     if (isset($data[$resultKey])) {
         return $data[$resultKey];
     }
     $result = null;
     $entity = $event->getEntity();
     if ($entity == Mage_Catalog_Model_Resource_Eav_Attribute::ENTITY) {
         /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
         $attribute = $event->getDataObject();
         $addFilterable = Mage::helper('catalog/product_flat')->isAddFilterableAttributes();
         $enableBefore = $attribute->getOrigData('backend_type') == 'static' || $addFilterable && $attribute->getOrigData('is_filterable') > 0 || $attribute->getOrigData('used_in_product_listing') == 1 || $attribute->getOrigData('is_used_for_promo_rules') == 1 || $attribute->getOrigData('used_for_sort_by') == 1;
         $enableAfter = $attribute->getData('backend_type') == 'static' || $addFilterable && $attribute->getData('is_filterable') > 0 || $attribute->getData('used_in_product_listing') == 1 || $attribute->getData('is_used_for_promo_rules') == 1 || $attribute->getData('used_for_sort_by') == 1;
         if ($event->getType() == Mage_Index_Model_Event::TYPE_DELETE) {
             $result = $enableBefore;
         } else {
             if ($event->getType() == Mage_Index_Model_Event::TYPE_SAVE) {
                 if ($enableAfter || $enableBefore) {
                     $result = true;
                 } else {
                     $result = false;
                 }
             } else {
                 $result = false;
             }
         }
     } else {
         if ($entity == Mage_Core_Model_Store::ENTITY) {
             if ($event->getType() == Mage_Index_Model_Event::TYPE_DELETE) {
                 $result = true;
             } else {
                 /* @var $store Mage_Core_Model_Store */
                 $store = $event->getDataObject();
                 if ($store->isObjectNew()) {
                     $result = true;
                 } else {
                     $result = false;
                 }
             }
         } else {
             if ($entity == Mage_Core_Model_Store_Group::ENTITY) {
                 /* @var $storeGroup Mage_Core_Model_Store_Group */
                 $storeGroup = $event->getDataObject();
                 if ($storeGroup->dataHasChangedFor('website_id')) {
                     $result = true;
                 } else {
                     $result = false;
                 }
             } else {
                 $result = parent::matchEvent($event);
             }
         }
     }
     $event->addNewData($resultKey, $result);
     return $result;
 }
Ejemplo n.º 23
0
 /**
  * Check if event can be matched by process
  * Overwrote for check is flat catalog category is enabled and specific save
  * category, store, store_group
  *
  * @param Mage_Index_Model_Event $event
  * @return bool
  */
 public function matchEvent(Mage_Index_Model_Event $event)
 {
     if (!Mage::helper('catalog/category_flat')->isEnabled(true)) {
         return false;
     }
     $data = $event->getNewData();
     $resultKey = 'catalog_category_flat_match_result';
     if (isset($data[$resultKey])) {
         return $data[$resultKey];
     }
     $result = null;
     $entity = $event->getEntity();
     if ($entity == Mage_Core_Model_Store::ENTITY) {
         if ($event->getType() == Mage_Index_Model_Event::TYPE_DELETE) {
             $result = true;
         } else {
             if ($event->getType() == Mage_Index_Model_Event::TYPE_SAVE) {
                 /* @var $store Mage_Core_Model_Store */
                 $store = $event->getDataObject();
                 if ($store->isObjectNew() || $store->dataHasChangedFor('group_id') || $store->dataHasChangedFor('root_catefory_id')) {
                     $result = true;
                 } else {
                     $result = false;
                 }
             } else {
                 $result = false;
             }
         }
     } else {
         if ($entity == Mage_Core_Model_Store_Group::ENTITY) {
             /* @var $storeGroup Mage_Core_Model_Store_Group */
             $storeGroup = $event->getDataObject();
             if ($storeGroup->dataHasChangedFor('website_id')) {
                 $result = true;
             } else {
                 $result = false;
             }
         } else {
             $result = parent::matchEvent($event);
         }
     }
     $event->addNewData($resultKey, $result);
     return $result;
 }
Ejemplo n.º 24
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)
 {
     $data = $event->getNewData();
     $resultKey = 'catalogsearch_fulltext_match_result';
     if (isset($data[$resultKey])) {
         return $data[$resultKey];
     }
     $result = null;
     $entity = $event->getEntity();
     if ($entity == Mage_Catalog_Model_Resource_Eav_Attribute::ENTITY) {
         /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
         $attribute = $event->getDataObject();
         if ($event->getType() == Mage_Index_Model_Event::TYPE_SAVE) {
             $result = $attribute->dataHasChangedFor('is_searchable');
         } else {
             if ($event->getType() == Mage_Index_Model_Event::TYPE_DELETE) {
                 $result = $attribute->getIsSearchable();
             } else {
                 $result = false;
             }
         }
     } else {
         if ($entity == Mage_Core_Model_Store::ENTITY) {
             if ($event->getType() == Mage_Index_Model_Event::TYPE_DELETE) {
                 $result = true;
             } else {
                 /* @var $store Mage_Core_Model_Store */
                 $store = $event->getDataObject();
                 if ($store->isObjectNew()) {
                     $result = true;
                 } else {
                     $result = false;
                 }
             }
         } else {
             if ($entity == Mage_Core_Model_Store_Group::ENTITY) {
                 /* @var $storeGroup Mage_Core_Model_Store_Group */
                 $storeGroup = $event->getDataObject();
                 if ($storeGroup->dataHasChangedFor('website_id')) {
                     $result = true;
                 } else {
                     $result = false;
                 }
             } else {
                 if ($entity == Mage_Core_Model_Config_Data::ENTITY) {
                     $data = $event->getDataObject();
                     if (in_array($data->getPath(), $this->_relatedConfigSettings)) {
                         $result = $data->isValueChanged();
                     } else {
                         $result = false;
                     }
                 } else {
                     $result = parent::matchEvent($event);
                 }
             }
         }
     }
     $event->addNewData($resultKey, $result);
     return $result;
 }
Ejemplo n.º 25
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;
 }