Magento Forum

   
Page 2 of 5
Poll
Were you able to import images into your Magento store via csv or XML
Yes 122
No 248
Total Votes: 370
You must be a logged-in member to vote
Image Import—Does It Work? 
 
Sousa
Guru
 
Avatar
Total Posts:  348
Joined:  2007-09-02
Porto, Portugal
 

hello,

im stuck on import images, i can’t import one image.
There is a tutorial anywhere?.
im driving nuts.

 
Magento Community Magento Community
Magento Community
Magento Community
 
dimid
Jr. Member
 
Total Posts:  11
Joined:  2008-08-08
 

i’m also having trouble importing images using url’s in the csv file.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sousa
Guru
 
Avatar
Total Posts:  348
Joined:  2007-09-02
Porto, Portugal
 

Hello,
I send a PM to Roy and i’m waiting for an answer.

I hope he help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
AndyM
Jr. Member
 
Total Posts:  23
Joined:  2008-11-06
 

I can only assume by previous posts that this was working and has recently been broken again in a later upgrade. I am pretty sure I have everything set up correctly.

Images in media/import

/filename.jpg in CSV

store tried as both admin and default

File permissions set to 777

 
Magento Community Magento Community
Magento Community
Magento Community
 
AndyM
Jr. Member
 
Total Posts:  23
Joined:  2008-11-06
 

OK turns out I had a typo in the filename of the product I chose to check, what are the chances!!

Anyway images are importing now but like a previous poster the exclude flag is being set. I read that adding a new view “fixes” this issue although I have not tried it but this seems more like a “workaround” than a fix

 
Magento Community Magento Community
Magento Community
Magento Community
 
Blackbart
Jr. Member
 
Total Posts:  3
Joined:  2009-02-10
 

This worked great… Thank you guys!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sousa
Guru
 
Avatar
Total Posts:  348
Joined:  2007-09-02
Porto, Portugal
 

This is solved the problem is the extension file .jpg.

if .JPG don’t work

 
Magento Community Magento Community
Magento Community
Magento Community
 
AJ Tarachanowicz
Jr. Member
 
Total Posts:  3
Joined:  2009-02-19
 

The reason why the images are set to ‘excluded’ is because at the very bottom of the saveRow() function in app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php there is a call to $product->addImageToMediaGallery(Mage::getBaseDir(’media’) . DS . ‘import’ . $file, $fields); The method addImageTOmediagallery*() by default has the exclude parameter set to true. I’d say that this is probably a bug an someone should file a bug report

 
Magento Community Magento Community
Magento Community
Magento Community
 
thE_iNviNciblE
Sr. Member
 
Avatar
Total Posts:  220
Joined:  2008-01-09
Oldenburg
 
Sousa - 19 February 2009 07:10 AM

This is solved the problem is the extension file .jpg.

if .JPG don’t work

oh this is really a nasty bug… thx for the solution !

this issue should be fixed it is also available in the 1.2.1.1 ....

 
Magento Community Magento Community
Magento Community
Magento Community
 
thE_iNviNciblE
Sr. Member
 
Avatar
Total Posts:  220
Joined:  2008-01-09
Oldenburg
 

Testshop
--------------
- setup a new Product in backend with an image…
- look at the frontend everytink is fine (base,thumb,small)
- export this item
- delete the test item
- import the test item (directly in a specific storeview)
- i can’t see in the backend the image unter the product view and in the database catalog_product_entity_media_gallery, catalog_product_entity_media_gallery_value are empty…
- in the frontend its also missing…

why ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sousa
Guru
 
Avatar
Total Posts:  348
Joined:  2007-09-02
Porto, Portugal
 

That one is hard! smile

I have to make some tests.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ben_marks
Moderator
 
Avatar
Total Posts:  449
Joined:  2008-10-09
Charleston, SC
 

Seems the issue with uppercase/capitalization is fixed.  If you have an older installation you can look at app/code/core/Mage/Media/Model/File/Image.php and change:

