/**
  * @param Mana_Seo_Model_UrlIndexer $indexer
  * @param Mage_Index_Model_Event $event
  */
 public function register($indexer, $event)
 {
     $db = $this->_getReadAdapter();
     if ($event->getEntity() == 'mana_filters/filter2') {
         if ($event->getData('data_object')->getType() == 'category') {
             $event->addNewData('process_category_filter', true);
         }
     } elseif ($event->getEntity() == 'mana_filters/filter2_store') {
         $attributeType = $db->fetchOne($db->select()->from(array('f' => $this->getTable('mana_filters/filter2')), 'type')->where('f.id = ?', $event->getData('data_object')->getGlobalId()));
         if ($attributeType == 'category') {
             $event->addNewData('process_category_filter', true);
         }
     }
 }
 /**
  * @param Mana_Seo_Model_UrlIndexer $indexer
  * @param Mage_Index_Model_Event $event
  */
 public function register($indexer, $event)
 {
     $db = $this->_getReadAdapter();
     if ($event->getEntity() == Mage_Catalog_Model_Resource_Eav_Attribute::ENTITY) {
         $event->addNewData('attribute_id', $event->getData('data_object')->getId());
     } elseif ($event->getEntity() == 'mana_filters/filter2') {
         if ($attributeId = $this->getFilterResource()->getAttributeId($event->getData('data_object'))) {
             $event->addNewData('attribute_id', $attributeId);
         }
     } elseif ($event->getEntity() == 'mana_filters/filter2_store') {
         if ($attributeId = $this->getFilterStoreResource()->getAttributeId($event->getData('data_object'))) {
             $event->addNewData('attribute_id', $attributeId);
         }
     }
 }
예제 #3
0
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, true);
     $entity = $event->getEntity();
     if ($entity == Mage_Catalog_Model_Convert_Adapter_Product::ENTITY) {
         $event->addNewData('catalog_product_price_reindex_all', true);
     } else {
         if ($entity == Mage_Catalog_Model_Product::ENTITY) {
             switch ($event->getType()) {
                 case Mage_Index_Model_Event::TYPE_SAVE:
                     $this->_registerCatalogProductSaveEvent($event);
                     break;
                 case Mage_Index_Model_Event::TYPE_MASS_ACTION:
                     $this->_registerCatalogProductMassActionEvent($event);
                     break;
             }
         } else {
             if ($entity == Unirgy_Dropship_Model_Vendor::ENTITY) {
                 switch ($event->getType()) {
                     case Mage_Index_Model_Event::TYPE_SAVE:
                         $this->_registerVendorSaveEvent($event);
                         break;
                     case self::EVENT_TYPE_REINDEX_ASSOC:
                         $event->addNewData('udreindex_vendor_ids', $event->getDataObject()->getVendorIds());
                         break;
                 }
             }
         }
     }
 }
예제 #4
0
 public function processEvent(Mage_Index_Model_Event $event)
 {
     if ((int) Mage::getStoreConfig('solr/indexer/product_update')) {
         $solr = Mage::helper('solr')->getSolr();
         $entity = $event->getEntity();
         $type = $event->getType();
         switch ($entity) {
             case Mage_Catalog_Model_Product::ENTITY:
                 if ($type == Mage_Index_Model_Event::TYPE_MASS_ACTION) {
                 } elseif ($type == Mage_Index_Model_Event::TYPE_SAVE) {
                     $object = $event->getDataObject();
                     $document = $this->getSolrDocument();
                     if ($document->setObject($object)) {
                         $solr->addDocument($document);
                         $solr->addDocuments();
                         $solr->commit();
                     }
                 } elseif ($type == Mage_Index_Model_Event::TYPE_DELETE) {
                 }
                 break;
             case Mage_Catalog_Model_Resource_Eav_Attribute::ENTITY:
                 $this->_skipReindex($event);
                 break;
         }
     }
 }
