Author Topic: Updating/Inserting images (JPG, PNG ...) via CSV file  (Read 4248 times)

Offline castigous

  • Newbie
  • *
  • Posts: 44
  • Karma: +3/-0
    • View Profile
Updating/Inserting images (JPG, PNG ...) via CSV file
« on: June 07, 2017, 06:41:47 PM »
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!
« Last Edit: June 13, 2017, 05:22:26 PM by castigous »

Offline castigous

  • Newbie
  • *
  • Posts: 44
  • Karma: +3/-0
    • View Profile
Re: Updating/Inserting images (JPG, PNG ...) via CSV file
« Reply #1 on: June 07, 2017, 06:48:00 PM »
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!
« Last Edit: June 13, 2017, 05:30:00 PM by castigous »

Offline castigous

  • Newbie
  • *
  • Posts: 44
  • Karma: +3/-0
    • View Profile
Re: Updating/Inserting images (JPG, PNG ...) via CSV file
« Reply #2 on: June 13, 2017, 05:30:23 PM »
BUMP!

Please Help!!

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Updating/Inserting images (JPG, PNG ...) via CSV file
« Reply #3 on: June 13, 2017, 10:24:46 PM »
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:
Code: [Select]
resource_library.resource_id resource_library.type_id resource_library.date_added
Best way to see the columns is to try export first.
« Last Edit: June 13, 2017, 10:27:14 PM by abantecart »
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

Offline castigous

  • Newbie
  • *
  • Posts: 44
  • Karma: +3/-0
    • View Profile
Re: Updating/Inserting images (JPG, PNG ...) via CSV file
« Reply #4 on: June 14, 2017, 09:36:38 AM »
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.
« Last Edit: June 14, 2017, 09:51:05 AM by castigous »

 

Powered by SMFPacks Social Login Mod