Skip to content

Commit 52ece9e

Browse files
committed
Merge branch 'ACP2E-1994' of https://github.com/magento-l3/magento2ce into PR-07032023
2 parents 42330c5 + e489717 commit 52ece9e

File tree

2 files changed

+11
-1
lines changed
  • app/code/Magento/CatalogImportExport/Model/Export
  • dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Export

2 files changed

+11
-1
lines changed

app/code/Magento/CatalogImportExport/Model/Export/Product.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,10 +640,13 @@ protected function prepareCatalogInventory(array $productIds)
640640
if ($stockItemRow['use_config_max_sale_qty']) {
641641
$stockItemRow['max_sale_qty'] = $this->stockConfiguration->getMaxSaleQty();
642642
}
643-
644643
if ($stockItemRow['use_config_min_sale_qty']) {
645644
$stockItemRow['min_sale_qty'] = $this->stockConfiguration->getMinSaleQty();
646645
}
646+
if ($stockItemRow['use_config_manage_stock']) {
647+
$stockItemRow['manage_stock'] = $this->stockConfiguration->getManageStock();
648+
}
649+
647650
$stockItemRows[$productId] = $stockItemRow;
648651
}
649652
return $stockItemRows;

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Export/ProductTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ public function testExport(): void
148148
/**
149149
* Verify successful export of product with stock data with 'use config max sale quantity is enabled
150150
*
151+
* @magentoConfigFixture default/cataloginventory/item_options/manage_stock 1
151152
* @magentoDataFixture /Magento/Catalog/_files/product_without_options_with_stock_data.php
152153
* @magentoDbIsolation enabled
153154
* @return void
@@ -166,6 +167,8 @@ public function testExportWithStock(): void
166167
$stockItem = $product->getExtensionAttributes()->getStockItem();
167168
$stockItem->setMaxSaleQty($maxSaleQty);
168169
$stockItem->setMinSaleQty($minSaleQty);
170+
$stockItem->setManageStock(0);
171+
$stockItem->setUseConfigManageStock(1);
169172
$stockRepository->save($stockItem);
170173

171174
$this->model->setWriter(
@@ -174,10 +177,14 @@ public function testExportWithStock(): void
174177
)
175178
);
176179
$exportData = $this->model->export();
180+
$rows = $this->csvToArray($exportData);
181+
177182
$this->assertStringContainsString((string)$stockConfiguration->getMaxSaleQty(), $exportData);
178183
$this->assertStringNotContainsString($maxSaleQty, $exportData);
179184
$this->assertStringNotContainsString($minSaleQty, $exportData);
180185
$this->assertStringContainsString('Simple Product Without Custom Options', $exportData);
186+
$this->assertEquals(1, $rows[0]['use_config_manage_stock']);
187+
$this->assertEquals(1, $rows[0]['manage_stock']);
181188
}
182189

183190
/**

0 commit comments

Comments
 (0)