예제 #5
0
 /**
  * Register data required by process in event object
  *
  * @param Mage_Index_Model_Event $event
  */
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     $entity = $event->getEntity();
     if ($entity == Mage_Catalog_Model_Product::ENTITY) {
         switch ($event->getType()) {
             case Mage_Index_Model_Event::TYPE_DELETE:
                 $this->_registerCatalogProductDeleteEvent($event);
                 break;
             case Mage_Index_Model_Event::TYPE_SAVE:
                 $this->_registerCatalogProductSaveEvent($event);
                 break;
             case Mage_Index_Model_Event::TYPE_MASS_ACTION:
                 $this->_registerCatalogProductMassActionEvent($event);
                 break;
         }
     } else {
         if ($entity == Mage_Catalog_Model_Resource_Eav_Attribute::ENTITY) {
             switch ($event->getType()) {
                 case Mage_Index_Model_Event::TYPE_SAVE:
                     $this->_registerCatalogAttributeSaveEvent($event);
                     break;
             }
         } else {
             if ($entity == Mage_Catalog_Model_Convert_Adapter_Product::ENTITY) {
                 $event->addNewData('catalog_product_eav_reindex_all', true);
             }
         }
     }
 }
예제 #6
0
 public function processEvent(Mage_Index_Model_Event $event)
 {
     if ((int) Mage::getStoreConfig('solr/indexer/cms_update')) {
         $solr = Mage::helper('solr')->getSolr();
         $entity = $event->getEntity();
         $type = $event->getType();
         switch ($entity) {
             case DMC_Solr_Model_Cms_Page::ENTITY:
                 if ($type == Mage_Index_Model_Event::TYPE_SAVE) {
                     $object = $event->getDataObject();
                     $document = $this->getSolrDocument();
                     if ($document->setObject($object)) {
                         $solr->addDocument($document);
                         $solr->addDocuments();
                         $solr->commit();
                     }
                 } elseif ($type == Mage_Index_Model_Event::TYPE_DELETE) {
                     $object = $event->getDataObject();
                     $document = $this->getSolrDocument();
                     if ($document->setObject($object)) {
                         $solr->deleteDocument($document);
                         $solr->commit();
                     }
                 }
                 break;
         }
     }
 }
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, TRUE);
     switch ($event->getEntity()) {
         case Mage_Catalog_Model_Category::ENTITY:
             $this->_registerCatalogCategoryEvent($event);
             break;
     }
 }
예제 #8
0
 /**
  * Register data required by process in event object
  *
  * @param Mage_Index_Model_Event $event
  */
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     if ($event->getEntity() == Mage_Catalog_Model_Product::ENTITY) {
         $this->_registerCatalogProduct($event);
     } elseif ($event->getEntity() == Mage_Tag_Model_Tag::ENTITY) {
         $this->_registerTag($event);
     } elseif ($event->getEntity() == Mage_Tag_Model_Tag_Relation::ENTITY) {
         $this->_registerTagRelation($event);
     }
 }
예제 #9
0
 /**
  * This method is called by the core indexer process
  * in case of saving (insert/update) a product
  */
 protected function _processEvent(Mage_Index_Model_Event $event)
 {
     $solr = Mage::helper('solr')->getSolr();
     $object = $event->getDataObject();
     // if the product is not active anymore, we will remove it from solr index
     if ($object->getStatus() != Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
         $solr->deleteByQuery("id:{$object->getId()}");
         Mage::helper('solr/log')->addDebugMessage('The object #' . $object->getId() . ' is not active and was therefore deleted.');
         Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('solr')->__('The Product has been removed from Solr.'));
         return;
     }
     // $object contains the full product object
     if ($event->getEntity() == 'catalog_product' && $event->getType() == 'save' && $event->getDataObject()) {
         if ((int) Mage::getStoreConfig('solr/indexer/product_update')) {
             $storeId = $object->getStoreId();
             // to-do
             // index just those store views, we need
             /*
             $adapter = new DMC_Solr_Model_SolrServer_Adapter_Product();
             $document = $adapter->getSolrDocument();
             if($document->setObject($object)) {
                 $document->setStoreId($storeId);
                 // add doducment to adapter object
                 $solr->addDocument($document);
             
                 #echo '<pre>';
                 #print_r($document);exit;
             }
             
             // send documents to solr
             $solr->addDocuments();
             */
             if (!$storeId) {
                 $storeIds = Mage::helper('solr')->getStoresForReindex();
             } else {
                 $storeIds = array($storeId);
             }
             $adapter = new DMC_Solr_Model_SolrServer_Adapter_Product();
             $productId = $object->getId();
             foreach ($storeIds as $storeId) {
                 $object = Mage::getModel('catalog/product')->setStoreId($storeId)->load($productId);
                 $document = $adapter->getSolrDocument();
                 if ($document->setObject($object)) {
                     $document->setStoreId($storeId);
                     $solr->addDocument($document);
                 }
             }
             $solr->addDocuments();
             // commit data to solr
             $solr->commit();
             Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('solr')->__('The Product has been updated at Solr.'));
         }
     }
 }
