本文整理汇总了PHP中Mage_Index_Model_Indexer_Abstract类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Index_Model_Indexer_Abstract类的具体用法?PHP Mage_Index_Model_Indexer_Abstract怎么用?PHP Mage_Index_Model_Indexer_Abstract使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Index_Model_Indexer_Abstract类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: matchEvent
/**
* 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;
}
示例2: matchEvent
/**
* 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;
}
示例3: __construct
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');
}
示例4: __construct
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();
}
示例5: _construct
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();
}
示例6: matchEvent
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;
}
示例7: matchEvent
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;
}
示例8: matchEvent
/**
* 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;
}
示例9: matchEvent
/**
* 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;
}
示例10: matchEvent
/**
* 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;
}
示例11: matchEvent
/**
* 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;
}
示例12: __construct
public function __construct()
{
parent::__construct();
$this->config = Mage::helper('algoliasearch/config');
$this->queue = Mage::getSingleton('algoliasearch/queue');
}
示例13: matchEvent
/**
* 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;
}
示例14: __construct
public function __construct()
{
parent::__construct();
$this->engine = new Algolia_Algoliasearch_Model_Resource_Engine();
}
示例15: matchEvent
/**
* 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;
}