Skip to content

Commit 65bb209

Browse files
author
Jan Petr
authored
Merge pull request #922 from algolia/event_to_force_indexing
Introduce event and attributes to always index/remove product to/from Algolia
2 parents 3f42981 + b4ee80b commit 65bb209

File tree

1 file changed

+11
-2
lines changed
  • app/code/community/Algolia/Algoliasearch/Helper

1 file changed

+11
-2
lines changed

app/code/community/Algolia/Algoliasearch/Helper/Data.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,16 @@ protected function getProductsRecords($storeId, $collection, $potentiallyDeleted
476476
unset($potentiallyDeletedProductsIds[$productId]);
477477
}
478478

479+
Mage::dispatchEvent('algolia_before_product_availability_check', array('product' => $product, 'store' => $storeId));
480+
481+
if ($product->getData('algolia__noIndex') === true) {
482+
$productsToRemove[$productId] = $productId;
483+
}
484+
485+
if ($product->getData('algolia__alwaysIndex') === true) {
486+
$productsToIndex[$productId] = $this->product_helper->getObject($product);
487+
}
488+
479489
if (isset($productsToIndex[$productId]) || isset($productsToRemove[$productId])) {
480490
continue;
481491
}
@@ -489,8 +499,7 @@ protected function getProductsRecords($storeId, $collection, $potentiallyDeleted
489499
continue;
490500
}
491501

492-
$productObject = $this->product_helper->getObject($product);
493-
$productsToIndex[$productId] = $productObject;
502+
$productsToIndex[$productId] = $this->product_helper->getObject($product);
494503
}
495504

496505
$productsToRemove = array_merge($productsToRemove, $potentiallyDeletedProductsIds);

0 commit comments

Comments
 (0)