예제 #10
0
 /**
  * Register indexer required data inside event object
  *
  * @param Mage_Index_Model_Event $event
  */
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     // TODO: Implement _registerEvent() method.
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, true);
     switch ($event->getEntity()) {
         case Mage_Catalog_Model_Product::ENTITY:
             $this->registerCatalogProductEvent($event);
             break;
             // TODO handle other models
     }
 }
예제 #11
0
 /**
  * Register data required by process in event object
  *
  * @param Mage_Index_Model_Event $event Index Event Model
  */
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     switch ($event->getEntity()) {
         case Mage_Catalog_Model_Product::ENTITY:
             //$this->_registerCatalogProductEvent($event);
             break;
         case Mage_Catalog_Model_Category::ENTITY:
             $this->_registerCatalogCategoryEvent($event);
             break;
     }
 }
예제 #12
0
파일: Url.php 프로젝트: santhosh400/ecart
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, true);
     $entity = $event->getEntity();
     switch ($entity) {
         case Mage_Core_Model_Store::ENTITY:
         case Mage_Core_Model_Store_Group::ENTITY:
             $process = $event->getProcess();
             $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
             break;
     }
     return $this;
 }
예제 #13
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();
     $result = true;
     if ($entity != Mage_Catalog_Model_Product::ENTITY) {
         return;
     }
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);
     return $result;
 }
예제 #14
0
파일: Price.php 프로젝트: buttasg/cowgirlk
 public function registerEvent(Mage_Index_Model_Event $event)
 {
     $entity = $event->getEntity();
     if ($entity == Mage_Catalog_Model_Product::ENTITY) {
         switch ($event->getType()) {
             case Mage_Index_Model_Event::TYPE_SAVE:
                 $this->_registerCatalogProductSaveEvent($event);
                 break;
             case Mage_Index_Model_Event::TYPE_MASS_ACTION:
                 $this->_registerCatalogProductMassActionEvent($event);
                 break;
         }
     }
 }
예제 #15
0
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, TRUE);
     switch ($event->getEntity()) {
         case Mage_Catalog_Model_Product::ENTITY:
             $this->_registerCatalogProductEvent($event);
             break;
         case Mage_Catalog_Model_Category::ENTITY:
             $this->_registerCatalogCategoryEvent($event);
             break;
         case Mage_Catalog_Model_Convert_Adapter_Product::ENTITY:
             $event->addNewData('algoliasearch_reindex_all', TRUE);
             break;
         case Mage_Core_Model_Store_Group::ENTITY:
             $event->addNewData('algoliasearch_reindex_all', TRUE);
             break;
     }
 }
예제 #16
0
 /**
  * Register data required by product type process in event object
  *
  * @param Mage_Index_Model_Event $event
  */
 public function registerEvent(Mage_Index_Model_Event $event)
 {
     $attributes = array('allow_open_amount', 'open_amount_min', 'open_amount_max');
     $entity = $event->getEntity();
     if ($entity == Mage_Catalog_Model_Product::ENTITY) {
         switch ($event->getType()) {
             case Mage_Index_Model_Event::TYPE_SAVE:
                 /* @var $product Mage_Catalog_Model_Product */
                 $product = $event->getDataObject();
                 $reindexPrice = $product->getAmountsHasChanged();
                 foreach ($attributes as $code) {
                     if ($product->dataHasChangedFor($code)) {
                         $reindexPrice = true;
                         break;
                     }
                 }
                 if ($reindexPrice) {
                     $event->addNewData('product_type_id', $product->getTypeId());
                     $event->addNewData('reindex_price', 1);
                 }
                 break;
             case Mage_Index_Model_Event::TYPE_MASS_ACTION:
                 /* @var $actionObject Varien_Object */
                 $actionObject = $event->getDataObject();
                 $reindexPrice = false;
                 // check if attributes changed
                 $attrData = $actionObject->getAttributesData();
                 if (is_array($attrData)) {
                     foreach ($attributes as $code) {
                         if (array_key_exists($code, $attrData)) {
                             $reindexPrice = true;
                             break;
                         }
                     }
                 }
                 if ($reindexPrice) {
                     $event->addNewData('reindex_price_product_ids', $actionObject->getProductIds());
                 }
                 break;
         }
     }
 }
