Skip to content

Commit d2d473a

Browse files
committed
BUG#AC-1705-Page Cache is not cleared for the parent product on the child product save
1 parent 724953d commit d2d473a

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

app/code/Magento/Catalog/Model/Indexer/Product/Price.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ public function __construct(
6666
public function execute($ids)
6767
{
6868
$this->_productPriceIndexerRows->execute($ids);
69-
$this->cacheContext->registerEntities(ProductModel::CACHE_TAG, $ids);
7069
}
7170

7271
/**

app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Magento\Catalog\Model\Indexer\Product\Price;
88

9+
use Magento\Catalog\Model\Product;
910
use Magento\Catalog\Model\Product\Type;
1011
use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\DefaultPrice;
1112
use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\Factory;
@@ -20,6 +21,7 @@
2021
use Magento\Framework\Exception\InputException;
2122
use Magento\Framework\Exception\LocalizedException;
2223
use Magento\Framework\Exception\NoSuchEntityException;
24+
use Magento\Framework\Indexer\CacheContext;
2325
use Magento\Framework\Indexer\DimensionalIndexerInterface;
2426
use Magento\Framework\Search\Request\Dimension;
2527
use Magento\Framework\Stdlib\DateTime;
@@ -61,8 +63,6 @@ abstract class AbstractAction
6163
protected $_storeManager;
6264

6365
/**
64-
* Currency factory
65-
*
6666
* @var CurrencyFactory
6767
*/
6868
protected $_currencyFactory;
@@ -83,8 +83,6 @@ abstract class AbstractAction
8383
protected $_catalogProductType;
8484

8585
/**
86-
* Indexer price factory
87-
*
8886
* @var Factory
8987
*/
9088
protected $_indexerPriceFactory;
@@ -109,6 +107,11 @@ abstract class AbstractAction
109107
*/
110108
private $tableMaintainer;
111109

110+
/**
111+
* @var CacheContext
112+
*/
113+
private $cacheContext;
114+
112115
/**
113116
* @param ScopeConfigInterface $config
114117
* @param StoreManagerInterface $storeManager
@@ -121,6 +124,7 @@ abstract class AbstractAction
121124
* @param TierPrice|null $tierPriceIndexResource
122125
* @param DimensionCollectionFactory|null $dimensionCollectionFactory
123126
* @param TableMaintainer|null $tableMaintainer
127+
* @param CacheContext|null $cacheContext
124128
* @SuppressWarnings(PHPMD.NPathComplexity)
125129
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
126130
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -136,7 +140,8 @@ public function __construct(
136140
DefaultPrice $defaultIndexerResource,
137141
TierPrice $tierPriceIndexResource = null,
138142
DimensionCollectionFactory $dimensionCollectionFactory = null,
139-
TableMaintainer $tableMaintainer = null
143+
TableMaintainer $tableMaintainer = null,
144+
CacheContext $cacheContext = null
140145
) {
141146
$this->_config = $config;
142147
$this->_storeManager = $storeManager;
@@ -156,6 +161,7 @@ public function __construct(
156161
$this->tableMaintainer = $tableMaintainer ?? ObjectManager::getInstance()->get(
157162
TableMaintainer::class
158163
);
164+
$this->cacheContext = $cacheContext ?? ObjectManager::getInstance()->get(CacheContext::class);
159165
}
160166

161167
/**
@@ -391,6 +397,7 @@ protected function _reindexRows($changedIds = [])
391397

392398
if ($changedIds) {
393399
$this->deleteIndexData($changedIds);
400+
$this->cacheContext->registerEntities(Product::CACHE_TAG, $changedIds);
394401
}
395402

396403
$typeIndexers = $this->getTypeIndexers();

0 commit comments

Comments
 (0)