Author Topic: What is relation between products and resources - specifically product images?  (Read 4249 times)

Offline Rob Grattan

  • Newbie
  • *
  • Posts: 13
  • Karma: +3/-0
    • View Profile
Hi,

Have got my site uploaded with products in the right categories etc.

Now I want to upload 1300+ product image files and 'link' them to their respective products.  Have had a look in the various 'resource_...' tables but can't see how the resource_id relates to a specific product.

I don't want to ftp the images and then select them one at a time for each product.

I can use MySQL, php etc. to code it, but can't see how they relate to each other.

Or am I looking at this all wrong?

Thanks for any help,

Rob


Offline Rob Grattan

  • Newbie
  • *
  • Posts: 13
  • Karma: +3/-0
    • View Profile
Hi, Basara,

Thanks for the quick reply.

The thing is, I've already populated the products, product_descriptions etc. etc. tables, so can't use the import a csv method.

Looking at the 'insert_product_with_images' csv file, I still can't see how the resource_descriptions etc. tables relate to the products etc. tables.  Is there an ERD (or part of it) that would show me how they relate?  I've got all the categories, sub-categories all working perfectly - it's just the images!

Or will I need to go through the whole creating, mapping and uploading a csv file?

Thanks again.

Rob

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5791
  • Karma: +274/-2
    • View Profile
Hello.
Add few images to products in admin then export in System > Data > Export. Select resource_library, resource_descriptions, products_to_stores and others data you need.
Exported CSV file give you an example

Offline Rob Grattan

  • Newbie
  • *
  • Posts: 13
  • Karma: +3/-0
    • View Profile
Hi, Basara,

Once again, thank you for your reply.

I have looked at the CSV files method a few times and I just cant figure out how they work!  Maybe I'm getting too old for this...

What I have done is FTP'd my product images into the same folder as the other product images.

With a bit of PHP I then created an entry in the 'resource_library' table - one row for each file that I uploaded.

I then created, using the 'resource_id' from the 'resource_library' table, an entry for each product file in the 'resource_descriptions' table with file names and paths.

Then I thought that all I have to do then is to update the 'resource_map' table with my 'object_id's and 'resource_id's.  However, If I try to manually add an image to a product, the files I FTP'd don't appear.

Why can't I see the files that I've FTP'd?

So frustrating...

Thanks again for your help and patience.

Rob

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5791
  • Karma: +274/-2
    • View Profile
Hello.
1. put your images to resources/image/folder_in_resource_directory
2. please use attached TAB delimeted CSV file as example how to update products (add resource image to products)
3. In CSV file double check you set a valid products id (first column) and the path to image file (last column).
4. When import make sure to select the correct delimeter!


« Last Edit: May 14, 2020, 01:55:56 AM by Basara »

Offline Rob Grattan

  • Newbie
  • *
  • Posts: 13
  • Karma: +3/-0
    • View Profile
Thank you SO much, Basara!  :D

This looks a lot clearer.  I can write a bit of code to create the CSV file and upload them all at once.

Will let you know how I get on.

Rob

Offline Rob Grattan

  • Newbie
  • *
  • Posts: 13
  • Karma: +3/-0
    • View Profile
Hi, Basar,

I thought I was doing so well!

Where do I find the page below, please.  On the Import Wizaed page it doesn't say 'Load' as yours does.

It also wants me to 'Select destination table'.  However, we're supposed to be uploading into a number of tables e.g. products, product_to_stores etc. etc.

If I don't select a table I get "No import destination table or fields selected".  If I select 'products' it tells me 'Missing required data field product_descriptions.name for destination table!'

Am I in completely the wrong place?

Thanks,
Rob

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5791
  • Karma: +274/-2
    • View Profile
Hello.
Import in System > Data > Import/Export. Select the file and double check you select the correct CSV delimiter. If file structure is invalid or you select the wrong delimiter it will fail, otherwise the products table will be automatically selected

 

Powered by SMFPacks Social Login Mod