Skip to content

Commit a5fd649

Browse files
Dmitry KologrivovA-Komar
authored andcommitted
MAGNIMEX-145: Fix labels for skipped images
1 parent 166beac commit a5fd649

File tree

1 file changed

+8
-9
lines changed
  • app/code/Magento/CatalogImportExport/Model/Import

1 file changed

+8
-9
lines changed

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,10 +1231,10 @@ protected function _saveProductEntity(array $entityRowsIn, array $entityRowsUp)
12311231
/**
12321232
* Prepare all media files
12331233
*
1234-
* @param $allImegesFromBunch
1234+
* @param $allImagesFromBunch
12351235
* @return array
12361236
*/
1237-
protected function _prepareAllMediaFiles($allImegesFromBunch)
1237+
protected function _prepareAllMediaFiles($allImagesFromBunch)
12381238
{
12391239
static $productMediaGalleryTableName = null;
12401240
static $resource = null;
@@ -1248,7 +1248,7 @@ protected function _prepareAllMediaFiles($allImegesFromBunch)
12481248
->from(
12491249
$productMediaGalleryTableName,
12501250
['entity_id', 'value']
1251-
)->where('value IN (?)', $allImegesFromBunch)
1251+
)->where('value IN (?)', $allImagesFromBunch)
12521252
);
12531253
return $allMedia;
12541254
}
@@ -1665,7 +1665,7 @@ protected function _uploadMediaFiles($fileName, $renameFileOff = false)
16651665
*/
16661666
protected function getMediaGalleryData($bunch)
16671667
{
1668-
$allImegesFromBunch = [];
1668+
$allImagesFromBunch = [];
16691669
foreach ($bunch as $rowData) {
16701670
foreach ($this->_imagesArrayKeysFromBunch as $image) {
16711671
$dispersionPath =
@@ -1675,11 +1675,11 @@ protected function getMediaGalleryData($bunch)
16751675
$imageSting = mb_strtolower(
16761676
$dispersionPath . '/' . preg_replace('/[^a-z0-9\._-]+/i', '', $importImage)
16771677
);
1678-
$allImegesFromBunch[$importImage] = $imageSting;
1678+
$allImagesFromBunch[$importImage] = $imageSting;
16791679
}
16801680
}
16811681
}
1682-
$existedImages = $this->_prepareAllMediaFiles($allImegesFromBunch);
1682+
$existedImages = $this->_prepareAllMediaFiles($allImagesFromBunch);
16831683
$mediaGallery = [];
16841684
foreach ($bunch as $rowNum => $rowData) {
16851685
$uploadedGalleryFiles = [];
@@ -1730,7 +1730,7 @@ protected function getMediaGalleryData($bunch)
17301730
$imageIsSet = 0;
17311731
$idIsSet = 0;
17321732
foreach ($existedImages as $currentImage) {
1733-
if ($currentImage['value'] == $allImegesFromBunch[$mediaImage]) {
1733+
if ($currentImage['value'] == $allImagesFromBunch[$mediaImage]) {
17341734
$imageIsSet = 1;
17351735
if ($currentImage['entity_id'] == $entityIdNewProduct) {
17361736
$idIsSet = 1;
@@ -1767,8 +1767,7 @@ protected function getMediaGalleryData($bunch)
17671767
}
17681768
}
17691769
if (!empty($rowData[self::COL_MEDIA_IMAGE]) && is_array($rowData[self::COL_MEDIA_IMAGE])) {
1770-
$position = 0;
1771-
1770+
$position = array_search($mediaImage, $mediaGalleryImages);
17721771
foreach ($rowData[self::COL_MEDIA_IMAGE] as $media_image) {
17731772
$mediaGallery[$rowSku][] = [
17741773
'attribute_id' => $this->getMediaGalleryAttributeId(),

0 commit comments

Comments
 (0)