Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 4 of 4
Magento Import CSV / Image Does not exist! 
 
nossa_lossa
Jr. Member
 
Total Posts:  14
Joined:  2012-10-11
 

Here you can see the requirements for proper csv formatting and even download the exemple file to see what is it right.
Good written. It help me to cancel problems with images.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hattonjewellers
Jr. Member
 
Total Posts:  1
Joined:  2012-09-16
 
mathywow - 22 May 2012 06:07 AM

Managed to make a simple hack that allows you to add multiple images with the Data Flow import. If there’s any better way I couldn’t find it.

The end result is having to add a column ‘media_gallery’ in the .csv file, where you would write all the files you want added for the product in the following format : ‘/image1.jpg, /image2.jpg’, etc.
These images go like the rest in the /media/import folder.

This .cvs file you would then proceed to upload and run with the standard DataFlow Products Import profile. I should also say that I have only tested this on Magento 1.7, and that it’s recommended to create a module that overrides the core file and not hack it.

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,
            
$arrayToMassAddMage::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,
                
$imagesToAddMage::getBaseDir('media') . DS 'import',
                
false,
                
false
            
);
        
}

Excellent, this worked for me on 1.7 smile Thanks very much to mathywow.

Although I have no idea how you create a module that overrides the core file instead of hacking it… any guidance here please? new to magento and don’t know much about programming either, and i’m guessing when it’s time to update, the core file will be overwritten :( would the media images be lost in this case?

 
Magento Community Magento Community
Magento Community
Magento Community
 
ruhelamin
Jr. Member
 
Total Posts:  1
Joined:  2012-06-29
 

Hi, the solution by mathywow worked for me, thanks a lot. Although i have noticed 1 issue, which is, if something changes for a product and you update the csv and then re-import the csv for the second time (using dataflow method of course), the images are being duplicated and all the images you had imported the first time are now showing up twice in the images tab when you click into the product in magento admin. Is there any fix for this mathywow?

mathywow - 22 May 2012 06:07 AM

Managed to make a simple hack that allows you to add multiple images with the Data Flow import. If there’s any better way I couldn’t find it.

The end result is having to add a column ‘media_gallery’ in the .csv file, where you would write all the files you want added for the product in the following format : ‘/image1.jpg, /image2.jpg’, etc.
These images go like the rest in the /media/import folder.

This .cvs file you would then proceed to upload and run with the standard DataFlow Products Import profile. I should also say that I have only tested this on Magento 1.7, and that it’s recommended to create a module that overrides the core file and not hack it.

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,
            
$arrayToMassAddMage::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,
                
$imagesToAddMage::getBaseDir('media') . DS 'import',
                
false,
                
false
            
);
        
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
lebron6
Jr. Member
 
Total Posts:  1
Joined:  2011-08-02
 

hi,in magento 1.7.0.2
first:csv -> /test.jpg
second:media/import/test.jpg
ok

 
Magento Community Magento Community
Magento Community
Magento Community
 
MaximilianR
Jr. Member
 
Avatar
Total Posts:  8
Joined:  2010-08-31
 

I apologize if this method has already been brought up and disregarded, but I wouldn\’t find any reason why it should. Importing multiple images is fairly easy with a free extension call Magmi, which I use now on Magento 1.7 and have been using since 1.6. I posted a tutorial on importing multiple images in Magento and you can download Magmi at sourcforge. I\’ll say it\’s relatively easy and does not require any core file coding - hope this helps someone.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MobWeb
Jr. Member
 
Avatar
Total Posts:  23
Joined:  2011-09-01
 

After wasting countless hours I finally figured out why importing the images didn’t work for me on 1.6.2.0: The CSV file didn’t include the “gallery” column, only the three image columns. So if it doesn’t work for you, check if you have included that column as well, like so:

"gallery","thumbnail","small_image","image"
 
Magento Community Magento Community
Magento Community
Magento Community
 
