99use Magento \Catalog \Model \ResourceModel \Product \Option \Collection ;
1010use Magento \CatalogImportExport \Model \Import \Product as ImportProduct ;
1111use Magento \CatalogImportExport \Model \Import \Product \CategoryProcessor ;
12+ use Magento \CatalogInventory \Api \StockConfigurationInterface ;
1213use Magento \Framework \App \ObjectManager ;
1314use Magento \ImportExport \Model \Import ;
1415use Magento \Store \Model \Store ;
@@ -169,6 +170,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity
169170 *
170171 * @var array
171172 * @deprecated 100.2.0
173+ * @see we don't use this variable anymore
172174 */
173175 protected $ _headerColumns = [];
174176
@@ -368,6 +370,11 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity
368370 */
369371 private $ filter ;
370372
373+ /**
374+ * @var StockConfigurationInterface
375+ */
376+ private $ stockConfiguration ;
377+
371378 /**
372379 * Product constructor.
373380 *
@@ -388,7 +395,8 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity
388395 * @param ProductEntity\LinkTypeProvider $linkTypeProvider
389396 * @param RowCustomizerInterface $rowCustomizer
390397 * @param array $dateAttrCodes
391- * @param ProductFilterInterface $filter
398+ * @param ProductFilterInterface|null $filter
399+ * @param StockConfigurationInterface|null $stockConfiguration
392400 * @throws \Magento\Framework\Exception\LocalizedException
393401 */
394402 public function __construct (
@@ -409,7 +417,8 @@ public function __construct(
409417 \Magento \Catalog \Model \Product \LinkTypeProvider $ linkTypeProvider ,
410418 \Magento \CatalogImportExport \Model \Export \RowCustomizerInterface $ rowCustomizer ,
411419 array $ dateAttrCodes = [],
412- ?ProductFilterInterface $ filter = null
420+ ?ProductFilterInterface $ filter = null ,
421+ ?StockConfigurationInterface $ stockConfiguration = null
413422 ) {
414423 $ this ->_entityCollectionFactory = $ collectionFactory ;
415424 $ this ->_exportConfig = $ exportConfig ;
@@ -426,7 +435,8 @@ public function __construct(
426435 $ this ->rowCustomizer = $ rowCustomizer ;
427436 $ this ->dateAttrCodes = array_merge ($ this ->dateAttrCodes , $ dateAttrCodes );
428437 $ this ->filter = $ filter ?? ObjectManager::getInstance ()->get (ProductFilterInterface::class);
429-
438+ $ this ->stockConfiguration = $ stockConfiguration ?? ObjectManager::getInstance ()
439+ ->get (StockConfigurationInterface::class);
430440 parent ::__construct ($ localeDate , $ config , $ resource , $ storeManager );
431441
432442 $ this ->initTypeModels ()
@@ -625,6 +635,14 @@ protected function prepareCatalogInventory(array $productIds)
625635 $ stockItemRow ['stock_id ' ],
626636 $ stockItemRow ['stock_status_changed_auto ' ]
627637 );
638+
639+ if ($ stockItemRow ['use_config_max_sale_qty ' ]) {
640+ $ stockItemRow ['max_sale_qty ' ] = $ this ->stockConfiguration ->getMaxSaleQty ();
641+ }
642+
643+ if ($ stockItemRow ['use_config_min_sale_qty ' ]) {
644+ $ stockItemRow ['min_sale_qty ' ] = $ this ->stockConfiguration ->getMinSaleQty ();
645+ }
628646 $ stockItemRows [$ productId ] = $ stockItemRow ;
629647 }
630648 return $ stockItemRows ;
@@ -755,7 +773,8 @@ private function getNonSystemAttributes(): array
755773 * @param array $customOptionsData
756774 * @param array $stockItemRows
757775 * @return void
758- * @deprecated 100.2.0 Logic will be moved to _getHeaderColumns in future release
776+ * @deprecated 100.2.0
777+ * @see Logic is moved to _getHeaderColumns
759778 *
760779 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
761780 */
@@ -1182,6 +1201,7 @@ protected function collectMultirawData()
11821201 * @param int $storeId
11831202 * @return bool
11841203 * @deprecated 100.2.3
1204+ * @see This protected method is not used anymore
11851205 */
11861206 protected function hasMultiselectData ($ item , $ storeId )
11871207 {
@@ -1410,6 +1430,7 @@ private function updateGalleryImageData(&$dataRow, $rawData)
14101430 * Add multi row data to export
14111431 *
14121432 * @deprecated 100.1.0
1433+ * @see This protected method is not used anymore
14131434 * @param array $dataRow
14141435 * @param array $multiRawData
14151436 * @return array
0 commit comments