From 4ad0dad426479a78e78c80127d7f6213b6e32084 Mon Sep 17 00:00:00 2001 From: Peep van Puijenbroek Date: Sat, 8 Dec 2018 17:04:59 +0100 Subject: [PATCH] Fixes Smile-SA/elasticsuite#1223 and improves select statement --- .../Fulltext/Datasource/InventoryData.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/InventoryData.php b/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/InventoryData.php index a79dc79bb..f4c9d4457 100644 --- a/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/InventoryData.php +++ b/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/InventoryData.php @@ -84,16 +84,12 @@ public function loadInventoryData($storeId, $productIds) $tableName = $this->stockIndexTableProvider->execute($stockId); $select = $this->getConnection()->select() - ->from(['product' => $this->getTable('catalog_product_entity')], []) - ->join( - ['stock_index' => $tableName], - 'product.sku = stock_index.' . IndexStructure::SKU, - [ - 'product_id' => 'product.entity_id', - 'stock_status' => 'stock_index.' . IndexStructure::IS_SALABLE, - 'qty' => 'stock_index.' . IndexStructure::QUANTITY, - ] - ); + ->from($tableName, [ + 'product_id' => 'product_id', + 'stock_status' => IndexStructure::IS_SALABLE, + 'qty' => IndexStructure::QUANTITY, + ]) + ->where('product_id IN(?)', $productIds); return $this->getConnection()->fetchAll($select); }