Skip to content
Snippets Groups Projects
Unverified Commit 5d572a02 authored by Illia Grybkov's avatar Illia Grybkov Committed by GitHub
Browse files

Merge pull request #1880 from magento-performance/MAGETWO-82888

Fixed issue:
  - MAGETWO-82888: [Performance] Product Price indexer stuck during reindexing
parents 89cf3a91 f7e7b312
No related merge requests found
...@@ -58,7 +58,7 @@ class Configurable extends \Magento\Catalog\Model\ResourceModel\Product\Indexer\ ...@@ -58,7 +58,7 @@ class Configurable extends \Magento\Catalog\Model\ResourceModel\Product\Indexer\
if ($this->hasEntity() || !empty($entityIds)) { if ($this->hasEntity() || !empty($entityIds)) {
$this->prepareFinalPriceDataForType($entityIds, $this->getTypeId()); $this->prepareFinalPriceDataForType($entityIds, $this->getTypeId());
$this->_applyCustomOption(); $this->_applyCustomOption();
$this->_applyConfigurableOption(); $this->_applyConfigurableOption($entityIds);
$this->_movePriceDataToIndexTable($entityIds); $this->_movePriceDataToIndexTable($entityIds);
} }
return $this; return $this;
...@@ -110,10 +110,11 @@ class Configurable extends \Magento\Catalog\Model\ResourceModel\Product\Indexer\ ...@@ -110,10 +110,11 @@ class Configurable extends \Magento\Catalog\Model\ResourceModel\Product\Indexer\
* Calculate minimal and maximal prices for configurable product options * Calculate minimal and maximal prices for configurable product options
* and apply it to final price * and apply it to final price
* *
* @param null|int|array $entityIds
* @return \Magento\ConfigurableProduct\Model\ResourceModel\Product\Indexer\Price\Configurable * @return \Magento\ConfigurableProduct\Model\ResourceModel\Product\Indexer\Price\Configurable
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/ */
protected function _applyConfigurableOption() protected function _applyConfigurableOption($entityIds = null)
{ {
$metadata = $this->getMetadataPool()->getMetadata(ProductInterface::class); $metadata = $this->getMetadataPool()->getMetadata(ProductInterface::class);
$connection = $this->getConnection(); $connection = $this->getConnection();
...@@ -133,12 +134,12 @@ class Configurable extends \Magento\Catalog\Model\ResourceModel\Product\Indexer\ ...@@ -133,12 +134,12 @@ class Configurable extends \Magento\Catalog\Model\ResourceModel\Product\Indexer\
['le' => $this->getTable('catalog_product_entity')], ['le' => $this->getTable('catalog_product_entity')],
'le.' . $linkField . ' = l.parent_id', 'le.' . $linkField . ' = l.parent_id',
['parent_id' => 'entity_id'] ['parent_id' => 'entity_id']
)->join(
['i' => $this->_getDefaultFinalPriceTable()],
'le.entity_id = i.entity_id',
[]
); );
if ($entityIds !== null) {
$subSelect->where('le.entity_id IN (?)', $entityIds);
}
$select = $connection->select(); $select = $connection->select();
$select $select
->from(['sub' => new \Zend_Db_Expr('(' . (string)$subSelect . ')')], '') ->from(['sub' => new \Zend_Db_Expr('(' . (string)$subSelect . ')')], '')
...@@ -178,6 +179,7 @@ class Configurable extends \Magento\Catalog\Model\ResourceModel\Product\Indexer\ ...@@ -178,6 +179,7 @@ class Configurable extends \Magento\Catalog\Model\ResourceModel\Product\Indexer\
' AND i.website_id = io.website_id', ' AND i.website_id = io.website_id',
[] []
); );
// adds price of custom option, that was applied in DefaultPrice::_applyCustomOption
$select->columns( $select->columns(
[ [
'min_price' => new \Zend_Db_Expr('i.min_price - i.orig_price + io.min_price'), 'min_price' => new \Zend_Db_Expr('i.min_price - i.orig_price + io.min_price'),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment