Skip to content

Commit e211bb9

Browse files
committed
Merge branch 'MAGNIMEX-319-Update-products' into 'master'
Magnimex 319 update products See merge request !160
2 parents c3fdb71 + c8b348a commit e211bb9

File tree

1 file changed

+10
-4
lines changed
  • app/code/Magento/CatalogImportExport/Model/Import

1 file changed

+10
-4
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,13 +1374,19 @@ protected function _saveProducts()
13741374
$dispersionPath =
13751375
\Magento\Framework\File\Uploader::getDispretionPath($rowData[self::COL_MEDIA_IMAGE]);
13761376
$imageName = preg_replace('/[^a-z0-9\._-]+/i', '', $rowData[self::COL_MEDIA_IMAGE]);
1377-
$fullDispersionPath = $dispersionPath . '/' . $imageName;
1377+
$fullDispersionPath = strtolower($dispersionPath . '/' . $imageName);
13781378
foreach ($this->cachedImages as $image) {
13791379
if (($image['sku'] == $rowData[self::COL_SKU])
1380-
&& (preg_replace('/_[0-9]+/', '', $image['value']) == $fullDispersionPath)
1380+
&& ($image['value'] == $fullDispersionPath)
13811381
) {
13821382
$imageInProductIsSet = true;
1383-
$imageFromProduct = preg_replace('/_[0-9]+/', '', $image['value']);
1383+
$imageFromProduct = $image['value'];
1384+
break;
1385+
} elseif (($image['sku'] == $rowData[self::COL_SKU])
1386+
&& (preg_replace('/_[0-9]?\./', '.', $image['value']) == $fullDispersionPath)
1387+
) {
1388+
$imageInProductIsSet = true;
1389+
$imageFromProduct = preg_replace('/_[0-9]?\./', '.', $image['value']);
13841390
break;
13851391
} elseif (in_array($fullDispersionPath, $image)) {
13861392
$imageIsSet = true;
@@ -1775,7 +1781,7 @@ protected function _getUploader()
17751781
* @param string $fileName
17761782
* @return string
17771783
*/
1778-
protected function _uploadMediaFiles($fileName, $renameFileOff=false)
1784+
protected function _uploadMediaFiles($fileName, $renameFileOff = false)
17791785
{
17801786
try {
17811787
$res = $this->_getUploader()->move($fileName, $renameFileOff);

0 commit comments

Comments
 (0)