switch($object->getExtension()) {
to
switch(strtolower($object->getExtension())) {

I recommend overriding this or upgrading rather than changing in core, however.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mlfnet
Jr. Member
 
Total Posts:  1
Joined:  2009-03-23
 

OK, I got it…

FIRST, change this line in app\code\core\Mage\Catalog\Model\product.php

public function addImageToMediaGallery($file$mediaAttribute=null$move=false$exclude=false)

$exclude=true is what is normally says

SECOND, there seems to be a case sensitivity issue. All if you (and me) are running WAMP. I found that renaming the FILES to lowercase, it would import the images. The information in the XML file can be cAmEl case because of the lowercase conversion mentioned elsewhere. You can get http://www.albert.nu/default.asp?sub=programs/default.asp?sub=renamer/main.htm to do this fairly easily.

To recap, FIX Product.php (see above), change filenames to lowercase, put the files in magento\media\import, and put “/” at beginning filename in XML file.

 
Magento Community Magento Community
Magento Community
Magento Community
 
rickygri
Jr. Member
 
Total Posts:  22
Joined:  2009-01-17
 

I made a tutorial to help us with importing, hopefully someone here will find it of some use!

IMPORTING IMAGES IN MAGENTO USING CSV IMPORT

In Magento 1.2.0.2 (Step 3 might not be necessary for versions past this, but just in case)

1. Create a test product with all attributes that you would like to include for your product .csv .

2. Make sure all image files are lowercase (including .jpg)

3. In “app/code/core/Mage/Catalog/Model/product.php”, on (or near) line 759 change:

public function addImageToMediaGallery($file$mediaAttribute=null$move=false$exclude=true)

to:

public function addImageToMediaGallery($file$mediaAttribute=null$move=false$exclude=false)

4. Upload images to “media/import”

5. Go to: “System > Import/Export > Profiles” then click “export all products”. This will automatically output to “var/export”, so download the file from there.

6. Edit the exported .csv (I use Excel) by adding your products and attribute in the appropriate columns. Remember to put a / before the image names (as in /image1.jpg) otherwise Magento will ignore them.

7. In “System > Import/Export > Profiles”, click “Import All Products”, then click the “Upload File” tab on the left.

8. Upload your new edited .csv, then click “Save and Continue”.

9. Click the “Run Profile” tab on the left and select your .csv from the drop down list, then click “Run profile in Popup”.

10. Wait unitl the popup has finished (It will say ‘imported 1 records’ then a pause for a while before it says “Finished profile execution").

Done!

EDIT: Now including an example .csv - follow the tutorial and edit this csv according to these headers.

Example .csv -
Example .csv download

 
Magento Community Magento Community
Magento Community
Magento Community
 
vikshu
Member
 
Total Posts:  69
Joined:  2009-04-09
Noida
 
NickL - 11 April 2008 08:20 AM

Update: Success!

@Richard H. Thanks for the tip… that put me on the right path;

Until now, I had one store with one store view. Everytime I did an import, the images would be imported but always set to EXCLUDE. In my XML spreadsheet everything looked ok, the Store name was Set to “Admin’, all the attributes had columns, proper SKU, price, etc. Everything worked fine except the images were excluded (odd right?)

So, after reading Richard H’s post about the images NOT being excluded on other store views, I went and added another store view. Just for kicks. I dont need it, nor will I use it but I thought it might help. 

I then re-uploaded a test product, changed the STORE Column to “Default” instead of “Admin” (again just for kicks), and.. low and behold...it worked. The product and corresponding image was uploaded and it WAS NOT set to exclude. Everything worked fine.

So the question is still… whats the issue with Store Views and the conflict with Images?

Hi ,
I was able to upload 250 products and all went fine except that with images. I was able to upload the images too but they all are flagged as exclude which is thus not letting them be visible. I have two stores on my website but am not sure on which i uploaded it. Is there a way to find this out.  Please suggest where can i get them all un excluded at once. Please see the attached screenshot. I need to upload another 800 items so it wont be logical and feasible going over one by one un excluding them manually. :(
Thanks in advance

Image Attachments
20090624_105755.png
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 2 of 5