9
9
use Magento \Catalog \Model \ResourceModel \Product \Option \Collection ;
10
10
use Magento \CatalogImportExport \Model \Import \Product as ImportProduct ;
11
11
use Magento \CatalogImportExport \Model \Import \Product \CategoryProcessor ;
12
+ use Magento \CatalogInventory \Api \StockConfigurationInterface ;
12
13
use Magento \Framework \App \ObjectManager ;
13
14
use Magento \ImportExport \Model \Import ;
14
15
use Magento \Store \Model \Store ;
@@ -169,6 +170,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity
169
170
*
170
171
* @var array
171
172
* @deprecated 100.2.0
173
+ * @see we don't use this variable anymore
172
174
*/
173
175
protected $ _headerColumns = [];
174
176
@@ -368,6 +370,11 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity
368
370
*/
369
371
private $ filter ;
370
372
373
+ /**
374
+ * @var StockConfigurationInterface
375
+ */
376
+ private $ stockConfiguration ;
377
+
371
378
/**
372
379
* Product constructor.
373
380
*
@@ -388,7 +395,8 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity
388
395
* @param ProductEntity\LinkTypeProvider $linkTypeProvider
389
396
* @param RowCustomizerInterface $rowCustomizer
390
397
* @param array $dateAttrCodes
391
- * @param ProductFilterInterface $filter
398
+ * @param ProductFilterInterface|null $filter
399
+ * @param StockConfigurationInterface|null $stockConfiguration
392
400
* @throws \Magento\Framework\Exception\LocalizedException
393
401
*/
394
402
public function __construct (
@@ -409,7 +417,8 @@ public function __construct(
409
417
\Magento \Catalog \Model \Product \LinkTypeProvider $ linkTypeProvider ,
410
418
\Magento \CatalogImportExport \Model \Export \RowCustomizerInterface $ rowCustomizer ,
411
419
array $ dateAttrCodes = [],
412
- ?ProductFilterInterface $ filter = null
420
+ ?ProductFilterInterface $ filter = null ,
421
+ ?StockConfigurationInterface $ stockConfiguration = null
413
422
) {
414
423
$ this ->_entityCollectionFactory = $ collectionFactory ;
415
424
$ this ->_exportConfig = $ exportConfig ;
@@ -426,7 +435,8 @@ public function __construct(
426
435
$ this ->rowCustomizer = $ rowCustomizer ;
427
436
$ this ->dateAttrCodes = array_merge ($ this ->dateAttrCodes , $ dateAttrCodes );
428
437
$ this ->filter = $ filter ?? ObjectManager::getInstance ()->get (ProductFilterInterface::class);
429
-
438
+ $ this ->stockConfiguration = $ stockConfiguration ?? ObjectManager::getInstance ()
439
+ ->get (StockConfigurationInterface::class);
430
440
parent ::__construct ($ localeDate , $ config , $ resource , $ storeManager );
431
441
432
442
$ this ->initTypeModels ()
@@ -625,6 +635,14 @@ protected function prepareCatalogInventory(array $productIds)
625
635
$ stockItemRow ['stock_id ' ],
626
636
$ stockItemRow ['stock_status_changed_auto ' ]
627
637
);
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
+ }
628
646
$ stockItemRows [$ productId ] = $ stockItemRow ;
629
647
}
630
648
return $ stockItemRows ;
@@ -755,7 +773,8 @@ private function getNonSystemAttributes(): array
755
773
* @param array $customOptionsData
756
774
* @param array $stockItemRows
757
775
* @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
759
778
*
760
779
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
761
780
*/
@@ -1182,6 +1201,7 @@ protected function collectMultirawData()
1182
1201
* @param int $storeId
1183
1202
* @return bool
1184
1203
* @deprecated 100.2.3
1204
+ * @see This protected method is not used anymore
1185
1205
*/
1186
1206
protected function hasMultiselectData ($ item , $ storeId )
1187
1207
{
@@ -1410,6 +1430,7 @@ private function updateGalleryImageData(&$dataRow, $rawData)
1410
1430
* Add multi row data to export
1411
1431
*
1412
1432
* @deprecated 100.1.0
1433
+ * @see This protected method is not used anymore
1413
1434
* @param array $dataRow
1414
1435
* @param array $multiRawData
1415
1436
* @return array
0 commit comments