|
10 | 10 |
|
11 | 11 | use Magento\Framework\App\Filesystem\DirectoryList;
|
12 | 12 | use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as ValidatorInterface;
|
13 |
| -use Magento\Framework\File\Uploader; |
14 | 13 | use Magento\Framework\Model\Resource\Db\TransactionManagerInterface;
|
15 | 14 | use Magento\Framework\Model\Resource\Db\ObjectRelationProcessor;
|
16 | 15 | use Magento\Framework\Stdlib\DateTime;
|
@@ -1354,23 +1353,23 @@ protected function _saveProducts()
|
1354 | 1353 | }
|
1355 | 1354 |
|
1356 | 1355 | // 5. Media gallery phase
|
1357 |
| - $dispertionPath = Uploader::getDispretionPath($rowData[self::COL_MEDIA_IMAGE]); |
| 1356 | + $dispertionPath = \Magento\Framework\File\Uploader::getDispretionPath($rowData[self::COL_MEDIA_IMAGE]); |
1358 | 1357 | $imageName = preg_replace('/[^a-z0-9\._-]+/i','', $rowData[self::COL_MEDIA_IMAGE]);
|
1359 | 1358 | $fullDispertionPath = $dispertionPath.'/'.$imageName;
|
1360 | 1359 | $imageIsSet = null;
|
1361 | 1360 | $imageFromProduct = null;
|
1362 | 1361 | $imageInProductIsSet = null;
|
1363 |
| - foreach($this->cachedImages as $image) { |
1364 |
| - if($image['sku'] == $rowData[self::COL_SKU] && preg_replace('/_[0-9]+/','', $image['value']) == $fullDispertionPath) { |
| 1362 | + foreach ($this->cachedImages as $image) { |
| 1363 | + if ($image['sku'] == $rowData[self::COL_SKU] && preg_replace('/_[0-9]+/', '', $image['value']) == $fullDispertionPath) { |
1365 | 1364 | $imageInProductIsSet = true;
|
1366 |
| - $imageFromProduct = preg_replace('/_[0-9]+/','', $image['value']); |
| 1365 | + $imageFromProduct = preg_replace('/_[0-9]+/', '', $image['value']); |
1367 | 1366 | break;
|
1368 |
| - } elseif(in_array($fullDispertionPath, $image)) { |
| 1367 | + } elseif (in_array($fullDispertionPath, $image)) { |
1369 | 1368 | $imageIsSet = true;
|
1370 | 1369 | break;
|
1371 | 1370 | }
|
1372 | 1371 | }
|
1373 |
| - if( ($imageInProductIsSet && $imageFromProduct != $fullDispertionPath) || (!isset($imageIsSet) && !isset($imageInProductIsSet)) ) { |
| 1372 | + if (($imageInProductIsSet && $imageFromProduct != $fullDispertionPath) || (!isset($imageIsSet) && !isset($imageInProductIsSet))) { |
1374 | 1373 | $mediaGalleryImages = array();
|
1375 | 1374 | $mediaGalleryLabels = array();
|
1376 | 1375 | if (!empty($rowData[self::COL_MEDIA_IMAGE])) {
|
@@ -1419,7 +1418,7 @@ protected function _saveProducts()
|
1419 | 1418 | ];
|
1420 | 1419 | }
|
1421 | 1420 | }
|
1422 |
| - } elseif($imageInProductIsSet && $imageFromProduct == $fullDispertionPath) { |
| 1421 | + } elseif ($imageInProductIsSet && $imageFromProduct == $fullDispertionPath) { |
1423 | 1422 | $mediaGalleryImages = array();
|
1424 | 1423 | $mediaGalleryLabels = array();
|
1425 | 1424 | if (!empty($rowData[self::COL_MEDIA_IMAGE])) {
|
|
0 commit comments