[SOLVED] How to import imagesets?


Which step in the akeneo import should be handling image info import? abstract, concrete or both (both have image tab in them)? currently none are imported.
Where can we find example code on how to import images?
$dataSetStepBroker->addStep(new ProductImageHydratorStep());
doesn’t seem to work. Causing
The key “image_set_name” was not found in data set.


Hi Jan!

Which step in the akeneo import should be handling image info import? abstract, concrete or both (both have image tab in them)?

This depends on your data model, in Spryker you can assign it to both, all images are forwarded to Yves and one can decide, what to show.

Where can we find example code on how to import images?

Spryker needs only a URL to the image to show, you can find a writer step to be used here ProductImageWriterStep , what you will need is just to correctly transform URLs from data model in Akeneo into one expected by this step. The expected structure is flat and simple: check product_image.csv in your code base.

But probably you need something different, on the one hand Akeneo is not a CDN to host images by default, but is providing APIs to download them, on the other hand you probably need to have these images hosted on your webserver or on CDN. Downloading, processing or resizing of binary assets is not part of the integration and should be handled separately.

What you need is probably what Akeneo provides in enterprise edition https://docs.akeneo.com/latest/manipulate_pim_data/product_asset/index.html . This will allow to store images on S3 or SFTP server.

As a first step we would advise to define, how image files will be managed. This will define a data model in Akeneo (and if you need to download images from their servers and place locally), this will define the URL structure for these images and then you can accomplish the step above.


I’m not interested in akeneo S3/CDN philosophy. There are images on akeneo and I have their URLs. Thank you for writing about it but it’s not what I’ve been asking about. I have problems IMPORTING imagesets, not storing images.

class you pointed to: ProductImageWriterStep cannot be found in the spryker project (not in vendor, not in src) Where did you get that class from? (pointing to github code would be nice)


What about… https://github.com/spryker/demoshop/blob/master/src/Pyz/Zed/DataImport/Business/Model/ProductImage/ProductImageWriterStep.php


I don’t think this is what will work, the code also references IMAGE_SET_NAME at

and that key doesn’t exist in the dataset akeneo json file provides which will result in the same error the initial comment describes.

Also it seems the imagewriter is for just one image (which should be fine if we iterated over CSV of images, but we iterate over JSON of products) Hence I don’t know how to assemble and import an imageSET out of 8 array keys available in the JSON your code creates:

  string(94) "3/b/f/b/3bfb8ab4e6dba8b353a361df3157b7aff7998e9d_Product_Name_ABC_HRS_1.png"
  string(5) "Women"
  string(94) "a/8/c/c/a8cccd7e19cf71813284e4f4da248200700f3379_Product_Name_ABC_HRS_2.png"
  string(94) "0/9/9/b/099b7883fbda712844b1887e844a5713425c2afa_Product_Name_ABC_HRS_3.png"
  string(94) "7/9/e/9/79e9d010236dbf599ef1bff8ff219b4b193c8100_Product_Name_ABC_HRS_4.png"
  string(94) "9/2/a/3/92a3c16521a07e5a7642935e1c69eb2bb809657e_Product_Name_ABC_HRS_5.png"
  string(94) "b/b/9/a/bb9a542ca92f51a23b35bd0a1309bec9982b695b_Product_Name_ABC_HRS_6.png"

So back to the original question. How do we import those?


This https://github.com/spryker-shop/b2c-demo-shop/blob/master/src/Pyz/Zed/DataImport/Business/Model/ProductImage/ProductImageWriterStep.php#L27-L32 or https://github.com/spryker/demoshop/blob/master/src/Pyz/Zed/DataImport/Business/Model/ProductImage/ProductImageWriterStep.php#L24-L29 defines “columns” of the dataset, that can be imported. DataSetInterface is actually array-like object, so if simplified, you need to pass an array with keys above having values you need.

In the mapping process you can create an array of these arrays and in your writer step (or output stream depending where you write data to database), you can iterate through the array and pass each item to ProductImageWriterStep.php.

As for the missing image set, if it is does not exist in the source system it is possible to fill it in with a constant value in a translator stage. You can name it in any way you would like to, the ProductImageWriterStep.php should automatically create it.


Please also note, that in your code snippet above there are relative paths, so you will need to either add a domain during import or adjust templates to point to a correct domain, where images are hosted.


Thank you, for the time being I used the above code to create this step:

Note: suite doesn’t have this writer class. seems to rely on Hydrator classes only that’s why I couldn’t find it.