Importing products & product images

Discussion in 'Customization & add-ons' started by baker, Nov 19, 2019.

  1. baker

    baker New Member

    Joined:
    Aug 29, 2006
    Messages:
    19
    I've got a large number of products I want to add into aMember. I currently have the information in an Excel spreadsheet.

    I'm looking at importing the data using phpMyAdmin. I'm going to pull it into my local database, test and then update the live server.

    If I'm missing anything or there is a better way to do this please let me know.

    Here are the databases I believe I need to update:
    • am_product
    • am_billing_plan
    • am_resource_category
    • am_product_product-category

    custom fields are done in
    • am_data

    and files associated with products going into
    • am_file
    • am_resource_resource_category

    I've been able to get this to work in my tests. However, what I do have a problem with is the product images. There are the four images that are in am_product. I'd really like to avoid doing this manually. It's easy for me to batch and make all the images in the sizes I need and I can save them into the correct folders and upload, but how can I make image names that amember will accept?
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    There is four columns in table am_product
    img_path
    img_detail_path
    img_cart_path
    img_orig_path

    It should be path to file relative to amember/data/public folder.

    Here is one example of data in this field for single product record:

    cart/200_200/5d1b38d207d96.png
    cart/400_400/5d1b38d207d96.png
    cart/50_50/5d1b38d207d96.jpeg
    cart/orig/5d1b38d207d96.png

    Exact name does not matter. We use folder structure with folder with name as image size but it is not required too.

    The next part is link your original image to product so when you edit product amember do not reset these columns img_* :

    You need to:
    1. add record to table am_upload
    2. set upload_id from this table to field img in table am_product
    3. upload file to folder amember/data (file name must start from .product-img-cart.)

    You can upload one file from admin interface and then check last record in table am_upload
    to get example of record data.

Share This Page