|
38 | 38 | * @SuppressWarnings(PHPMD.TooManyFields) |
39 | 39 | * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) |
40 | 40 | * @SuppressWarnings(PHPMD.CouplingBetweenObjects) |
| 41 | + * @SuppressWarnings(PHPMD.ExcessivePublicCount) |
41 | 42 | * @since 100.0.2 |
42 | 43 | */ |
43 | 44 | class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity |
@@ -1508,6 +1509,7 @@ public function getImagesFromRow(array $rowData) |
1508 | 1509 | * @SuppressWarnings(PHPMD.ExcessiveMethodLength) |
1509 | 1510 | * @SuppressWarnings(PHPMD.UnusedLocalVariable) |
1510 | 1511 | * @throws LocalizedException |
| 1512 | + * phpcs:disable Generic.Metrics.NestingLevel |
1511 | 1513 | */ |
1512 | 1514 | protected function _saveProducts() |
1513 | 1515 | { |
@@ -2487,6 +2489,12 @@ public function validateRow(array $rowData, $rowNum) |
2487 | 2489 | */ |
2488 | 2490 | private function isNeedToValidateUrlKey($rowData) |
2489 | 2491 | { |
| 2492 | + if (!empty($rowData[self::COL_SKU]) && empty($rowData[self::URL_KEY]) |
| 2493 | + && $this->getBehavior() === Import::BEHAVIOR_APPEND |
| 2494 | + && $this->isSkuExist($rowData[self::COL_SKU])) { |
| 2495 | + return false; |
| 2496 | + } |
| 2497 | + |
2490 | 2498 | return (!empty($rowData[self::URL_KEY]) || !empty($rowData[self::COL_NAME])) |
2491 | 2499 | && (empty($rowData[self::COL_VISIBILITY]) |
2492 | 2500 | || $rowData[self::COL_VISIBILITY] |
@@ -2810,7 +2818,8 @@ protected function getUrlKey($rowData) |
2810 | 2818 | return trim(strtolower($urlKey)); |
2811 | 2819 | } |
2812 | 2820 |
|
2813 | | - if (!empty($rowData[self::COL_NAME])) { |
| 2821 | + if (!empty($rowData[self::COL_NAME]) |
| 2822 | + && (array_key_exists(self::URL_KEY, $rowData) || !$this->isSkuExist($rowData[self::COL_SKU]))) { |
2814 | 2823 | return $this->productUrl->formatUrlKey($rowData[self::COL_NAME]); |
2815 | 2824 | } |
2816 | 2825 |
|
|
0 commit comments