Magento import products with images

26,731

Solution 1

I ftp'd the images into media/import and then in the actual CSV file, the image was /image.jpg.

Here is an example of my working import CSV file. I wrote a php script to hash the database which fed our then catalog and assemble the below output. It did take lots of trial and error to get it working. Do a mysqldump before you try importing so you can blow away mistakes with restores.

"sku"|"price"|"special_price"|"brand"|"weight"|"cost"|"name"|"section"|"description"|"short_description"|"make"|"fitment"|"product_name"|"store"|"websites"|"attribute_set"|"type"|"has_options"|"gift_message_available"|"custom_design"|"options_container"|"image_label"|"small_image_label"|"thumbnail_label"|"page_layout"|"meta_keyword"|"custom_layout_update"|"manufacturer"|"color"|"status"|"tax_class_id"|"visibility"|"enable_googlecheckout"|"is_recurring"|"is_imported"|"special_to_date"|"custom_design_from"|"custom_design_to"|"news_from_date"|"news_to_date"|"qty"|"min_qty"|"use_config_min_qty"|"is_qty_decimal"|"backorders"|"use_config_backorders"|"min_sale_qty"|"use_config_min_sale_qty"|"max_sale_qty"|"use_config_max_sale_qty"|"is_in_stock"|"low_stock_date"|"notify_stock_qty"|"use_config_notify_stock_qty"|"manage_stock"|"use_config_manage_stock"|"stock_status_changed_automatically"|"use_config_qty_increments"|"qty_increments"|"use_config_enable_qty_increments"|"enable_qty_increments"|"store_id"|"product_type_id"|"product_status_changed"|"product_changed_websites"|"material"|"category_ids"|"image"|"small_image"|"thumbnail"
"TEE BLACK LONG LG"|"28.41"|"25.00"|""|"0.60"|"12.15"|"Ca Cycleworks Lg black cotton longsleeve logo t-shirt Cycleworks Brand Gear!!"|""|"Ca Cycleworks Lg black cotton longsleeve logo t-shirt Cycleworks Brand Gear!! for Ducati Everyone"|" Ducati Everyone"|""|""|"Ca Cycleworks Lg black cotton longsleeve logo t-shirt Cycleworks Brand Gear!!"|"admin"|"base"|"Other Accessories"|"simple"|"0"|"Use config"|""|"Block after Info Column"|""|""|""|"No layout updates"|""|""|""|""|"Enabled"|"None"|"Catalog, Search"|"Yes"|"No"|"Yes"|""|""|""|""|""|"1.0000"|"0.0000"|"1"|"0"|"0"|"1"|"1.0000"|"1"|"0.0000"|"1"|"1"|""|""|"1"|"0"|"1"|"0"|"1"|"0.0000"|"1"|"0"|"0"|"simple"|""|""|""|"36"|"/tee.jpg"|"/tee_sm.jpg"|"/tee_th.jpg"
"LANYARD"|"2.27"|"2.00"|""|"0.05"|"1.05"|"Ca Cycleworks Cycleworks lanyard Cycleworks Brand Gear!!"|""|"Ca Cycleworks Cycleworks lanyard Cycleworks Brand Gear!! for Ducati Everyone"|" Ducati Everyone"|""|""|"Ca Cycleworks Cycleworks lanyard Cycleworks Brand Gear!!"|"admin"|"base"|"Other Accessories"|"simple"|"0"|"Use config"|""|"Block after Info Column"|""|""|""|"No layout updates"|""|""|""|""|"Enabled"|"None"|"Catalog, Search"|"Yes"|"No"|"Yes"|""|""|""|""|""|"1.0000"|"0.0000"|"1"|"0"|"0"|"1"|"1.0000"|"1"|"0.0000"|"1"|"1"|""|""|"1"|"0"|"1"|"0"|"1"|"0.0000"|"1"|"0"|"0"|"simple"|""|""|""|"36"|"/"|"/_sm"|"/_th"
"PVC TAPE"|"13.64"|"12.00"|""|"0.50"|"1.05"|"Ca Cycleworks White pvc duck tape - all 4 panes - 2in x 110yds Cycleworks Brand Gear!!"|""|"Ca Cycleworks White pvc duck tape - all 4 panes - 2in x 110yds Cycleworks Brand Gear!! for Ducati Everyone"|" Ducati Everyone"|""|""|"Ca Cycleworks White pvc duck tape - all 4 panes - 2in x 110yds Cycleworks Brand Gear!!"|"admin"|"base"|"Other Accessories"|"simple"|"0"|"Use config"|""|"Block after Info Column"|""|""|""|"No layout updates"|""|""|""|""|"Enabled"|"None"|"Catalog, Search"|"Yes"|"No"|"Yes"|""|""|""|""|""|"1.0000"|"0.0000"|"1"|"0"|"0"|"1"|"1.0000"|"1"|"0.0000"|"1"|"1"|""|""|"1"|"0"|"1"|"0"|"1"|"0.0000"|"1"|"0"|"0"|"simple"|""|""|""|"36"|"/ductape.jpg"|"/ductape_sm.jpg"|"/ductape_th.jpg"

