Text Template Bundle

Categories
Add-ons
Akeneo PIM compatibilty
Versions:
Price: €750.00
Version:
2.0.0

Description

Overview

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.

The above example contains four attributes that are part of the default Akeneo demo data:

  • Product name
  • Release date
  • Maximum video resolution
  • 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.

Are you interested? Feel free to contact us.

Release notes

Release notes

Currently, this extension supports Akeneo 2.x and 3.x.

Installation

Preliminaries

After purchasing this bundle, you'll get access to the private Git repository. We also assume that you are running Akeneo via Docker. If this is not the case, you can simply derive the installation steps.

Installation

After adding the repositories configuration to your composer.json file, run composer to install the files:

docker-compose exec fpm php -d memory_limit=3G /usr/local/bin/composer require mitting/akeneo-text-template-bundle 2.x-dev

If you are using Akeneo 2.x, then you have to use version 1.x-dev of the bundle.

Activate the bundle

Add the following in app/AppKernel.php to registerProjectBundles():

new Mitting\Bundle\AkeneoTextTemplateBundle\MittingAkeneoTextTemplateBundle(),

Append the routing configuration to app/config/routing.yml:

mitting_akeneo_text_template:
    resource: "@MittingAkeneoTextTemplateBundle/Resources/config/routing.yml"

Then run ./bin/docker/pim-front.sh to finish the installation.

Documentation

Documentation

The bundle adds the "Twig template enabled" flag next to the rich text editor flag under the attribute settings. Simply enable it for your current attribute or create a new one where you wish to reference your other attribute values. Now you can write twig markup to print out your attribute in any format you like.

Template snippets

Metric attribute

This example shows how the localizedmetric-filter prints out the value suffixed by the translated metric unit.

Weight: {{ weight | localizedmetric }}
Weight: 512 Gram

Price attribute

The localizedprice-filter is based on the localizedcurrency-filter and makes it easy to print the given currency.

Price: {{price | localizedprice('EUR') }}
Price: €100.00

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) }}
Date: Sep 19, 2011

Number attribute

Use the localizednumber-filter to format any numbers.

Number: {{ number | localizednumber('decimal', 'default', locale) }}
Number: 1.250.000

Boolean attribute

The if-statement lets you output any text.

Available: {% if available %}yes{% else %}no{% endif %}
Available: yes

Simple select attribute

Printing the localized value of a select attribute can be achieved by using the localized-filter.

Color: {{ color | localized }}
Color: Grey

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 }}
Colors: Grey, Red, Blue

Reference data attribute

You can output the result of __toString() like any other scalar attribute.

Color: {{ color_reference }}
Color: Red

Reference data attribute property

It's also possible, to output properties of a reference data object.

Hex-Code: {{ color_reference.hex }}
Hex-Code: #ff0000

Reference data attribute property translation

If your reference data object implements the TranslatableInterface interface, you can directly output the translation.

Pictogram: {{ pictogram.translation.label }}
Pictogram: flameable

Reference data attribute twig filter

Of cause you can register your own twig filters to output anything you want.

{{ color_reference | format_color }}
The hex-code of the color "Red" is #ff0000

Are you missing a feature?

There are plenty of possibilities. Feel free to ask us your questions.

List your extension on Akeneo Marketplace

Learn about the best practices to enrich Akeneo ecosystem.

Share your contributions with Akeneo Community any way you want.

Need help? Please read our
submission requirements and manual.