Filtering and mapping PIM images and assets

Summary

The Akeneo - Image & Asset Configs page within the Custom Preference settings allows you to configure and manage various image and asset settings, such as image resizing, quality, and asset storage options, ensuring optimal handling and display of media files throughout your product information management system.

Asset and images

Akeneo PIM has 2 ways to store images for your products.

Either with several Image attributes or by using the Asset collection attribute that points to one or more images from the Assets management feature of your PIM Enterprise Edition (using image files or image URLs).

The SFCC Akeneo connector can retrieve images from the Image attributes, the Asset Collection attributes, or both. This is managed by Akeneo Image Import Type (akeneoImageImportType). If ‘both’ is selected, Media links are managed using product custom Attributes in SFCC.

 

When you set the Akeneo Image Import Type to 'both', only image files will be displayed as product images in Salesforce, and the media links will be stored in the product custom attribute Akeneo Product Assets Attributes Data (akeneoProductAssetsAttributesData)

 

Select the image type

Select wether you need to import images attribute or assets or both.

Connector parameter PIM information
akeneo Image Type
  •  Select the type of media data to import
    • Images - if you only want to sync your images binaries. The image paths for product will be retrieved from the attributes ‘picture’, ’image’, etc
    • Assets
    • Both

Locale specific images

Natively, SFCC does not support locale specific image links. This is handled by the connector by appending view-type with locale (e.g.: large_en-US, swatch_fr-FR etc). This must be handled in storefront logic by the developer.

 

 

Select the Asset Import type

In the connector configuration page, you need to select Assets for the following parameter to retrieve images from the "asset collection" attributes.

Connector parameter PIM information
Akeneo Image Import Type (akeneoImageImportType)
  • Image Media File only (media_file) - Only for New Asset System Users. In this mode image binaries will be linked to products.  Default value.
  • Image Media Link only (media_link) - the image links will be linked to products using SFCC’s external Image Management system. If there are locale specific image links for different locales, they will be imported for the various view-types by appending view-type with locale (e.g.: large_en-US, swatch_fr-FR etc). 
  • Both: image links will be imported and stored as JSON in product custom attribute Akeneo Product Assets Attributes Data (akeneoProductAssetsAttributesData), with a key matching the following pattern
akeneo_<camelizedAssetCode>_<camelizedAssetAttributeCode>
 

Natively, SFCC does not support locale specific image links. This is handled by the connector by appending view-type with locale (e.g.: large_en-US, swatch_fr-FR etc). This must be handled in storefront logic by the developer.

External image location 

 Define the base URL to use for every media. This will refer to your DAM or CDN base URL.

Connector parameter Content
External Image Location  URL to use for every media

 

 

Akeneo PIM allows 2 levels of localization and scope-management: at the asset attribute level and at the product attribute level. SFCC connector will read the locale and scope values from asset attributes. Because SFCC doesn't manage both level, the product attributes of the type pim_catalog_asset_collection must be non-localizable and non-scopable.

 

The order of images defined in the "Asset Collection" attribute is respected when the connector imports images in SFCC.

 

PIM asset images are imported into the "Images" section of SFCC products. In addition, an SFCC attribute is created for each "Asset Collection" PIM attribute to store image IDs and define the asset order.

 

If you already have implemented the 20.2.X cartridge for your images assets (with the asset manager model), please note that the asset attributes of the assets assigned to your product are imported into the product custom attribute Akeneo Product Assets Attributes Data (akeneoProductAssetsAttributesData). This product custom attribute is of JSON type. It can be accessed via product.custom.akeneoProductAssetsAttributesData and parsed on the backend to send the desired asset attributes to the frontend.

 

If you use images URLs: All images must be hosted with the same provider and the base URL for that provider should be filled in External Image Location (akeneoExternalImageLocation) configuration.

 

Filter the assets

Filtering assets streamlines the asset import process by allowing users to select specific asset families and assets for import, thereby saving time and ensuring that only relevant assets are imported to SFCC.

