Image export flow
Product images are only getting exported trough the ‘Magento image export’ export profiles. Not trough the ‘Magento export’ profiles. Unlike the product data that is getting processed by Magento’s queue, image creation is done trough separate API calls before sending data to the queue. This means that the products must first be created or exist in Magento before we can add images.
The following message will be shown when you want to push image data for products that are not available in Magento: Skipping the following image(s) exports. The product with sku %s wasn't available yet in Magento.
This could mean two things:
- The product is not available in Magento because we never exported it.
- Magento’s operation queue is still importing and creating products from the previous ‘Magento export’ profile. In this case wait for the previous job to be completed first.
Why image mappings and names are important
Because we want each image to be created only once it’s important to know which image is already available in Magento’s product gallery while we’re exporting. For this we add an image mapping for each image that is getting created. In this mapping we use the Akeneo’s image filename as code and Magento’s internal media id. The linked id in this mapping is the reference to the product.
If the connector does not find any related mapping it checks the Magento’s product image gallery for images with the same name. When we find an image with the same name we’ll abort image creation and add this image to the mapping. We only use Magento’s internal media id for further image processing. In this case we relink them trough the queue instead of creating images new ones.
Image name formatting
If you take a look at the configuration documentation page you’ll find the setting ‘reformat_image_name’. This setting allows you to choose between two different ways on how image names must be stored in Magento. If this setting is disabled the following name formatting will be used:
We do this because Magento image names are limited on 90 characters when creating trough API. It’s also important that the image names are always unique.
If this setting is active we create the image name the following way:
This name is also unique, but has no limitation in length and can be a problem.
It’s possible to create your own image role attributes and link them to the gallery. You do this by configuring the image attribute code the following way.
First add the image to the ‘image attributes’ configuration. This causes an image to be added to the gallery. Then add the same image attribute code to the ‘attributes codes’ configuration. By doing this, a new image role will be created in Magento. This role will also get linked to the correct image.
It’s also possible to link an image to an already existing Magento image role. Therefore we need to add the attribute code to the ab mapping.
If you want to disable specific images in Magento’s product gallery, you can do this by adding the ‘disable_images’ setting to your oro config table. All attribute codes in this comma separated list will get exported with the disabled flag. Check the ‘tab 1 - configuration’ page for more information.
Configuration EE assets
Just like normal product images (image attributes) also EE assets attributes can be exported. Before doing this it’s important to configure the ‘asset_attribute’ database configuration setting. See reference configuration manual for more information.
Image gallery position
You can control the image gallery positions by changing your image attributes configuration sort order. For example. Let’s assume we have the following attributes available.
image_1, image_2, image_3 asset_collection_1
and we put this in our export configuration: image_3,asset_collection_1,image_1,image_2
In this case image_3 will come fist in the gallery, then all asset collection images with their own sort order and then image_1 & 2.
Be aware that image positioning is something completely different then image roles. Positioning is being used in your image gallery on Magento’s frontend. Roles are being used to determine which image must be used as the thumbnail image, main image, etc..