Introduction
Do you use texts like the following in your product descriptions?
The HP HD 5210 is a Skype®-certified autofocus HD webcam that is available since September 19, 2011. It provides up to 1920 x 1080 widescreen streams at a frame rate of 30.Sample product description
The above example contains four attributes that are part of the default Akeneo demo data:
Product name, Release date, Maximum video resolution and Maximum frame rate.
Now guess what happens when you or a co-worker updates the frame rate attribute from 30 to 60?! Correct, the description would not reflect this change until you edit the text by hand. We all are humans and it's easy to forget to update the related texts for all scopes and locales after such a change.
Wouldn't it be nice if you could reference the different attributes directly in the description?
That's exactly what this extension provides.
Features
- Enhances the text area attribute type so that you can insert any attribute value into the text
- Provides auto-completion for your attribute codes
- Works with and without WYSIWYG enabled
- Supports "value per channel" and "value per locale" attributes
- Supports reference data objects
- Supports product models
- Use provided Twig filters to format metrics, dates, currencies etc. or simply add your own
- Use the product REST API or the default CSV/XLSX exports to access the rendered texts for your online shop etc.
Template snippets
Metric attribute
This example shows how the localizedmetric-filter prints out the value suffixed by the translated metric unit.
Weight: {{ weight | localizedmetric }}
Price attribute
The localizedprice-filter is based on the localizedcurrency-filter and makes it easy to print the given currency.
Price: {{price | localizedprice('EUR') }}
Date attribute
Twig already provides the localizeddate-filter. Here you can see how to use the locale-variable, which is automatically available.
Date: {{ date | localizeddate('medium', 'none', locale) }}
Number attribute
Use the localizednumber-filter to format any numbers.
Number: {{ number | localizednumber('decimal', 'default', locale) }}
Boolean attribute
The if-statement lets you output any text.
Available: {% if available %}yes{% else %}no{% endif %}
Simple select attribute
Printing the localized value of a select attribute can be achieved by using the localized-filter.
Color: {{ color | localized }}
Multi select attribute
Like in the previous simple select snipped, you can use the localized-filter to output multiple values, separated by comma.
Colors: {{ colors | localized }}
Reference data attribute
You can output the result of __toString() like any other scalar attribute.
Color: {{ color_reference }}
Reference data attribute property
It's also possible, to output properties of a reference data object.
Hex-Code: {{ color_reference.hex }}
Reference data attribute property translation
If your reference data object implements the TranslatableInterface interface, you can directly output the translation.
Pictogram: {{ pictogram.translation.label }}
Reference data attribute twig filter
Of cause you can register your own twig filters to output anything you want.
{{ color_reference | format_color }}
Are you missing a feature?
There are plenty of possibilities. Feel free to ask us your questions by using the form below.