Asset family Filter configuration

 Asset family filtering allows users to specify which asset families and assets to import. This config is an array of objects comprised of asset_family_code and asset_codes attributes.  

Connector parameter Content
Asset Family Filter Config  A subset of Akeneo Asset Family codes and Asset codes

JSON Format example

[
{
"asset_family_code": "model_pictures",
"asset_codes": ["allie_jean_model_picture", "amy_socks_model_picture", "alice_blouse_model_picture"]
}, 
{
"asset_family_code": "product_videos",
"asset_codes": ["sku_54628_video1", "d25133k_promo"]
}
]

 

To import an entire asset family along with all its associated assets without the need to specify each asset name individually, please use the following format:  

[
    {
        "asset_family_code": "model_pictures",
        "asset_codes": []
    }
]

This approach streamlines the process by allowing you to efficiently manage and import a comprehensive set of assets under asset families, ensuring consistency and saving time.  

 

 
 

 

Enable asset family filtering

Connector parameter Content
Enable Asset Family Filtering (akeneoEnableAssetFamilyFiltering) -

Enable (Yes) or disable (No) asset family filtering  

Remove downloaded assets on full mode

Connector parameter Content
Remove Downloaded Assets On Full Mode

Remove (Yes) or keep (No) previously downloaded assets during asset imports on full mode 

Remove downloaded media on full mode

Connector parameter Content
Remove Downloaded Media On Full Mode (akeneoRemoveDownloadedMediaOnFullImport)

Remove (Yes) or keep (No) previously downloaded media during media imports on full mode

Include Non-Media Asset Attributes

Connector parameter Content
Include Non-Media Asset Attributes (akeneoIncludeNonMediaAssetAttributes) Include (Yes) or exclude (No) non-media type asset attributes when writing akeneoProductAssetsAttributesData for products

Metadata mapping

Configuration to associate an Akeneo attribute with a salesforce's image attributes, like ‘alt’ and ‘title’

Connector parameter Content
Asset Image Metadata Mapping Akeneo attribute code mapping with Salesforce image attribute

JSON format expected

{
"matching": {
"alt": "akeneo_asset_attribute"
 }
}

 

 
 

View type mapping

In the connector configuration page, you can specify the SFCC master catalog image view types and map your Akeneo image files and links onto these image view types on SFCC.

Declare view type 

Declare the Image view type in SFCC.

Connector parameter Content
   

JSON format expected for view types

 

{
                "view-types": [
                                 "large",
                     "medium",
                     "small"
  ]
     }

 

 
 

 

Mapping between SFCC master catalog view types and Akeneo image links. Specify which Akeneo image link type asset attribute is associated with which salesforce's image view-type like ‘large’ and ‘swatch’.

SFCC view type Akeneo Image Link Attribute Code
Image view type like ‘large’ and ‘swatch’ Asset attribute code for the image link.

JSON format expected

 {
  "matching": {
    "large": "image_media_link",
    "medium": "medialink2",
    "small": "medialink3",
    "thumbnail": "medialink_for_thumbnail"
  }
}

This field must be in JSON. Here is an example of "Akeneo Image View Types" you can use for your connector.

 
 

 

asset family attributes and view types

Since 24.2.0, we can map multiple asset family attributes(in an array) to the same SFCC viewType with versions v24.2.0 and later.

 

 

Image File View-Types Mapping

Mapping between SFCC master catalog view types and Akeneo image files. Specify which Akeneo image file type asset attribute is associated with which salesforce's image view-type like ‘large’ and ‘swatch’.

SFCC view type Akeneo Image Link Attribute Code
Image view type like ‘large’ and ‘swatch’ Asset attribute code for the image file.

JSON format expected

{
  "matching": {
    "medium": "media_file_1",
    "small": "media_file_2",
  }
}

 

 
 

 

Akeneo Image view types

List of Image View types of the relevant master catalog in SFCC.

JSON format expected

