Skip to content

Commit 7df4e12

Browse files
Improved logic of getUrlKey to be more specific around the name provided but no URL Key scenario
1 parent e48683c commit 7df4e12

File tree

1 file changed

+5
-7
lines changed
  • app/code/Magento/CatalogImportExport/Model/Import

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2733,14 +2733,12 @@ protected function getUrlKey($rowData)
27332733
}
27342734

27352735
/**
2736-
* If the product already exists, do not overwrite its
2737-
* URL Key with a value generated from the provided name.
2736+
* If the product exists, assume it already has a URL Key and even
2737+
* if a name is provided in the import data, it should not be used
2738+
* to overwrite that existing URL Key the product already has.
27382739
*/
2739-
if ($this->isSkuExist($rowData[self::COL_SKU])) {
2740-
return '';
2741-
}
2742-
2743-
if (!empty($rowData[self::COL_NAME])) {
2740+
$isSkuExist = $this->isSkuExist($rowData[self::COL_SKU]);
2741+
if (!$isSkuExist && !empty($rowData[self::COL_NAME])) {
27442742
return $this->productUrl->formatUrlKey($rowData[self::COL_NAME]);
27452743
}
27462744

0 commit comments

Comments
 (0)