예제 #17
0
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, TRUE);
     switch ($event->getEntity()) {
         case Mage_Catalog_Model_Product::ENTITY:
             $this->_registerCatalogProductEvent($event);
             break;
         case Mage_Catalog_Model_Convert_Adapter_Product::ENTITY:
             $event->addNewData('algoliasearch_reindex_all', TRUE);
             break;
         case Mage_Core_Model_Store_Group::ENTITY:
             $event->addNewData('algoliasearch_reindex_all', TRUE);
             break;
         case Mage_CatalogInventory_Model_Stock_Item::ENTITY:
             if (false == $this->config->getShowOutOfStock()) {
                 $this->_registerCatalogInventoryStockItemEvent($event);
             }
             break;
     }
 }
예제 #18
0
 /**
  * Register data required by process in event object
  * Check if category ids was changed
  *
  * @param Mage_Index_Model_Event $event
  */
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, true);
     $entity = $event->getEntity();
     switch ($entity) {
         case EM_Blog_Model_Post::ENTITY:
             $this->_registerProductEvent($event);
             break;
         case EM_Blog_Model_Category::ENTITY:
             $this->_registerCategoryEvent($event);
             break;
         case Mage_Catalog_Model_Convert_Adapter_Product::ENTITY:
             $event->addNewData('catalog_category_product_reindex_all', true);
             break;
         case Mage_Core_Model_Store::ENTITY:
         case Mage_Core_Model_Store_Group::ENTITY:
             $process = $event->getProcess();
             $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
             break;
     }
     return $this;
 }
예제 #19
0
 /**
  * Try dynamicly detect and call event hanler from resource model.
  * Handler name will be generated from event entity and type code
  *
  * @param   Mage_Index_Model_Event $event
  * @return  Mage_Index_Model_Indexer_Abstract
  */
 public function callEventHandler(Mage_Index_Model_Event $event)
 {
     if ($event->getEntity()) {
         $method = $this->_camelize($event->getEntity() . '_' . $event->getType());
     } else {
         $method = $this->_camelize($event->getType());
     }
     $resourceModel = $this->_getResource();
     if (method_exists($resourceModel, $method)) {
         $resourceModel->{$method}($event);
     }
     return $this;
 }
예제 #20
0
파일: Abstract.php 프로젝트: relue/magento2
 /**
  * Try dynamicly detect and call event hanler from resource model.
  * Handler name will be generated from event entity and type code
  *
  * @param   Mage_Index_Model_Event $event
  * @return  Mage_Index_Model_Indexer_Abstract
  */
 public function callEventHandler(Mage_Index_Model_Event $event)
 {
     if ($event->getEntity()) {
         $method = $event->getEntity() . '_' . $event->getType();
     } else {
         $method = $event->getType();
     }
     $method = str_replace(' ', '', ucwords(str_replace('_', ' ', $method)));
     $resourceModel = $this->_getResource();
     if (method_exists($resourceModel, $method)) {
         $resourceModel->{$method}($event);
     }
     return $this;
 }