{
"view-types": [
"large",
"medium",
"small",
"swatch"
]
}

 

 
 

 

How to define which PIM attribute is a variant value for product images?

Since the 20.2.0 connector version, you do not have to set this information manually. This is automatically triggered and even more, you now are able to use many attributes on both axis instead of one.

 

How can I retrieve media from the "Asset Collection" attributes?

Please note that since Akeneo Connector for SFCC version 20.3.0, we have slightly changed the way to manage media (and then images): in order to not be constrained by the SharedLibraries limits anymore, we have changed the way to store the media information: you will have the PIM asset collection and its content described as a SFCC custom product attribute.

  1. your asset collection will be created as a SFCC custom attribute (whatever the media is a link or a file) 
  2. The related information is stored as an index array (the sorting of the media in the PIM is maintained into this index order). By searching the ID in the product attribute, you will find the related media information.
  3. in our exemple akeneo_amAssetCollectionLinkAndBinScopable is equal to ["asset1_vdo_ytb_en"]. That means: there is only one asset in the asset collection and this asset has asset1_vdo_ytb_en for ID. If you search for the camelized version of the asset ID (E.g: asset1VdoYtbEn) in the 'Akeneo Product Assets Attributes Data' custom attribute of the product, you will find the data related to the attributes of this asset, such as:
If the asset is a MEDIA LINK If the asset is a MEDIA FILE
The URL of your media the static path to reach your file.
i.e: https://www.youtube.com/watch?v=X5P9sEcFaKc i.e: Assets/my_file/f/0/d/2/myDoc.pdf?$staticlink$

Please note then for your frontend development that the number and the place in the Array list of IDs is fundamental to define the way to pick the right information.

 

Due to the PIM API way to work, the deletion information is not explicitly sent to the connector, then if you delete an asset, please check the ID Array first for your frontend to "know" what information to gather from product, because information will not be deleted from the product attribute itself.

 

If you have already implemented the 20.2.X cartridge for your image assets (using the asset manager model), please note that for versions between 20.2.X and 24.2.1, the frontend will access the information by adding product.custom. before your akeneo_myVar. However, with version 24.2.1, a new feature has been introduced that gathers all asset attribute-related information into the akeneoProductAssetsAttributesData of the product. This data is accessible through product.custom.akeneoProductAssetsAttributesData and can be JSON parsed to retrieve the asset attributes relevant to the product.

 

Compatible videos

Exactly the same that the PIM do: Youtube or Vimeo videos links only.

Compatible files

You have to know that the "files" can be either "PDF" or "Other". The main difference is related to the PIM thumbnail generation. Anyway for the files (PDF & Other) you are able to use URL or binaries. If you choose other as media type, you will be able to manage any kind of media (please consider that bigger is the file, longer the processing time will be).

Even if you can upload video files by using "Other", please consider That

  1. the PIM is not a CDN nor a DAM
  2. the upload processing time can be extremely long, depending the size of your files.

We don't recommend storing media at the PIM level (unless you have very few files). For performance reasons, we strongly recommend that you use a DAM associated with a CDN (or equivalent) to store your media so that the connector synchronization only transfers URL-type information in SFCC.

 

Storefront customization

Custom implementation is required to use the PDF, video and  filetype assets linked to product custom attributes. For example, to use the attribute ‘description’ of the asset "pdf_file_2", access the akeneoProductAssetsAttributesData custom attribute of the product using product.custom.akeneoProductAssetsAttributesData. Then, JSON parse it to retrieve the value of the object key akeneo_pdfFile2_description.
Asset media files are stored in HTML type attributes and end with ?$staticlink$ which when used in storefront will generate a dynamic URL.

 

 

Asset deletion

 The deletion of an asset is tracked within the product attributes of the "pim_catalog_asset_collection" type. This attribute manages a list of assets associated with the product, and when one of these assets is deleted, the deletion is recorded within the attribute of type "pim_catalog_asset_collection"

A screenshot of a computer

Description automatically generated