Skip to content

Commit 38f13c2

Browse files
committed
MAGETWO-33583: Catalog page is not updated when a product status changes
1 parent 518964e commit 38f13c2

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -836,12 +836,12 @@ public function eavReindexCallback()
836836
public function reindex()
837837
{
838838
if ($this->_catalogProduct->isDataForProductCategoryIndexerWasChanged($this) || $this->isDeleted()) {
839-
$this->_productFlatIndexerProcessor->reindexRow($this->getEntityId());
840-
$categoryIndexer = $this->indexerRegistry->get(Indexer\Product\Category::INDEXER_ID);
841-
if (!$categoryIndexer->isScheduled()) {
842-
$categoryIndexer->reindexRow($this->getId());
839+
$productCategoryIndexer = $this->indexerRegistry->get(Indexer\Product\Category::INDEXER_ID);
840+
if (!$productCategoryIndexer->isScheduled()) {
841+
$productCategoryIndexer->reindexRow($this->getId());
843842
}
844843
}
844+
$this->_productFlatIndexerProcessor->reindexRow($this->getEntityId());
845845
}
846846

847847
/**
@@ -2013,6 +2013,11 @@ public function getIdentities()
20132013
$identities[] = self::CACHE_PRODUCT_CATEGORY_TAG . '_' . $categoryId;
20142014
}
20152015
}
2016+
if ($this->getOrigData('status') > $this->getData('status')) {
2017+
foreach ($this->getData('category_ids') as $categoryId) {
2018+
$identities[] = self::CACHE_PRODUCT_CATEGORY_TAG . '_' . $categoryId;
2019+
}
2020+
}
20162021
return $identities;
20172022
}
20182023

app/code/Magento/Catalog/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
<item name="entity_id" xsi:type="string">entity_id</item>
9090
<item name="store_id" xsi:type="string">store_id</item>
9191
<item name="visibility" xsi:type="string">visibility</item>
92+
<item name="status" xsi:type="string">status</item>
9293
</item>
9394
</argument>
9495
<argument name="productRepository" xsi:type="object">Magento\Catalog\Api\ProductRepositoryInterface\Proxy</argument>

0 commit comments

Comments
 (0)