From 5de15c302cc1028ac565fb6da34e96a7f96dfbe1 Mon Sep 17 00:00:00 2001 From: Maikel Koek Date: Tue, 29 Aug 2023 12:22:00 +0200 Subject: [PATCH] fix(TEN-661): use strtolower when searching existing skus _oldSkus is filled with lowercase skus, so we have to use strtolower. See \Magento\CatalogImportExport\Model\Import\Product\SkuProcessor::_getSkus --- src/Rewrite/ImportExport/Import/Product.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Rewrite/ImportExport/Import/Product.php b/src/Rewrite/ImportExport/Import/Product.php index c406255..91487d9 100644 --- a/src/Rewrite/ImportExport/Import/Product.php +++ b/src/Rewrite/ImportExport/Import/Product.php @@ -505,7 +505,7 @@ protected function _saveProducts() $rowData = $productTypeModel->prepareAttributesWithDefaultValueForSave( $rowData, - !isset($this->_oldSku[$rowSku]) + !isset($this->_oldSku[strtolower($rowSku)]) ); $product = $this->_proxyProdFactory->create(['data' => $rowData]); @@ -551,7 +551,7 @@ protected function _saveProducts() } elseif (self::SCOPE_STORE == $attribute->getIsGlobal()) { $storeIds = [$rowStore]; } - if (!isset($this->_oldSku[$rowSku])) { + if (!isset($this->_oldSku[strtolower($rowSku)])) { $storeIds[] = 0; } } @@ -597,7 +597,7 @@ protected function _saveProducts() public function skipUpdatingAttribute($rowSku, $attrCode) { - return isset($this->_oldSku[$rowSku]) && \array_key_exists(self::SKIP_ATTRIBUTES_WHEN_UPDATING, $this->_parameters) && \array_key_exists($attrCode, $this->_parameters[self::SKIP_ATTRIBUTES_WHEN_UPDATING]); + return isset($this->_oldSku[strtolower($rowSku)]) && \array_key_exists(self::SKIP_ATTRIBUTES_WHEN_UPDATING, $this->_parameters) && \array_key_exists($attrCode, $this->_parameters[self::SKIP_ATTRIBUTES_WHEN_UPDATING]); } /** @@ -637,7 +637,7 @@ public function validateRow(array $rowData, $rowNum) $rowScope = $this->getRowScope($rowData); // BEHAVIOR_DELETE use specific validation logic if (Import::BEHAVIOR_DELETE == $this->getBehavior()) { - if (self::SCOPE_DEFAULT == $rowScope && !isset($this->_oldSku[$rowData[self::COL_SKU]])) { + if (self::SCOPE_DEFAULT == $rowScope && !isset($this->_oldSku[strtolower($rowData[self::COL_SKU])])) { $this->addRowError(ValidatorInterface::ERROR_SKU_NOT_FOUND_FOR_DELETE, $rowNum); return false; }