예제 #21
0
 /**
  * Register data required by process in event object
  *
  * @param Mage_Index_Model_Event $event
  */
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     switch ($event->getEntity()) {
         case Mage_Catalog_Model_Product::ENTITY:
             $this->_registerCatalogProductEvent($event);
             break;
         case Mage_Catalog_Model_Convert_Adapter_Product::ENTITY:
             $event->addNewData('catalogsearch_fulltext_reindex_all', true);
             break;
         case Mage_Core_Model_Config_Data::ENTITY:
         case Mage_Core_Model_Store::ENTITY:
         case Mage_Catalog_Model_Resource_Eav_Attribute::ENTITY:
         case Mage_Core_Model_Store_Group::ENTITY:
             $event->addNewData('catalogsearch_fulltext_skip_call_event_handler', true);
             $process = $event->getProcess();
             $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
             break;
         case Mage_Catalog_Model_Category::ENTITY:
             $this->_registerCatalogCategoryEvent($event);
             break;
     }
 }
예제 #22
0
 /**
  * Register data required by process in event object
  *
  * @param Mage_Index_Model_Event $event
  */
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, true);
     switch ($event->getEntity()) {
         case Mage_CatalogInventory_Model_Stock_Item::ENTITY:
             $this->_registerCatalogInventoryStockItemEvent($event);
             break;
         case Mage_Catalog_Model_Product::ENTITY:
             $this->_registerCatalogProductEvent($event);
             break;
         case Mage_Catalog_Model_Convert_Adapter_Product::ENTITY:
             $event->addNewData('cataloginventory_stock_reindex_all', true);
             break;
         case Mage_Core_Model_Store::ENTITY:
         case Mage_Core_Model_Store_Group::ENTITY:
         case Mage_Core_Model_Config_Data::ENTITY:
             $event->addNewData('cataloginventory_stock_skip_call_event_handler', true);
             $process = $event->getProcess();
             $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
             if ($event->getEntity() == Mage_Core_Model_Config_Data::ENTITY) {
                 $configData = $event->getDataObject();
                 if ($configData->getPath() == Mage_CatalogInventory_Helper_Data::XML_PATH_SHOW_OUT_OF_STOCK) {
                     Mage::getSingleton('index/indexer')->getProcessByCode('catalog_product_price')->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
                     Mage::getSingleton('index/indexer')->getProcessByCode('catalog_product_attribute')->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
                 }
             }
             break;
     }
 }
예제 #23
0
 /**
  * Register data required by process in event object
  *
  * @param Mage_Index_Model_Event $event
  */
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     switch ($event->getEntity()) {
         case Mage_Catalog_Model_Product::ENTITY:
             $this->_registerCatalogProductEvent($event);
             break;
         case Mage_Catalog_Model_Convert_Adapter_Product::ENTITY:
             $event->addNewData('catalog_product_flat_reindex_all', true);
             break;
         case Mage_Core_Model_Store::ENTITY:
             if ($event->getType() == Mage_Index_Model_Event::TYPE_DELETE) {
                 $this->_registerCoreStoreEvent($event);
                 break;
             }
         case Mage_Catalog_Model_Resource_Eav_Attribute::ENTITY:
         case Mage_Core_Model_Store_Group::ENTITY:
             $event->addNewData('catalog_product_flat_skip_call_event_handler', true);
             $process = $event->getProcess();
             $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
             break;
     }
 }
예제 #24
0
 public function registerEvent(Mage_Index_Model_Event $event)
 {
     $entity = $event->getEntity();
     $type = $event->getType();
     $types = $this->getDocumentTypes();
     foreach ($types as $name => $class) {
         $adapter = new $class();
         if ($adapter->matchEntityAndType($entity, $type)) {
             $adapter->registerEvent($event);
         }
     }
 }
예제 #25
0
 /**
  * Register data required by process in event object
  *
  * @param Mage_Index_Model_Event $event
  */
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, true);
     $entity = $event->getEntity();
     if ($entity == Mage_Core_Model_Config_Data::ENTITY || $entity == Mage_Customer_Model_Group::ENTITY) {
         $process = $event->getProcess();
         $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
     } else {
         if ($entity == Mage_Catalog_Model_Convert_Adapter_Product::ENTITY) {
             $event->addNewData('catalog_product_price_reindex_all', true);
         } else {
             if ($entity == Mage_Catalog_Model_Product::ENTITY) {
                 switch ($event->getType()) {
                     case Mage_Index_Model_Event::TYPE_DELETE:
                         $this->_registerCatalogProductDeleteEvent($event);
                         break;
                     case Mage_Index_Model_Event::TYPE_SAVE:
                         $this->_registerCatalogProductSaveEvent($event);
                         break;
                     case Mage_Index_Model_Event::TYPE_MASS_ACTION:
                         $this->_registerCatalogProductMassActionEvent($event);
                         break;
                     case self::EVENT_TYPE_REINDEX_PRICE:
                         $event->addNewData('id', $event->getDataObject()->getId());
                         break;
                 }
                 // call product type indexers registerEvent
                 $indexers = $this->_getResource()->getTypeIndexers();
                 foreach ($indexers as $indexer) {
                     $indexer->registerEvent($event);
                 }
             }
         }
     }
 }
