Template

GS1 require the rendering of XML Documents that it can read. In order to facilitate this correctly, we created a GS1 Template manager where you can link a family, upload an Twig document that describes how that XML is build, link your GS1 account.

img

We use a Symfony Twig engine to generate these kinds of Documents as it provides the most flexibility combined with good performance. You can use provide the template XML in 2 different options.

Option A : By extension

We include a versioned twig document inside the connector containing all the information for building the correct XML document. This document can be extended by another but smaller document that we provide. That document contains all the information or context the versioned twig document needs in order to build the XML correctly.

Notice the include 'cin_message_1_0.xml.twig'

{#
    gdsnTradeItemClassification list defines all Product Data related items
#}
{% set gdsnTradeItemClassification = ['3_009', '3_032', '4_014', '4_015', '4_020', '4_021', '4_027', '4_030', '4_362', '4_364', '4_365', '4_367', '4_371', '4_372', '4_374', '4_384', '4_385', '4_391', '4_421', '4_661', '5_004', '5_006', '5_067', '7_192', '8_247', '8_248', '8_307', '8_319', '8_321', '8_322', '8_323'] %}

{#
    code_to_label_attr list defines all attribute codes that needs the option label not the code value,
    the label locales are the ones defined in the publish to market attribute
#}
{% set code_to_label_attr = ['3_003','4_014'] %}

{#
    safetyDataSheetModule : list of Safety DataSheet FILE attributes
#}
{% set gsdn_safety_data_sheet_information = [] %}

{#
    referencedFileDetailInformationModule : list of image, packshot, document FILE attributes
#}
{% set gsdn_referenced_file_detail_information = ['packshot_C1C1_S01'] %}

{#
    videoInformationModule : list of all VIDEO attributes
#}
{% set gsdn_video_information = ['video'] %}

{% include 'cin_message_1_0.xml.twig' with {
    'code_to_label_attr': code_to_label_attr,
    'url_mapping': {
        'file_url_datasheet':'file_pdf_datasheet'
    },
    'gdsnTradeItemClassification': gdsnTradeItemClassification,
    'gsdn_referenced_file_detail_information': gsdn_referenced_file_detail_information,
    'gsdn_video_information': gsdn_video_information,
    'gsdn_safety_data_sheet_information': gsdn_safety_data_sheet_information
} %}

Option B : Provide a Master

Another option if extension is not possible is that you provide the complete twig document yourself. You can still use the same twig functions but without a start template.

Global variables

Variable Description
brick_code The brick_code also linked to family code
gln_account your GLN account number
gln_account_name your GLN account name
targetMarketCountryCode The market code you wish to create your document for
data.values.identifier The Identifier we generate that contains
data.values.identifier.getEan The GS1 GTIN / EAN + leading 0

Twig extensions

Twig extension Requires
gdsnTradeItemClassification a list of trade-item attributes
normalize attribute you wish to normalize
code_to_label_attr a list of options attributes you wish to label
getFileMetaInformation a list of image, packshot, document FILE attributes
getSafetyDataSheetInformation a list of Safety DataSheet FILE attributes
getVideoInformation a list of all the video attributes

normalize with context

You can also provide a specified context for some extra conditions to trigger.

context / Number Format

GS1 requires a precision of 3 digits for floats. When the correct attribute_type is set we can transform this correctly but when we are dealing with text we don’t have that automatic transformation.

In order to counter this issue we provide an option to force number formatting onto a numeric value. Beware if the value is not numeric we skip this format.

{{ normalize('3_014', ['number_format']) }}

Working with assets/files

When working with assets or files GS1 distinguishes then into different formats. Here we will link our media content data from the pim to the Datapool.

The First format is SafetyDataSheet

getSafetyDataSheetInformation Module

This module expects a list of attribute_code(s) you wish to distribute to the Datapool. The attribute code should be an attribute FILE type and should provide a PDF document. No other documents are accepted. The module is localisable so it you provide localisable attributes it will set the language code together with the node. We also provide a resource URL this is downloadable link that points to the pim as source with a unique hash.

{% set gsdn_safety_data_sheet_information = ['your_safety_attribute_code'] %}

getFileMetaInformation Module

This module expects a list of attribute_code(s) you wish to distribute to the Datapool. The module is localisable so it you provide localisable attributes it will set the language code together with the node. We also provide a resource URL this is downloadable link that points to the pim as source with a unique hash. The attribute code should be an attribute FILE type and should provide a TIFF file. This is the preferred image format.

{% set gsdn_referenced_file_detail_information = ['packshot_C1C1_S01', 'packshot_C1R1_S02'] %}

getVideoInformation Module

This module expects a list of attribute_code(s) you wish to distribute to the Datapool. The module is localisable so it you provide localisable attributes it will set the language code together with the node. The resource URL in akeneo CE is the product data value formed URL you have provided.

{% set gsdn_video_information = ['video'] %}
Packshot

GS1 allow a variety of packshots to be uploaded, in order to distinguish the correct facade GS1 allow you to incorporate a formatted filename, guidelines defined by GS1 into.

Product_Images_SpecificationsAndUsageRules_EN_v1.8.pdf

EN-product image checklist_FMCG.pdf

In order to abide by this guidelines we introduced an option to set those formatted text inside the attribute code. When processing the file the formatted text will be handled differently.

Here is an example.

This 2 packshots as example

# packshot_C1C1_S01 generates this filename
<fileName>08715743012693_C1C1_S01.tiff</fileName>

# packshot_C1R1_S02 generates this filename
<fileName>08715743012693_C1R1_S02.tiff</fileName>

If not correct format is detected inside the attribute_code we simple reference the original uploaded filename.

URL-attribute

A URL-attribute does not technically exist in Akeneo. We use the text-attribute where one can enter the media URL path of a specific asset. This attribute supports global, localizable and scopable but has no added validation like does the URL exist.

We generally consider an URL-attribute as a text-attribute with the suffix _url inside the attribute code.

Here an example how the XML module referencedFileDetailInformationModule is used for de nl_BE value of https://test.induxx.be/pds_nl.pdf

<referenced_file_detail_information:referencedFileDetailInformationModule
    xmlns:referenced_file_detail_information="urn:gs1:gdsn:referenced_file_detail_information:xsd:3"
    xsi:schemaLocation="urn:gs1:gdsn:referenced_file_detail_information:xsd:3 http://www.gs1globalregistry.net/3.1/schemas/gs1/gdsn/ReferencedFileDetailInformationModule.xsd">
    <referencedFileHeader>
        <referencedFileTypeCode>DOCUMENT</referencedFileTypeCode>
        <fileFormatName>PDF</fileFormatName>
        <fileName>pds.pdf</fileName>
        <fileLanguageCode>nl</fileLanguageCode>
        <uniformResourceIdentifier>https://test.induxx.be/pds_nl.pdf
        </uniformResourceIdentifier>
    </referencedFileHeader>
</referenced_file_detail_information:referencedFileDetailInformationModule>
URL-attribute overruling

The URL-attribute allows another file-attribute to overruled, this is neccasary when the pim holds the original file-attribute as a secundary option. In order to make this relation between the URL-attribute and a file-attribute work we recommend that the URL attribute uses a suffix _url.

  • e.g. : sds_per_locale should have the URL-attribute sds_per_locale_url

When the URL-attribute is filled then relation file-attribute will be excluded.

URL-attribute overruling by mapping

We also support URL-attribute overruling that without the correct suffix _url annotation. In order the set the relation here we introduced a url_mapping to define the correct override attribute.

{% include 'cin_message_1_0.xml.twig' with {
    'code_to_label_attr': code_to_label_attr,
    'url_mapping': {
        'file_url_datasheet':'file_pdf_datasheet'
    },
    ...
} %}