Karpin
Jr. Member
 
Total Posts:  11
Joined:  2013-01-17
 

Great!!! I was just suffering the same problem and I search on Google and find this answer....

 
Magento Community Magento Community
Magento Community
Magento Community
 
Juddder
Jr. Member
 
Avatar
Total Posts:  16
Joined:  2008-03-26
London
 
ruhelamin - 28 October 2012 10:43 AM

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,
                
$imagesToAddMage::getBaseDir('media') . DS 'import',
                
false,
                
false
            
);
        
}

This was causing problems on Magento 1.7.0.x so I’ve shortened the replacement loop to simply add images to the gallery - works fine for me here

if (isset($importData['media_gallery']) && !empty($importData['media_gallery'])) {
           $x 
explode(','$importData['media_gallery']);
           foreach (
$x as $file{
              $mediaGalleryBackendModel
->addImage($product,  Mage::getBaseDir('media') . DS 'import' trim($file));
           
}
         }
 
Magento Community Magento Community
Magento Community
Magento Community
 
bkjain
Jr. Member
 
Total Posts:  14
Joined:  2012-10-10
 

have solved the problem very simply in 1.7.0.2 version.

Copy images with the exact names to folder:
/media/import/ (all the folder copy here from media/catlog)

Use System->Dataflow profiles for Import/Export for best results and OpenOffice for editing CSV files.

 
Magento Community Magento Community
Magento Community
Magento Community
 
henrymedia_uk
Jr. Member
 
Total Posts:  5
Joined:  2013-03-30
 
bkjain - 11 May 2013 01:13 AM

have solved the problem very simply in 1.7.0.2 version.

Copy images with the exact names to folder:
/media/import/ (all the folder copy here from media/catlog)


Use System->Dataflow profiles for Import/Export for best results and OpenOffice for editing CSV files.

Magento 1.7.0.2

This solution works… Make sure the .CSV file is in UTF-8 coding.

 
Magento Community Magento Community
Magento Community
Magento Community
 
exormedia
Jr. Member
 
Total Posts:  1
Joined:  2013-03-08
 
henrymedia_uk - 13 May 2013 07:46 AM

bkjain - 11 May 2013 01:13 AM
have solved the problem very simply in 1.7.0.2 version.

Copy images with the exact names to folder:
/media/import/ (all the folder copy here from media/catlog)


Use System->Dataflow profiles for Import/Export for best results and OpenOffice for editing CSV files.

Magento 1.7.0.2

This solution works… Make sure the .CSV file is in UTF-8 coding.

I tried this in version 1.7.0.2 but cant get it to work…

I added the snippet of code to the product.php file.
My import spreadsheet column name is “media_gallery”.
My import spreadsheet is in csv utf-8 coding.
My images have been placed in the /media/import and /media/catalog folders.

Can anyone think of what I might be doing wrong?

 
Magento Community Magento Community
Magento Community
Magento Community
 
pschmidt
Jr. Member
 
Total Posts:  6
Joined:  2008-09-25
 

This poses a lot of issues for a lot of people.

The solution has been written in this forum, but maybe not as clearly as could be.

The directions here:  http://www.magentocommerce.com/knowledge-base/entry/importing-product-images

Solved this for me.

 
Magento Community Magento Community
Magento Community
Magento Community
 
GoodKaarma
Member
 
Total Posts:  31
Joined:  2009-09-05
Estonia
 

Create a folder inside your media directory called “import”.
Upload your images via ftp to your new import folder.
If images are loose inside import folder, then use the path /imagename.jpg (or whatever name & type) in your csv.
If you have lots of images and need to organize them, create sub-folders inside the import folder, then in your csv include the subfolder name too, e.g. /widgets/imagename.jpg. Either way, always include the leading forward slash.
In your csv’s 3 image columns (image, small_image and thumbnail), use the same path, Magento will resize for you.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 4 of 4