In OXID eShop 7, you add the legal guarantee notice below the add-to-basket button with a template extension: in the Twig block details_productmain_tobasket of the APEX theme, via a small module or a child theme. A CMS page in the admin is not enough, because the editor removes scripts and there is no free CMS slot on the product page.
The code for OXID eShop
<div data-garantielabel></div>
<script src="https://www.garantielabel.app/widget.js" async></script>Set further options such as display and language in the code builder.
Step by step in OXID eShop
- Module or child theme
The extension belongs in a small module or a child theme (intheme.phpwith'parentTheme' => 'apex') so that updates of the APEX theme do not overwrite it. You activate it under Extensions → Modules or Extensions → Themes. You need file access for this; usually your agency takes care of it. - Extend the block
Extend the templatepage/details/inc/productmain.html.twigand paste the widget code in the blockdetails_productmain_tobasketafter{{ parent() }}. Withparent(), the add-to-basket button stays unchanged. - GARAN label per product
For your own GARAN labels, create two attributes under Administer Products → Attributes, for example “GARAN full” and “GARAN small”, and enter the addresses of the two files on the product under Selection → Assign Attributes. In the template, output the values indata-garan-vollanddata-garan-klein. - Clear the cache
Clear the template cache withvendor/bin/oe-console oe:cache:clearand check the product page, including variants.
In a module, the file is located at views/twig/extensions/themes/apex/page/details/inc/productmain.html.twig and looks like this:
{% extends 'page/details/inc/productmain.html.twig' %}
{% block details_productmain_tobasket %}
{{ parent() }}
<div data-garantielabel></div>
<script src="https://www.garantielabel.app/widget.js" async></script>
{% endblock %}Things to know about OXID eShop
- The CMS page editor removes
<script>. From OXID 7.5 there is also an HTML sanitizer that removes scripts when it is switched on. The code therefore belongs in the template. - By default, assigned attributes also appear in the list of product properties on the detail page. Hide the two GARAN attributes there in the template if needed.
- OXID 6 with the Smarty themes Flow and Wave: the block has the same name. Modules hook it in via
blocksinmetadata.php; the template ispage/details/inc/productmain.tpl.
Where exactly the notice belongs in OXID eShop
On the product page, the notice sits in the block details_productmain_tobasket, as described above. When customers choose another variant, APEX reloads the area details_container and replaces it with freshly rendered HTML. The theme runs any scripts it contains again. So your block extension is back on the page after the variant change too.
For a notice on every page, extend the template layout/footer.html.twig. In the APEX theme, it contains, among others, the block dd_footer_copyright. It outputs the content of the CMS page with the ident oxstdfooter. In a module, your file is located at views/twig/extensions/themes/apex/layout/footer.html.twig:
{% extends 'layout/footer.html.twig' %}
{% block dd_footer_copyright %}
{{ parent() }}
<div data-garantielabel></div>
<script src="https://www.garantielabel.app/widget.js" async></script>
{% endblock %}Keep maintaining the footer text itself in the CMS page. The placeholder, however, belongs in the template, for the same reason as above: the editor removes scripts. The template applies to all shop languages. The widget picks the language of the notice from the language setting of the page, which APEX sets from the active shop language.
Variants and model identifier for the GARAN label
In OXID, you first create a parent product. According to the user documentation, it contains all the basic information that is inherited by the variants. You maintain the variants in the Variants tab. There you can enter, among other things, a different product number, price and stock from the parent product. The parent product’s long description is displayed for all variants unless a variant has its own.
Manufacturer and manufacturer’s part number (MPN) are on the Main tab. You select the manufacturer from a list that you maintain under Master Settings ‣ Brands/Manufacturers. According to the documentation, the edit view of a variant is almost identical to that of a regular product.
A GARAN label applies to one model identifier. If all variants share the same one, the label on the parent product is enough. If variants are separate models, each model needs its own label. After setting up, check in the live shop whether your template shows the label of the selected variant or that of the parent product when the variant changes.
Typical pitfalls in OXID eShop
- Template cache: According to OXID, changes to templates, configurations or modules are often only applied correctly after clearing the cache. Besides the console command above, the OXID module Admin Tools clears the template cache under Service ‣ Tools. It holds the compiled Twig templates.
- Varnish: With the Varnish reverse proxy, a separate server keeps the pages cached. OXID splits the pages into sections for this, so-called widgets. Only check your change once this cache delivers the new version as well. Usually your agency or host clears it.
- Subshops: According to the developer documentation, you activate a module for a subshop with the option
--shop-id, i.e.vendor/bin/oe-console oe:module:activate <module-id> --shop-id=<shop-id>. Then check each subshop separately. - CMS content per language: According to the documentation, you maintain CMS pages separately for each language, via the language selection. A template extension, by contrast, is needed only once.
Further sources
- OXID user documentation: products, Variants tab
- OXID user documentation: products, Main tab
- OXID Admin Tools: clearing the cache
- OXID user documentation: Varnish reverse proxy
- OXID developer documentation: activating a module, also for subshops
- APEX theme on GitHub: footer template
- APEX theme on GitHub: variant selection script
Legal guarantee notice in the order confirmation
According to the Commission’s guidelines, the notice should also appear in the confirmation email. The order confirmation uses the CMS page with the ident oxuserorderemail, which you edit under Customer Info → CMS Pages. JavaScript does not run in emails, so add the official graphic there as an image. A plain link is unlikely to count as a durable medium (CJEU, Case C-49/11, Content Services); the safest way is to put the notice directly in the email as an image, text or attachment. You will find the official files on our download page.
Sources
- OXID developer documentation: extending a block of an active theme
- OXID developer documentation: creating a child theme
- OXID developer documentation: HTML sanitizer (7.5)
- OXID user documentation: products, Selection tab
- OXID user documentation: CMS pages
- APEX theme on GitHub (product page template)
Producer guarantee? Then add the GARAN label
If the producer gives a commercial guarantee of durability of more than two years free of charge for the whole good, the GARAN label also belongs on the product page. With the GARAN label generator you create it in seconds from years, brand and model, your first three labels free and without sign-up. Below every finished label you get an embed code with permanent image URLs: you upload nothing and paste it into OXID eShop as shown above.
Prefer your own files? Then upload the full and the nested version to the media library of OXID eShop and enter the addresses in the widget code:
<div data-garantielabel
data-garan-voll="https://…/GARAN-MX-500.svg"
data-garan-klein="https://…/GARAN-MX-500-nested.svg"></div>The widget then shows the nested version below the legal guarantee notice, and one click opens the full GARAN label.
Frequently asked questions
Can I simply paste the code into a CMS page?
Not reliably. The editor removes the script, and there is no standard slot on the product page where a CMS page appears automatically. A small template extension is the safe way.
Do I have to change the APEX theme itself?
No. A module or child theme with {{ parent() }} is enough. The original theme stays updatable, and the buy button stays as it is.
Where do I enter the GARAN label per product?
For example as an attribute value on the product under Selection → Assign Attributes. The template then reads the addresses and passes them to the widget.
How do I show the notice on every page in OXID eShop?
In your module or child theme, extend the template layout/footer.html.twig, in the APEX theme for example the block dd_footer_copyright. Paste the widget code there after {{ parent() }}.
Does the notice stay when the variant changes?
Yes, if it is in the block details_productmain_tobasket. When the variant changes, APEX reloads the whole details area, including your block extension, and runs the scripts it contains again.
Do I have to activate the module in every subshop?
According to the developer documentation, you activate it for a subshop with the option --shop-id. Then check each subshop in the live shop.