@@ -362,13 +362,6 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
362
362
*/
363
363
protected $ _imagesArrayKeys = ['_media_image ' , 'image ' , 'small_image ' , 'thumbnail ' ];
364
364
365
- /**
366
- * Column names that holds images files names from bunch
367
- *
368
- * @var string[]
369
- */
370
- protected $ _imagesArrayKeysFromBunch = ['base_image ' , 'small_image ' , 'thumbnail_image ' , 'additional_images ' ];
371
-
372
365
/**
373
366
* Permanent entity columns.
374
367
*
@@ -1330,9 +1323,9 @@ protected function _saveProducts()
1330
1323
$ this ->websitesCache [$ rowSku ] = [];
1331
1324
// 2. Product-to-Website phase
1332
1325
if (!empty ($ rowData [self ::COL_PRODUCT_WEBSITES ])) {
1333
- $ websiteIds = explode ($ this ->getMultipleValueSeparator (), $ rowData [self ::COL_PRODUCT_WEBSITES ]);
1334
- foreach ($ websiteIds as $ websiteId ) {
1335
- $ websiteId = $ this ->storeResolver ->getWebsiteCodeToId ($ rowData [ self :: COL_PRODUCT_WEBSITES ] );
1326
+ $ websiteCodes = explode ($ this ->getMultipleValueSeparator (), $ rowData [self ::COL_PRODUCT_WEBSITES ]);
1327
+ foreach ($ websiteCodes as $ websiteCode ) {
1328
+ $ websiteId = $ this ->storeResolver ->getWebsiteCodeToId ($ websiteCode );
1336
1329
$ this ->websitesCache [$ rowSku ][$ websiteId ] = true ;
1337
1330
}
1338
1331
}
@@ -1667,10 +1660,11 @@ protected function getMediaGalleryData($bunch)
1667
1660
{
1668
1661
$ allImagesFromBunch = [];
1669
1662
foreach ($ bunch as $ rowData ) {
1670
- foreach ($ this ->_imagesArrayKeysFromBunch as $ image ) {
1663
+ $ rowData = $ this ->_customFieldsMapping ($ rowData );
1664
+ foreach ($ this ->_imagesArrayKeys as $ image ) {
1671
1665
$ dispersionPath =
1672
1666
\Magento \Framework \File \Uploader::getDispretionPath ($ rowData [$ image ]);
1673
- $ importImages = explode (" , " , $ rowData [$ image ]);
1667
+ $ importImages = explode ($ this -> getMultipleValueSeparator () , $ rowData [$ image ]);
1674
1668
foreach ($ importImages as $ importImage ) {
1675
1669
$ imageSting = mb_strtolower (
1676
1670
$ dispersionPath . '/ ' . preg_replace ('/[^a-z0-9\._-]+/i ' , '' , $ importImage )
@@ -1768,13 +1762,13 @@ protected function getMediaGalleryData($bunch)
1768
1762
}
1769
1763
if (!empty ($ rowData [self ::COL_MEDIA_IMAGE ]) && is_array ($ rowData [self ::COL_MEDIA_IMAGE ])) {
1770
1764
$ position = array_search ($ mediaImage , $ mediaGalleryImages );
1771
- foreach ($ rowData [self ::COL_MEDIA_IMAGE ] as $ media_image ) {
1765
+ foreach ($ rowData [self ::COL_MEDIA_IMAGE ] as $ mediaImage ) {
1772
1766
$ mediaGallery [$ rowSku ][] = [
1773
1767
'attribute_id ' => $ this ->getMediaGalleryAttributeId (),
1774
1768
'label ' => isset ($ mediaGalleryLabels [$ position ]) ? $ mediaGalleryLabels [$ position ] : '' ,
1775
1769
'position ' => $ position ,
1776
1770
'disabled ' => '' ,
1777
- 'value ' => $ media_image ,
1771
+ 'value ' => $ mediaImage ,
1778
1772
];
1779
1773
}
1780
1774
}
0 commit comments