Try the Demo

Magento Forum

   
Page 4 of 4
Magento Import CSV / Image Does not exist! 
 
JC77
Jr. Member
 
Total Posts:  16
Joined:  2012-02-17
 

After I created an ‘import’ folder within the Magento media folder and moved all of the image folders and subfolders to it, I still get the “image does not exist” errors, however, upon going to the backend product pages, the product data was successfully imported and the images are there, but they are not “active” (i.e. on the back-end product pages, the radio buttons in the columns for the three image sizes are not ticked for any of the products (despite the fact that in the csv, image references were included in all three columns).

When I manually check the radio buttons to set the images as active, the images appear on the front end. Does anyone know what might be causing the images not to be marked as active when the associated products are uploaded? I’m using CE 1.7, Dataflow with a csv file imported from Google Spreadsheet to ensure it’s UTF-8 compatible.

 
Magento Community Magento Community
Magento Community
Magento Community
 
torontob
Jr. Member
 
Total Posts:  8
Joined:  2012-10-01
 

mathywow - The following instructions from you works just fine on version 1.7x - This snippet of the code should be submitted to become part of the trunk code. Thanks

mathywow - 22 May 2012 07: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
 
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 07: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 07: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.

 Signature 

Don’t optimize for the web - Optimize the web for you. I’m a developer at an Online Marketing Company -@MaximilianRuthe

 
Magento Community Magento Community
Magento Community
Magento Community
 
MobWeb
Jr. Member
 
Avatar
Total Posts:  17
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
 
tortora
Member
 
Total Posts:  34
Joined:  2011-06-22
 

We have an application that will allow you to easily upload product in minutes to your Magento site and fix the image issue as well.  If you’re interested email me at tortora@clarastream.com

Thanks,

Matt

 
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....

 Signature 

Sanitas / Comprar Colchon

 
Magento Community Magento Community
Magento Community
Magento Community
 
Juddder
Jr. Member
 
Avatar
Total Posts:  12
Joined:  2008-03-26
London
 
ruhelamin - 28 October 2012 11: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));
           
}
         }

 Signature 

Skywire | http://www.skywire.co.uk

 
Magento Community Magento Community
Magento Community
Magento Community
 
bkjain
Jr. Member
 
Total Posts:  9
Joined:  2012-10-11
 

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:  4
Joined:  2013-03-30
 
bkjain - 11 May 2013 02: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.

 Signature 

Jonathan

Henry Media
http://www.henrymedia.co.uk/support

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