Skip to content

Commit a8a7518

Browse files
author
Yaroslav Onischenko
committed
Merge remote-tracking branch 'origin/MAGETWO-44980' into develop
2 parents 180ca97 + 5b8f88c commit a8a7518

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

app/code/Magento/CatalogInventory/Model/StockIndex.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ public function updateProductStockStatus($productId, $websiteId)
120120
$status = $item->getIsInStock();
121121
$qty = $item->getQty();
122122
}
123-
$this->processChildren($productId, $websiteId, $qty, $status);
124-
$this->processParents($productId, $websiteId);
123+
$this->processChildren($productId, $item->getWebsiteId(), $qty, $status);
124+
$this->processParents($productId, $item->getWebsiteId());
125125
}
126126

127127
/**

app/code/Magento/CatalogInventory/Model/StockStateProvider.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ public function __construct(
7272
*/
7373
public function verifyStock(StockItemInterface $stockItem)
7474
{
75-
if ($stockItem->getQty() !== null
76-
&& $stockItem->getBackorders() == StockItemInterface::BACKORDERS_NO
75+
if ($stockItem->getQty() === null && $stockItem->getManageStock()) {
76+
return false;
77+
}
78+
if ($stockItem->getBackorders() == StockItemInterface::BACKORDERS_NO
7779
&& $stockItem->getQty() <= $stockItem->getMinQty()
7880
) {
7981
return false;

app/code/Magento/CatalogInventory/Test/Unit/Model/Spi/StockStateProviderTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,33 @@ protected function getVariations()
384384
'checkQtyIncrements' => false,
385385
'checkQuoteItemQty' => true,
386386
]
387+
],
388+
[
389+
'values' => [
390+
'getIsInStock' => true,
391+
'getQty' => null,
392+
'getMinQty' => 60,
393+
'getMinSaleQty' => 1,
394+
'getMaxSaleQty' => 99,
395+
'getNotifyStockQty' => 101,
396+
'getManageStock' => true,
397+
'getBackorders' => 0,
398+
'getQtyIncrements' => 1,
399+
'_stock_qty_' => null,
400+
'_suppress_check_qty_increments_' => false,
401+
'_is_saleable_' => true,
402+
'_ordered_items_' => 0,
403+
'_product_' => 'Test product Name',
404+
],
405+
'results' => [
406+
'verifyStock' => false,
407+
'verifyNotification' => true,
408+
'checkQty' => false,
409+
'suggestQty' => 50.5,
410+
'getStockQty' => null,
411+
'checkQtyIncrements' => false,
412+
'checkQuoteItemQty' => true,
413+
]
387414
]
388415
];
389416
}

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
<data name="product/data/price/value" xsi:type="string">10</data>
118118
<data name="product/data/product_has_weight" xsi:type="string">No</data>
119119
<data name="product/data/category" xsi:type="string">category_%isolation%</data>
120+
<data name="product/data/quantity_and_stock_status/qty" xsi:type="string">999</data>
120121
<data name="tag" xsi:type="string">test_type:acceptance_test</data>
121122
<constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" />
122123
<constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" />

0 commit comments

Comments
 (0)