Product images

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:

{first-79-characters-of-image-name}_{first-4-characters-of-akeneo-sha1}.{extension}

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:

{sku}.{sku}.{attribute_code}.{full_image_name}.{extension}

This name is also unique, but has no limitation in length and can be a problem.

Image roles

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.

Export types

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.

Export types

Disabling images

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.

todo