Skip to content

Commit 65a6e41

Browse files
committed
MAGETWO-54257: "Stock Status" attribute is not changed for Variation Simple Product
1 parent 1ea57c2 commit 65a6e41

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

app/code/Magento/ConfigurableProduct/Model/Product/VariationHandler.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ class VariationHandler
2929
/** @var \Magento\Catalog\Model\ProductFactory */
3030
protected $productFactory;
3131

32-
/** @var \Magento\CatalogInventory\Api\StockConfigurationInterface */
32+
/**
33+
* @var \Magento\CatalogInventory\Api\StockConfigurationInterface
34+
* @deprecated
35+
*/
3336
protected $stockConfiguration;
3437

3538
/**
@@ -168,14 +171,10 @@ protected function fillSimpleProductData(
168171

169172
$keysFilter = ['item_id', 'product_id', 'stock_id', 'type_id', 'website_id'];
170173
$postData['stock_data'] = array_diff_key((array)$parentProduct->getStockData(), array_flip($keysFilter));
171-
$postData['stock_data']['manage_stock'] = $postData['quantity_and_stock_status']['qty'] === '' ? 0 : 1;
172174
if (!isset($postData['stock_data']['is_in_stock'])) {
173175
$stockStatus = $parentProduct->getQuantityAndStockStatus();
174176
$postData['stock_data']['is_in_stock'] = $stockStatus['is_in_stock'];
175177
}
176-
$configDefaultValue = $this->stockConfiguration->getManageStock($product->getStoreId());
177-
$postData['stock_data']['use_config_manage_stock'] = $postData['stock_data']['manage_stock'] ==
178-
$configDefaultValue ? 1 : 0;
179178
$postData = $this->processMediaGallery($product, $postData);
180179
$postData['status'] = isset($postData['status'])
181180
? $postData['status']

app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/VariationHandlerTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,6 @@ public function testGenerateSimpleProducts()
254254
$parentProductMock->expects($this->once())
255255
->method('getQuantityAndStockStatus')
256256
->willReturn(['is_in_stock' => 1]);
257-
$newSimpleProductMock->expects($this->once())->method('getStoreId')->willReturn('store_id');
258-
$this->stockConfiguration->expects($this->once())
259-
->method('getManageStock')
260-
->with('store_id')
261-
->willReturn(1);
262257
$newSimpleProductMock->expects($this->once())->method('addData')->willReturnSelf();
263258
$parentProductMock->expects($this->once())->method('getWebsiteIds')->willReturn('website_id');
264259
$newSimpleProductMock->expects($this->once())->method('setWebsiteIds')->with('website_id')->willReturnSelf();

0 commit comments

Comments
 (0)