Import Mutiple Images in Magento


Posted on 20-Nov-2015


Import Mutiple Images in Magento

In this tutorial we will import multiple images for products through Dataflow Profiles of magento.


This is a very efficient and faster way of importing the images for products.

 

Step: 1

/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php

Make the copy of above file in your local pool

/app/code/local/Mage/Catalog/Model/Convert/Adapter/Product.php

 

Step: 2

Find the following code in approx. Line 774

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

 

Add the following code after it.

 

if (isset($importData['gallery']) && !empty($importData['gallery']))
        {
            $x = explode(';', $importData['gallery']);
            foreach ($x as $file) {
                $imagesToAdd[] = array('file' => trim($file));
            }

            $mediaGalleryBackendModel->addImagesWithDifferentMediaAttributes(
                $product,
                $imagesToAdd, Mage::getBaseDir('media') . DS . 'import',
                false,
                false
            );
        }

 

Step: 3

Upload all your image files thorough FTP at "media/import" folder.

Prepare your CSV in following format

 

 

Step: 4

And finally go to the "System > Import/Export > Dataflow - Profiles"

 

 

Select the "Import all products" profile from the list

 

 

Select the "Upload CSV" tab, select your file and finally click "Save and Continue" to upload the csv.

 

 

Go to the "Run Profile" tab, select find the CSV you uploaded (probably the last one) and click on "Run Profile in Popup"

 

 

This opens a new tab in browser and shows the status of the number of rows imported.

Finally refresh the cache of magento if needed.

 


Tags: Magento  Import Mutiple Images  Magento Developers  Magento Extension 

Still confused ? Let's talk. We are here to shape your ideas 24 x 7

CONTACT NOW