Perch API - Importing products and images

  • Hello,


    Is it possible to import the images from a product with PerchShopProductImporter instead of the AssetImporter?

    The JSON data is as follows (with multiple images in the array per product):


    Code
    1. {
    2. "data": [
    3. {
    4. "images": [
    5. "http://www.domain.nl/uploads/product/image.jpg"
    6. ],
    7. }
    8. ]
    9. }
  • You'll need to use both importers. First you'll need to import the images to assets, then assign then product fields with the appropriate assets. This is a short snippet of how we approached the issue for blog posts. We had all the images stored in a local directory, so you will need to configure as appropriate.



    As you have multiple images are you looking to import the images into a repeater field? If so, as far as I'm aware, the importer doesn't support this.

  • Byron, thank you for this example, it helped me a lot!


    Yes I had a repeater field for the product images, because not all products have the same amount of images. But I could make individual image fields in my template, like image1, image2 etc. to work around it.