diff --git a/vendor/magento/module-catalog-import-export/Model/Export/Product.php b/vendor/magento/module-catalog-import-export/Model/Export/Product.php index 900f70dadb07..7ef607bdc5b5 100644 --- a/vendor/magento/module-catalog-import-export/Model/Export/Product.php +++ b/vendor/magento/module-catalog-import-export/Model/Export/Product.php @@ -9,6 +9,7 @@ use Magento\Catalog\Model\ResourceModel\Product\Option\Collection; use Magento\CatalogImportExport\Model\Import\Product as ImportProduct; use Magento\CatalogImportExport\Model\Import\Product\CategoryProcessor; +use Magento\CatalogInventory\Api\StockConfigurationInterface; use Magento\Framework\App\ObjectManager; use Magento\ImportExport\Model\Import; use Magento\Store\Model\Store; @@ -169,6 +170,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity * * @var array * @deprecated 100.2.0 + * @see we don't use this variable anymore */ protected $_headerColumns = []; @@ -368,6 +370,11 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity */ private $filter; + /** + * @var StockConfigurationInterface + */ + private $stockConfiguration; + /** * Product constructor. * @@ -388,7 +395,8 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity * @param ProductEntity\LinkTypeProvider $linkTypeProvider * @param RowCustomizerInterface $rowCustomizer * @param array $dateAttrCodes - * @param ProductFilterInterface $filter + * @param ProductFilterInterface|null $filter + * @param StockConfigurationInterface|null $stockConfiguration * @throws \Magento\Framework\Exception\LocalizedException */ public function __construct( @@ -409,7 +417,8 @@ public function __construct( \Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider, \Magento\CatalogImportExport\Model\Export\RowCustomizerInterface $rowCustomizer, array $dateAttrCodes = [], - ?ProductFilterInterface $filter = null + ?ProductFilterInterface $filter = null, + ?StockConfigurationInterface $stockConfiguration = null ) { $this->_entityCollectionFactory = $collectionFactory; $this->_exportConfig = $exportConfig; @@ -426,7 +435,8 @@ public function __construct( $this->rowCustomizer = $rowCustomizer; $this->dateAttrCodes = array_merge($this->dateAttrCodes, $dateAttrCodes); $this->filter = $filter ?? ObjectManager::getInstance()->get(ProductFilterInterface::class); - + $this->stockConfiguration = $stockConfiguration ?? ObjectManager::getInstance() + ->get(StockConfigurationInterface::class); parent::__construct($localeDate, $config, $resource, $storeManager); $this->initTypeModels() @@ -625,6 +635,17 @@ protected function prepareCatalogInventory(array $productIds) $stockItemRow['stock_id'], $stockItemRow['stock_status_changed_auto'] ); + + if ($stockItemRow['use_config_max_sale_qty']) { + $stockItemRow['max_sale_qty'] = $this->stockConfiguration->getMaxSaleQty(); + } + if ($stockItemRow['use_config_min_sale_qty']) { + $stockItemRow['min_sale_qty'] = $this->stockConfiguration->getMinSaleQty(); + } + if ($stockItemRow['use_config_manage_stock']) { + $stockItemRow['manage_stock'] = $this->stockConfiguration->getManageStock(); + } + $stockItemRows[$productId] = $stockItemRow; } return $stockItemRows; @@ -755,7 +776,8 @@ private function getNonSystemAttributes(): array * @param array $customOptionsData * @param array $stockItemRows * @return void - * @deprecated 100.2.0 Logic will be moved to _getHeaderColumns in future release + * @deprecated 100.2.0 + * @see Logic is moved to _getHeaderColumns * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -1182,6 +1204,7 @@ protected function collectMultirawData() * @param int $storeId * @return bool * @deprecated 100.2.3 + * @see This protected method is not used anymore */ protected function hasMultiselectData($item, $storeId) { @@ -1410,6 +1433,7 @@ private function updateGalleryImageData(&$dataRow, $rawData) * Add multi row data to export * * @deprecated 100.1.0 + * @see This protected method is not used anymore * @param array $dataRow * @param array $multiRawData * @return array