@@ -1231,10 +1231,10 @@ protected function _saveProductEntity(array $entityRowsIn, array $entityRowsUp)
1231
1231
/**
1232
1232
* Prepare all media files
1233
1233
*
1234
- * @param $allImegesFromBunch
1234
+ * @param $allImagesFromBunch
1235
1235
* @return array
1236
1236
*/
1237
- protected function _prepareAllMediaFiles ($ allImegesFromBunch )
1237
+ protected function _prepareAllMediaFiles ($ allImagesFromBunch )
1238
1238
{
1239
1239
static $ productMediaGalleryTableName = null ;
1240
1240
static $ resource = null ;
@@ -1248,7 +1248,7 @@ protected function _prepareAllMediaFiles($allImegesFromBunch)
1248
1248
->from (
1249
1249
$ productMediaGalleryTableName ,
1250
1250
['entity_id ' , 'value ' ]
1251
- )->where ('value IN (?) ' , $ allImegesFromBunch )
1251
+ )->where ('value IN (?) ' , $ allImagesFromBunch )
1252
1252
);
1253
1253
return $ allMedia ;
1254
1254
}
@@ -1665,7 +1665,7 @@ protected function _uploadMediaFiles($fileName, $renameFileOff = false)
1665
1665
*/
1666
1666
protected function getMediaGalleryData ($ bunch )
1667
1667
{
1668
- $ allImegesFromBunch = [];
1668
+ $ allImagesFromBunch = [];
1669
1669
foreach ($ bunch as $ rowData ) {
1670
1670
foreach ($ this ->_imagesArrayKeysFromBunch as $ image ) {
1671
1671
$ dispersionPath =
@@ -1675,11 +1675,11 @@ protected function getMediaGalleryData($bunch)
1675
1675
$ imageSting = mb_strtolower (
1676
1676
$ dispersionPath . '/ ' . preg_replace ('/[^a-z0-9\._-]+/i ' , '' , $ importImage )
1677
1677
);
1678
- $ allImegesFromBunch [$ importImage ] = $ imageSting ;
1678
+ $ allImagesFromBunch [$ importImage ] = $ imageSting ;
1679
1679
}
1680
1680
}
1681
1681
}
1682
- $ existedImages = $ this ->_prepareAllMediaFiles ($ allImegesFromBunch );
1682
+ $ existedImages = $ this ->_prepareAllMediaFiles ($ allImagesFromBunch );
1683
1683
$ mediaGallery = [];
1684
1684
foreach ($ bunch as $ rowNum => $ rowData ) {
1685
1685
$ uploadedGalleryFiles = [];
@@ -1730,7 +1730,7 @@ protected function getMediaGalleryData($bunch)
1730
1730
$ imageIsSet = 0 ;
1731
1731
$ idIsSet = 0 ;
1732
1732
foreach ($ existedImages as $ currentImage ) {
1733
- if ($ currentImage ['value ' ] == $ allImegesFromBunch [$ mediaImage ]) {
1733
+ if ($ currentImage ['value ' ] == $ allImagesFromBunch [$ mediaImage ]) {
1734
1734
$ imageIsSet = 1 ;
1735
1735
if ($ currentImage ['entity_id ' ] == $ entityIdNewProduct ) {
1736
1736
$ idIsSet = 1 ;
@@ -1767,8 +1767,7 @@ protected function getMediaGalleryData($bunch)
1767
1767
}
1768
1768
}
1769
1769
if (!empty ($ rowData [self ::COL_MEDIA_IMAGE ]) && is_array ($ rowData [self ::COL_MEDIA_IMAGE ])) {
1770
- $ position = 0 ;
1771
-
1770
+ $ position = array_search ($ mediaImage , $ mediaGalleryImages );
1772
1771
foreach ($ rowData [self ::COL_MEDIA_IMAGE ] as $ media_image ) {
1773
1772
$ mediaGallery [$ rowSku ][] = [
1774
1773
'attribute_id ' => $ this ->getMediaGalleryAttributeId (),
0 commit comments