Solution 2

For those who bored with endless bugs of Magento's out of box Dataflow profiles and considers paid solutions: check this one. With it you simply avoid 99% popular errors raising during importing products with images:

-- no BOM character problem (as it's going to happen through online CSV editor)

-- no "wrong paths" problems (you can set the path where to pick up images in settings, if the image is missing - the log will inform you immediately)

-- no "multiple images" problem: you can import small_image, thumbnail, image fields along with "media_gallery" field containing multiple paths separated by semicolon.

Also, it can EXPORT, so if something goes wrong and you can't figure out what happened - just create your product manually, upload image manually via magento admin, and then just EXPORT this products. It will populate the CSV with proper paths to the images, it will also copy all the required images into the folder that you set in settings as "Media folder". So you can import them back without taking care if the images are in correct folders.

I know most people are looking for free stuff, but if you spent already dozen hours struggling with Dataflow to achieve a simple task of bulk assigning images to the products - I bet you understand what I'm talking about :)

Share:
26,731
Yanick Rochon
Author by

Yanick Rochon

#SOreadytohelp Humans are not efficient. Not because we are not smart, or not able to, but because we do not strive toward the same goals. Because we set ourselves rules to ultimately prevent collaborative efforts. Because we envy power and praise fame. Diversity and collaborative efforts (i.e. not directed) will always bring higher and better results than any set of rules; where everyone can benefit from the work of others, freely. The key here is common sense. Because efforts are wasted, unless they can benefit the collective and not one self. This is not communism nor socialism, as there are rights of property, as credits go where they belong. This is merely simple wisdom.

Updated on March 30, 2020

Comments

  • Yanick Rochon
    Yanick Rochon about 4 years

    I have tried all afternoon to import some products in Magento, but all without any success. After trial and errors it all came down an "Image does not exist" error. I have read a few posts about it, most of them outdated, but then a recent one talks about putting everything in /media/import and having all files named like /image.png in the CSV file.

    It does not work and I still get the same error.

    I'm using Magento 1.6.2 and I have tried putting the files in

    /var/import/image.png
    /var/import/i/m/image.png 
    /media/import/image.png
    /media/import/i/m/image.png
    /media/catalog/product/i/m/image.png
    

    I have tried to name the file in the CSV as

    /image.png
    /1/m/image.png
    /media/import/image.png
    /media/import/i/m/image.png
    

    ...and a bunch of combination of them all (not exactly sure which ones as I used a random approach at first, trying what the forums suggested, but without any luck). I have tried to located the piece of PHP code where the image file is checked, but failed... again.

    So, what folder does the importer looks for the file anyway? What is the way of doing this? There are a lot of people with the same problem and it does not seem to be any official solution for this. Any help appreciated.

  • Yanick Rochon
    Yanick Rochon about 12 years
    yes, as it turned out, I had custom required "image" field with a string like n/a and cause the error. I had to trace down the message all the way to the model helper... anyway. the image base directory is indeed /media/import and the image files, in the CSV have to have the / prepended alright.
  • Yanick Rochon
    Yanick Rochon over 10 years
    Yes, I had seen this plugin back then. Unfortunately, in my case, this was for a complete custom import system and I had to implement an ETL. It's hell slow, but I managed to make it work with "native Magento API"... ~45 minutes for 400 items... yes, "Holy crap!" heh
  • Alex Shchur
    Alex Shchur over 10 years
    Man, you should try MAGMI, seriously. Just google "MAGMI API" - it's about couple "include" statements 2 strings of code. If you tie it to your ETL script, it's gonna work pretty similar way but MUCH faster.