Magento import multiple images in dataflow csv/xml

Sometimes it’s really annoying that Magento only supports one image per product. On the Magento Commerce forum a solution is found:

Now, what you need to do is open the file
app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php
and go to around line 773 and find

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

and paste the following code right after it
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
);
}

Source: http://www.magentocommerce.com/boards/viewthread/224928/P45/

One thought on “Magento import multiple images in dataflow csv/xml”

  1. Hi, i have done this, but my media gallery images is beeing imported with the “exclude” box ticked, any advise for this?

Leave a Reply

Your email address will not be published. Required fields are marked *