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/
Hi, i have done this, but my media gallery images is beeing imported with the “exclude” box ticked, any advise for this?
Thx for your post.
My fixed version for media_gallery separated images by “;”
if (isset($importData[‘media_gallery’]) && !empty($importData[‘media_gallery’])) {
$x = explode(‘;’, $importData[‘media_gallery’]);
foreach ($x as $file) {
$imagesToAdd[] = array(‘file’ => trim($file));
}
$this->_galleryBackendModel->addImagesWithDifferentMediaAttributes(
$product,
$imagesToAdd, Mage::getBaseDir(‘media’) . DS . ‘import’,
false,
false
);
}