Magento add Multiple images to products

Magento add Multiple images to products programmatically

First Go to appcodecoreMageCatalogModelConvertAdapterProduct.php

Open Product.php file and find this Code

<?php 
   $addedFilesCorrespondence = $mediaGalleryBackendModel->addImagesWithDifferentMediaAttributes(
         $product,$arrayToMassAdd, Mage::getBaseDir('media') . DS . 'import',false,false);
 
?>

After this put this code in File

<?php

if (isset($importData['media_gallery']) && !empty($importData['media_gallery'])) {
    $x = explode(';', $importData['media_gallery']);
    foreach ($x as $file) {
       $imagesToAdd[] = array('file' =>; trim($file));
    }
 
$mediaGalleryBackendModel->addImagesWithDifferentMediaAttributes(
     $product,$imagesToAdd, Mage::getBaseDir('media') . DS . 'import',false,false);
}

Now open your Product’s csv file and add column named “media_gallery”

and then add images comma (‘,’) seprated like below

e.g : /s/e/second_image.png, /t/h/third_image.png,/f/o/fourth_image.png