Skip to content

Commit 8ccaf0a

Browse files
author
Roman Ganin
committed
MAGETWO-3233: Clone - Configurable product doesn't go Out of stock with FPC enabled if customer buy the last associated product
- fixed product deletion flow and unit test
1 parent 9bf7a2b commit 8ccaf0a

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ public function eavReindexCallback()
831831
*/
832832
public function reindex()
833833
{
834-
if ($this->_catalogProduct->isDataForProductCategoryIndexerWasChanged($this)) {
834+
if ($this->_catalogProduct->isDataForProductCategoryIndexerWasChanged($this) || $this->isDeleted()) {
835835
$this->_productFlatIndexerProcessor->reindexRow($this->getEntityId());
836836
$categoryIndexer = $this->indexerRegistry->get(Indexer\Product\Category::INDEXER_ID);
837837
if (!$categoryIndexer->isScheduled()) {

dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ public function testIsInStock()
345345

346346
public function testIndexerAfterDeleteCommitProduct()
347347
{
348+
$this->model->isDeleted(true);
348349
$this->categoryIndexerMock->expects($this->once())->method('reindexRow');
349350
$this->productFlatProcessor->expects($this->once())->method('reindexRow');
350351
$this->productPriceProcessor->expects($this->once())->method('reindexRow');

0 commit comments

Comments
 (0)