Skip to content

Product Safety

Availability:

  • Product page
  • Bundle page
  • Loyalty product page


product_safety module is used to display product safety information, including certificates, safety warnings, manufacturer details, the responsible person in the EU, and importer information.

Configuration parameters

displayTitle

int if set to 1 the module title will be displayed.

title

string Title of the module. If not specified no title will be displayed.

isEnabled

int if set to 1 it will be possible to expand and collapse the module, otherwise it will always be expanded and it will not be possible to collapse it.

collapseExpand

string Defines if module section should be opened by default. Values are 'expanded' or 'collapsed'.

Module source code

{% from "@macros/module_accordion_toggler.twig" import module_accordion_toggler %}
{% from "@macros/address.twig" import address %}

{% set product = ObjectApi.getProduct(product_id) %}
{% set isDisabled = not moduleConfig.isEnabled %}

{% set hasTitle = moduleConfig.displayTitle and moduleConfig.title %}
{% set isAccordionOpened = isDisabled or not hasTitle or moduleConfig.collapseExpand == "expanded" %}

{% set productSafetyHeadingId = 'product-safety-heading-' ~ moduleInstance %}

{% if product.gpsrCertificates|length > 0 or product.gpsrProducer or product.gpsrResponsible or product.gpsrImporter %}
    <h-accordion class="accordion" {% if isDisabled %}disabled{% endif %}>
        <h-accordion-group {% if isAccordionOpened %}opened{% endif %}>
            {% if hasTitle %}
                {{ module_accordion_toggler({
                    title: moduleConfig.title,
                    isDisabled,
                    classNames: 'product-safety__header',
                    attributes: {
                        id: productSafetyHeadingId
                    }
                }) }}
            {% endif %}

            <h-accordion-content aria-labelledby="{{ productSafetyHeadingId }}">
                <section class="grid__row grid__row_xs-hcenter">
                    <div
                        class="
                            product-safety__content
                            grid__col
                            grid__col_md-10
                        "
                    >
                        {% if product.gpsrCertificates|length > 0 %}
                            <div class="mb-xs-4">
                                <h3 class="font_semibold mb-xs-1">{{ translate('Certificates and safety warnings') }}</h3>

                                <ul class="list">
                                    {% for certificate in product.gpsrCertificates %}
                                        <li class="list__content_disc">{{ certificate.description|raw }}</li>
                                    {% endfor %}
                                </ul>
                            </div>
                        {% endif %}

                        {% if product.gpsrProducer %}
                            <div class="mb-xs-4">
                                <h3 class="font_semibold mb-xs-1">{{ translate('Manufacturer') }}</h3>

                                {{ address(product.gpsrProducer) }}
                            </div>
                        {% endif %}

                        {% if product.gpsrResponsible %}
                            <div class="mb-xs-4">
                                <h3 class="font_semibold mb-xs-1">{{ translate('Responsible person in the EU') }}</h3>

                                {{ address(product.gpsrResponsible) }}
                            </div>
                        {% endif %}

                        {% if product.gpsrImporter %}
                            <div class="mb-xs-4">
                                <h3 class="font_semibold mb-xs-1">{{ translate('Importer') }}</h3>

                                {{ address(product.gpsrImporter) }}
                            </div>
                        {% endif %}
                    </div>
                </section>
            </h-accordion-content>
        </h-accordion-group>
    </h-accordion>
{% endif %}

Webcomponents reference

Macros reference

Used Object Api methods

Used styles

Module configuration schema

[
    {
        "state": "unfolded",
        "label": "General settings",
        "elements": [
            {
                "type": "infobox",
                "name":" infobox",
                "options": {
                    "type": "blank",
                    "message":"#### Related settings in the admin panel%s- changing phrases in [translations](%s)%s- adding responsible persons, certificates, and warnings in the [Safety (GPSR)](%s) tab",
                    "placeholderValues": [
                        "\n",
                        "\/admin\/configLanguages\/list",
                        "\n",
                        "\/admin\/productSafety\/list"
                    ]
                }
            },
            {
                "type": "checkbox",
                "name": "displayTitle",
                "label": "Display module title",
                "defaultValue": 1,
                "children": [
                    {
                        "type": "text",
                        "name": "title",
                        "label": "Module title",
                        "defaultValue": "Product safety",
                        "supportsTranslations": 1,
                        "isRequired": 1,
                        "relations": [
                            {
                                "parentName": "displayTitle",
                                "parentValueToActionsMap": [
                                    {
                                        "value": 0,
                                        "actions": [
                                            "setHiddenAndOptional",
                                            "setDisabled"
                                        ]
                                    },
                                    {
                                        "value": 1,
                                        "actions": [
                                            "setVisibleAndRequired",
                                            "setAvailable"
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            },
            {
                "type": "checkbox",
                "name": "isEnabled",
                "label": "Allow to collapse and expand the module content",
                "defaultValue": 0,
                "relations": [
                    {
                        "parentName": "displayTitle",
                        "parentValueToActionsMap": [
                            {
                                "value": 0,
                                "actions": [
                                    "setDisabled"
                                ]
                            },
                            {
                                "value": 1,
                                "actions": [
                                    "setAvailable"
                                ]
                            }
                        ]
                    }
                ],
                "children": [
                    {
                        "type": "radio",
                        "name": "collapseExpand",
                        "label": "Set as:",
                        "defaultValue": "expanded",
                        "relations": [
                            {
                                "parentName": "displayTitle",
                                "parentValueToActionsMap": [
                                    {
                                        "value": 0,
                                        "actions": [
                                            "setDisabled"
                                        ]
                                    },
                                    {
                                        "value": 1,
                                        "actions": [
                                            "setAvailable"
                                        ]
                                    }
                                ]
                            },
                            {
                                "parentName": "isEnabled",
                                "parentValueToActionsMap": [
                                    {
                                        "value": 0,
                                        "actions": [
                                            "setHidden",
                                            "setDisabled"
                                        ]
                                    },
                                    {
                                        "value": 1,
                                        "actions": [
                                            "setVisible",
                                            "setAvailable"
                                        ]
                                    }
                                ]
                            }
                        ],
                        "options": {
                            "radioOptions": [
                                {
                                    "key": "expanded",
                                    "label": "expanded"
                                },
                                {
                                    "key": "collapsed",
                                    "label": "collapsed (only module title visible)"
                                }
                            ]
                        }
                    }
                ]
            }
        ]
    }
]