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