Skip to content

Commit 01c2298

Browse files
committed
MAGNIMEX-145: change behavior for image existing in other product
1 parent 0917f29 commit 01c2298

File tree

1 file changed

+11
-14
lines changed
  • app/code/Magento/CatalogImportExport/Model/Import

1 file changed

+11
-14
lines changed

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

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,21 +1472,18 @@ protected function _saveProducts()
14721472
];
14731473
}
14741474
}
1475-
} else {
1476-
foreach ($this->_imagesArrayKeys as $imageCol) {
1477-
if (!empty($rowData[$imageCol]) && ($rowData[$imageCol] == $imagePath)) {
1478-
$rowData[$imageCol] = '';
1479-
}
1480-
}
14811475
}
1482-
if (!isset($existingImages[$imagePath]) || in_array($rowSku, $existingImages[$imagePath])) {
1483-
foreach ($this->_imagesArrayKeys as $imageCol) {
1484-
if (!empty($rowData[$imageCol])
1485-
&& ($imageCol != self::COL_MEDIA_IMAGE)
1486-
&& isset($uploadedGalleryFiles[$rowData[$imageCol]])
1487-
) {
1488-
$rowData[$imageCol] = $uploadedGalleryFiles[$rowData[$imageCol]];
1489-
}
1476+
foreach ($this->_imagesArrayKeys as $imageCol) {
1477+
if (empty($rowData[$imageCol]) || ($imageCol == self::COL_MEDIA_IMAGE)) {
1478+
continue;
1479+
}
1480+
if (isset($existingImages[$imagePath])
1481+
&& !in_array($rowSku, $existingImages[$imagePath])
1482+
&& (($rowData[$imageCol] == $imagePath) || ($rowData[$imageCol] == $mediaImage))
1483+
) {
1484+
unset($rowData[$imageCol]);
1485+
} elseif (isset($uploadedGalleryFiles[$rowData[$imageCol]])) {
1486+
$rowData[$imageCol] = $uploadedGalleryFiles[$rowData[$imageCol]];
14901487
}
14911488
}
14921489
}

0 commit comments

Comments
 (0)