@@ -1373,13 +1373,19 @@ protected function _saveProducts()
1373
1373
$ dispersionPath =
1374
1374
\Magento \Framework \File \Uploader::getDispretionPath ($ rowData [self ::COL_MEDIA_IMAGE ]);
1375
1375
$ imageName = preg_replace ('/[^a-z0-9\._-]+/i ' , '' , $ rowData [self ::COL_MEDIA_IMAGE ]);
1376
- $ fullDispersionPath = $ dispersionPath . '/ ' . $ imageName ;
1376
+ $ fullDispersionPath = strtolower ( $ dispersionPath . '/ ' . $ imageName) ;
1377
1377
foreach ($ this ->cachedImages as $ image ) {
1378
1378
if (($ image ['sku ' ] == $ rowData [self ::COL_SKU ])
1379
- && (preg_replace ( ' /_[0-9]+/ ' , '' , $ image ['value ' ]) == $ fullDispersionPath )
1379
+ && ($ image ['value ' ] == $ fullDispersionPath )
1380
1380
) {
1381
1381
$ imageInProductIsSet = true ;
1382
- $ imageFromProduct = preg_replace ('/_[0-9]+/ ' , '' , $ image ['value ' ]);
1382
+ $ imageFromProduct = $ image ['value ' ];
1383
+ break ;
1384
+ } elseif (($ image ['sku ' ] == $ rowData [self ::COL_SKU ])
1385
+ && (preg_replace ('/_[0-9]?\./ ' , '. ' , $ image ['value ' ]) == $ fullDispersionPath )
1386
+ ) {
1387
+ $ imageInProductIsSet = true ;
1388
+ $ imageFromProduct = preg_replace ('/_[0-9]?\./ ' , '. ' , $ image ['value ' ]);
1383
1389
break ;
1384
1390
} elseif (in_array ($ fullDispersionPath , $ image )) {
1385
1391
$ imageIsSet = true ;
@@ -1772,7 +1778,7 @@ protected function _getUploader()
1772
1778
* @param string $fileName
1773
1779
* @return string
1774
1780
*/
1775
- protected function _uploadMediaFiles ($ fileName , $ renameFileOff= false )
1781
+ protected function _uploadMediaFiles ($ fileName , $ renameFileOff = false )
1776
1782
{
1777
1783
try {
1778
1784
$ res = $ this ->_getUploader ()->move ($ fileName , $ renameFileOff );
0 commit comments