Skip to content

Commit 7bf2a59

Browse files
MC-31594: Duplicate SKU in the backend while importing products via CSV
1 parent 41626ab commit 7bf2a59

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
307307
// Can't add new translated strings in patch release
308308
'invalidLayoutUpdate' => 'Invalid format.',
309309
'insufficientPermissions' => 'Invalid format.',
310-
ValidatorInterface::ERROR_SKU_MARGINAL_WHITESPACES => 'SKU contains marginal whitespaces'
311310
];
312311
//@codingStandardsIgnoreEnd
313312

app/code/Magento/CatalogImportExport/Model/Import/Product/RowValidatorInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ interface RowValidatorInterface extends \Magento\Framework\Validator\ValidatorIn
8787

8888
const ERROR_DUPLICATE_MULTISELECT_VALUES = 'duplicatedMultiselectValues';
8989

90-
const ERROR_SKU_MARGINAL_WHITESPACES = 'skuMarginalWhitespaces';
91-
9290
/**
9391
* Value that means all entities (e.g. websites, groups etc.)
9492
*/

app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*/
1818
class Validator extends AbstractValidator implements RowValidatorInterface
1919
{
20+
private const ERROR_SKU_MARGINAL_WHITESPACES = "Sku contains marginal whitespaces";
21+
2022
/**
2123
* @var RowValidatorInterface[]|AbstractValidator[]
2224
*/
@@ -75,7 +77,7 @@ protected function textValidation($attrCode, $type)
7577
} elseif ($attrCode == Product::COL_SKU) {
7678
$valid = $this->string->strlen($val) <= SKU::SKU_MAX_LENGTH;
7779
if ($this->string->strlen($val) !== $this->string->strlen(trim($val))) {
78-
$this->_addMessages([RowValidatorInterface::ERROR_SKU_MARGINAL_WHITESPACES]);
80+
$this->_addMessages([self::ERROR_SKU_MARGINAL_WHITESPACES]);
7981
return false;
8082
}
8183
} else {

0 commit comments

Comments
 (0)