/**
  * @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);
         }
     }
 }
 /**
  * Event handler for CMS page save events
  *
  * @param Mage_Index_Model_Event $event
  */
 public function CmsPageSave(Mage_Index_Model_Event $event)
 {
     $storeIds = $event->getDataObject()->getStores();
     $pageId = $event->getData('solr_update_page_id');
     foreach ($storeIds as $storeId) {
         $this->rebuildStoreIndex($storeId, $pageId);
     }
 }
 /**
  * @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());
     }
 }
 /**
  * @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());
     }
 }
 /**
  * Register indexer required data inside event object
  *
  * @param   Mage_Index_Model_Event $event
  */
 protected function _registerEvent(Mage_Index_Model_Event $event)
 {
     /* @var $object Mana_Db_Model_Entity */
     $object = $event->getData('data_object');
     $key = $event->getData('entity') . '-' . $object->getId();
     if (isset($this->_matchedEvents[$key])) {
         $event->addNewData('entity_filters', $this->_matchedEvents[$key]->getData('entity_filters'))->addNewData('entity_filter_id', $object->getId());
     }
 }
 /**
  * Process event based on event state data
  *
  * @param Mage_Index_Model_Event $event
  */
 protected function _processEvent(Mage_Index_Model_Event $event)
 {
     if ($event->getData('solr_update_page_id')) {
         $this->callEventHandler($event);
     }
 }
Exemplo n.º 8
0
 /**
  * Update or rebuild the index.
  *
  * @param Mage_Index_Model_Event $event
  * @param array $limitToGroupIds Only add the specified group ids to the index
  * @return void
  */
 protected function _reindexEntity($event = null, array $limitToGroupIds = null)
 {
     Varien_Profiler::start($this->_getProfilerName() . '::reindexEntity');
     $this->_checkIndexTable();
     $this->_checkAttribute();
     $entityType = Mage::getSingleton('eav/config')->getEntityType($this->_getEntityTypeCode());
     $attribute = Mage::getSingleton('eav/config')->getAttribute($this->_getEntityTypeCode(), Netzarbeiter_GroupsCatalog2_Helper_Data::HIDE_GROUPS_ATTRIBUTE);
     $select = $this->_getReadAdapter()->select()->from(array('e' => $this->getTable($entityType->getEntityTable())), array('entity_id' => 'e.entity_id'))->joinLeft(array('a' => $attribute->getBackend()->getTable()), $this->_getReadAdapter()->quoteInto('e.entity_id=a.entity_id AND a.attribute_id = ?', $attribute->getId()), array('group_ids' => 'value', 'store_id' => 'store_id'))->order('e.entity_id ASC')->order('a.store_id ASC');
     $entityIds = array();
     if ($event && $event->hasData('entity_ids')) {
         $entityIds = $event->getData('entity_ids');
         $select->where('e.entity_id IN (?)', $entityIds);
     }
     $this->_clearRecordsForReindex($entityIds, $limitToGroupIds);
     $stmt = $this->_getReadAdapter()->query($select);
     $this->_insertIndexRecords($stmt, $limitToGroupIds);
     Varien_Profiler::stop($this->_getProfilerName() . '::reindexEntity');
 }
Exemplo n.º 9
0
 /**
  * Calls entity_type + event_type handler on the indexer resource model
  * E.g. $this->getResource()->catalogProductMassAction() or ...->catalogCategorySave()
  *
  * @param Mage_Index_Model_Event $event
  * @return void
  */
 protected function _processEvent(Mage_Index_Model_Event $event)
 {
     if ($event->getData('entity_ids')) {
         $this->callEventHandler($event);
     }
 }