예제 #26
0
 /**
  * Register data required by process in event object
  *
  * @param Mage_Index_Model_Event $event
  */
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     $event->addNewData(self::EVENT_MATCH_RESULT_KEY, true);
     switch ($event->getEntity()) {
         case Mage_Catalog_Model_Category::ENTITY:
             $this->_registerCatalogCategoryEvent($event);
             break;
         case Mage_Core_Model_Store::ENTITY:
             if ($event->getType() == Mage_Index_Model_Event::TYPE_DELETE) {
                 $this->_registerCoreStoreEvent($event);
                 break;
             }
         case Mage_Core_Model_Store_Group::ENTITY:
             $event->addNewData('catalog_category_flat_skip_call_event_handler', true);
             $process = $event->getProcess();
             $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
             break;
     }
 }
 /**
  * @param Mana_Seo_Model_UrlIndexer $indexer
  * @param Mage_Index_Model_Event $event
  */
 public function register($indexer, $event)
 {
     if ($event->getEntity() == Mage_Catalog_Model_Category::ENTITY) {
         $event->addNewData('category_id', $event->getData('data_object')->getId())->addNewData('category_path', $event->getData('data_object')->getPath());
     }
 }
 /**
  * @param Mana_Seo_Model_UrlIndexer $indexer
  * @param Mage_Index_Model_Event $event
  */
 public function register($indexer, $event)
 {
     if ($event->getEntity() == 'cms/page') {
         $event->addNewData('cms_page_id', $event->getData('data_object')->getId());
     }
 }
예제 #29
0
 /**
  * Process event based on event state data
  *
  * @param Mage_Index_Model_Event $event
  */
 protected function _processEvent(Mage_Index_Model_Event $event)
 {
     switch ($event->getType()) {
         case self::EVENT_TYPE_REINDEX_PRODUCTS:
             switch ($event->getEntity()) {
                 case self::ENTITY_PRODUCT:
                     $data = $event->getNewData();
                     if (!empty($data['product'])) {
                         $this->_reindex($data['product']);
                     }
                     break;
             }
             break;
         case self::EVENT_TYPE_CLEAN_TARGETRULES:
             switch ($event->getEntity()) {
                 case self::ENTITY_TARGETRULE:
                     $data = $event->getNewData();
                     if (!empty($data['params'])) {
                         $params = $data['params'];
                         $this->_cleanIndex($params->getTypeId(), $params->getStore());
                     }
                     break;
             }
             break;
     }
 }
예제 #30
0
파일: Points.php 프로젝트: rajarshc/Rooja
 /**
  * Process event
  * @param Mage_Index_Model_Event $event
  * @return void
  */
 protected function _processEvent(Mage_Index_Model_Event $event)
 {
     $data = $event->getNewData();
     $event_model = $event->getDataObject();
     if (!empty($data['rewards_customer_points_match_result'])) {
         try {
             if ($event->getEntity() == self::REWARDS_TRANSFER_ENTITY) {
                 if ($event_model) {
                     $transfer = $event_model;
                     $this->_getResource()->reindexUpdate($transfer->getCustomerId());
                 }
             } elseif ($event->getEntity() == self::REWARDS_CUSTOMER_ENTITY) {
                 if ($event_model) {
                     $customer = $event_model;
                     $this->_getResource()->reindexUpdate($customer->getId());
                 }
             } else {
                 // Model entity type was not recognized
             }
         } catch (Exception $e) {
             Mage::logException($e);
             Mage::helper('rewards/debug')->logException($e);
             $this->reindexAll();
         }
     }
 }