Skip to content

Commit 4a46800

Browse files
committed
[Forwardport] magento/magento2#:11485 do the stock check on default level because the stock on website level isn't updated and should be ignored
1 parent fa906ed commit 4a46800

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

app/code/Magento/CatalogInventory/Model/ResourceModel/Product/StockStatusBaseSelectProcessor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ public function process(Select $select)
5656
['stock' => $stockStatusTable],
5757
sprintf('stock.product_id = %s.entity_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS),
5858
[]
59-
)->where('stock.stock_status = ?', Stock::STOCK_IN_STOCK);
59+
)
60+
->where('stock.stock_status = ?', Stock::STOCK_IN_STOCK)
61+
->where('stock.website_id = ?', 0);
6062
}
6163

6264
return $select;

app/code/Magento/CatalogInventory/Test/Unit/Model/ResourceModel/Product/StockStatusBaseSelectProcessorTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,13 @@ public function testProcess()
5656
[]
5757
)
5858
->willReturnSelf();
59-
$this->select->expects($this->once())
59+
60+
$this->select->expects($this->exactly(2))
6061
->method('where')
61-
->with('stock.stock_status = ?', Stock::STOCK_IN_STOCK)
62+
->withConsecutive(
63+
['stock.stock_status = ?', Stock::STOCK_IN_STOCK, null],
64+
['stock.website_id = ?', 0, null]
65+
)
6266
->willReturnSelf();
6367

6468
$this->stockStatusBaseSelectProcessor->process($this->select);

0 commit comments

Comments
 (0)