Skip to content

Instantly share code, notes, and snippets.

@jbrada
Last active August 21, 2019 11:51
Show Gist options
  • Select an option

  • Save jbrada/fca8556d2e4dc776d887f23078eb97dd to your computer and use it in GitHub Desktop.

Select an option

Save jbrada/fca8556d2e4dc776d887f23078eb97dd to your computer and use it in GitHub Desktop.
Fix for amasty/shopby 2.12.8 - EAV indexer stuck at "working"
diff --git a/Plugin/Catalog/Model/Indexer/Product/Eav/Action/Rows.php b/Plugin/Catalog/Model/Indexer/Product/Eav/Action/Rows.php
index 54283dc..92c44d6 100755
--- a/Plugin/Catalog/Model/Indexer/Product/Eav/Action/Rows.php
+++ b/Plugin/Catalog/Model/Indexer/Product/Eav/Action/Rows.php
@@ -12,7 +12,7 @@ use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Framework\EntityManager\MetadataPool;
use Amasty\Shopby\Helper\Group as GroupHelper;
use Magento\Framework\DB\Adapter\AdapterInterface;
-use Magento\Catalog\Model\Indexer\Product\Eav\Action\Row as IndexerEavActionRow;
+use Magento\Catalog\Model\Indexer\Product\Eav\Action\Rows as IndexerEavActionRows;
use Magento\Catalog\Model\ResourceModel\Product\Indexer\Eav\Source as EavSource;
use Amasty\Shopby\Plugin\Catalog\Model\Indexer\Product\Eav\Action\Adapter;
@@ -63,7 +63,7 @@ class Rows
* @param null $id
* @return array
*/
- public function beforeExecute(IndexerEavActionRow $indexer, $ids)
+ public function beforeExecute(IndexerEavActionRows $indexer, $ids)
{
$this->productIds = $ids;
return [$ids];
@@ -72,7 +72,7 @@ class Rows
/**
* @param IndexerEavActionFull $indexer
*/
- public function afterExecute(IndexerEavActionRow $indexer)
+ public function afterExecute(IndexerEavActionRows $indexer)
{
if ($this->productIds) {
$select = $this->connection
@@ -81,12 +81,6 @@ class Rows
->from($this->indexTable)
->where('value IN(?)', array_keys($this->adapter->getGroupedOptions()));
- $whereCondition = sprintf(
- '%s = %s',
- $this->entityMetadata->getIdentifierField(),
- $this->productId
- );
-
$select->where($this->entityMetadata->getIdentifierField() . ' IN(?)', $this->productIds);
$this->adapter->updateGroupedOptionsIndex($select);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment