From 58d8d0247047428b7a5f5f9d4aa0e792b7cbba4b Mon Sep 17 00:00:00 2001 From: Ravi Chandra Date: Thu, 10 Oct 2019 19:13:08 +0530 Subject: [PATCH 1/2] optimized configurable product indexing --- .../ResourceModel/Product/Indexer/Price/Configurable.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php index b7bbf7aa1871c..9b37732a6b33a 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php @@ -248,8 +248,8 @@ private function updateTemporaryTable(string $temporaryPriceTableName, string $t // adds price of custom option, that was applied in DefaultPrice::_applyCustomOption $selectForCrossUpdate->columns( [ - 'min_price' => new \Zend_Db_Expr('i.min_price - i.price + io.min_price'), - 'max_price' => new \Zend_Db_Expr('i.max_price - i.price + io.max_price'), + 'min_price' => 'io.min_price', + 'max_price' => 'io.max_price', 'tier_price' => 'io.tier_price', ] ); From 395f88a439f9f225ffd10e5018647a35f10e1432 Mon Sep 17 00:00:00 2001 From: Ravi Chandra Date: Fri, 11 Oct 2019 10:14:44 +0530 Subject: [PATCH 2/2] Fixed static test --- .../Product/Indexer/Price/Configurable.php | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php index 9b37732a6b33a..099ff4fd02bad 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/Indexer/Price/Configurable.php @@ -117,18 +117,20 @@ public function executeByDimensions(array $dimensions, \Traversable $entityIds) { $this->tableMaintainer->createMainTmpTable($dimensions); - $temporaryPriceTable = $this->indexTableStructureFactory->create([ - 'tableName' => $this->tableMaintainer->getMainTmpTable($dimensions), - 'entityField' => 'entity_id', - 'customerGroupField' => 'customer_group_id', - 'websiteField' => 'website_id', - 'taxClassField' => 'tax_class_id', - 'originalPriceField' => 'price', - 'finalPriceField' => 'final_price', - 'minPriceField' => 'min_price', - 'maxPriceField' => 'max_price', - 'tierPriceField' => 'tier_price', - ]); + $temporaryPriceTable = $this->indexTableStructureFactory->create( + [ + 'tableName' => $this->tableMaintainer->getMainTmpTable($dimensions), + 'entityField' => 'entity_id', + 'customerGroupField' => 'customer_group_id', + 'websiteField' => 'website_id', + 'taxClassField' => 'tax_class_id', + 'originalPriceField' => 'price', + 'finalPriceField' => 'final_price', + 'minPriceField' => 'min_price', + 'maxPriceField' => 'max_price', + 'tierPriceField' => 'tier_price', + ] + ); $select = $this->baseFinalPrice->getQuery( $dimensions, \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE,