support

Updating/Inserting images (JPG, PNG ...) via CSV file

Started by castigous, June 07, 2017, 06:41:47 PM

Previous topic - Next topic

castigous

Hi!

Since I haven't had an answer to my topic since last friday --maybe because I added too many sub-topics to it in the late questions. I decided to post in separate topics.

I managed to read again the documentation (at http://docs.abantecart.com/pages/tools/import.html#Example4:insert) about importing and found out that I was missing a lot columns when trying to import the references for the images of each product.

Turns out that for each image there are about 8 columns needed to include in the CSV file.

resource_map[0].resource_id              = leave empty
resource_map[0].object_name            = products
resource_library[0][0].type_id            = 1
resource_descriptions[0][0][0].language_id      = 1  (the id of installed language)
resource_descriptions[0][0][0].name             =    anyname (usually imagefile name)
resource_descriptions[0][0][0].title            =    leave empty or fill if you need title
resource_descriptions[0][0][0].description      =    leave empty or fill if you need description for the resource
resource_descriptions[0][0][0].resource_path    =    somefolder/product_image_1.jpg

So I added the correct 40 columns --differing in their ([0][0][0]) numbering ([1][0][0], [2][0][0]... and so on) for up to 5 images max.

I split into 100-rows CSV files in order to avoid a Gateway error due to a big files with too much data, but even with this small file, when uploading the CSV file I got this error:

"
Total loaded: 6. Updated: 0. Created: 0. Errors: 6
There are some errors. Show details
Insert data error for products SQL Error: Duplicate entry '127' for key 'PRIMARY'
Error No: 1062
SQL: INSERT INTO `abc_products` SET `product_id` = '127'
Missing special relation ID product_id for insert action in table resource_map. Skipping.
Missing special relation ID product_id for insert action in table resource_map. Skipping.
Missing special relation ID product_id for insert action in table resource_map. Skipping.
Missing special relation ID product_id for insert action in table resource_map. Skipping.
Missing special relation ID product_id for insert action in table resource_map. Skipping.
"

I did these CSV files following the instructions on the documentation page which all required columns which are included so I don't know what's going on? Is this a bug at the import?

Please somebody help as I'mpretty stuck at the moment for this problem.

I attach sample of the CSV files.

Thanks!

castigous

#1
Here I attach the samples mentioned in the previous post.

I attach 2 almpst identical files, 1t-file with 'update' for the action column, 2nd-file with 'insert' for the action column --I tried both in case that for images AC needed to insert instead of update.

Please somebody help

Thanks!


abantecart

#3
Where do you get resource_map[0] from?

If you insert or update resource library directly (not together with product or category) you do not need to include array count \[0\], etc.

It should look like this:
resource_library.resource_id resource_library.type_id resource_library.date_added

Best way to see the columns is to try export first.
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

castigous

#4
Hi!

Thanks for your answer. I get 2 resource_map[0] variables from the documention link I mentioned (at http://docs.abantecart.com/pages/tools/import.html#Example4:insert) where mentions:

resource_map[0].resource_id              = leave empty
resource_map[0].object_name            = products


In that page indicates that for each image there are 8 needed variables (this 2 included) along with othere 6 variables and 5 more for each additional language --BTW can the 2nd language variables be left alone? I mean what happens if I leave them alone?

The thing with exported files is that they have a-whole-lot of columns so is difficult to know which one(s) are the needed ones to fill and/or modify. Also difficult is that since at import there could be a lot errors for not including some column so I´ve been forced to import CSV with ALL the columns even if I mean to insert or update just 2 columns.

Thank you very much for your response! I'll take a look at your attachment to figure things out more clearly.

sanjay210

Do you have any alternative solution for this. If any one have then please suggest.
Thanks

Basara

Quote from: sanjay210 on June 23, 2025, 03:12:11 AM
Do you have any alternative solution for this. If any one have then please suggest.
Thanks
Have you tried using the Import Wizard format? It might help simplify the process
https://abantecart.atlassian.net/wiki/spaces/AD/pages/16777227/Import+Wizard#Products-import-example

Forum Rules Code of conduct
AbanteCart.com 2010 -