It is possible to use Rich Text Editor for formatting the products data inserted into the template. The typical case is a Product Price which sometimes needs to be formatted in a very specific style, for example
For doing this, the decimal price must be separated on 2 parts: integer and fractional, and then they will be formatted individually using Rich text styles.
Separating the decimal price
First, you have to create additional calculation fields for integer and fractional parts of the price.
Go to the Briefing Price module Field Definition settings.
Create a Price field of type decimal which will be the source of data (it can be simple decimal or calculated value as well).
Create calculation field Price_Integer
Field Content
Output Format
Formula
# of decimals
Calculation
Decimal Number
formatInteger(${Price})
0
Create calculation field Price_Fraction
Field Content
Output Format
Formula
Calculation
Text
formatFractional(${Price}, '', '', 2)
The full formula template is
formatFractional(<DecimalField>, <InCaseOfZero>, <Prefix>, <Digits After Float Point>)
where
<DecimalField> — the original source decimal field.
<InCaseOfZero> — the value to be displayed if the source field fractional part is equal to zero.
<Prefix> — some text to be placed before the result value, for example decimal separator.
<Digits After Float Point> — the number of digits in the fractional part to be displayed (most likely it will be equal to 2 for prices).
Now the price is separated to integer and fractional parts.
Formatting the price using the Rich Text
Go to Briefing Page Preview and switch to Layout tab.
Open Template editor.
Create a text element and enable Advanced Text Styling for it.
Create Character style for the Integer and decimal parts of the price. Note, if you want to uppercase the decimal part, use vertical align Top in the character style. Also you might need to play with Leading setting to align the value accurately.
On the Text Field Settings tab you will have a possibility to create a variable from the module field. This is needed for further inserting data in Rich Text Editor. Create 2 variables PriceInt and PriceFrac and map to the corresponding fields using xpath:
PriceInt
/preview/page/product/fields/field[@definitionId=1117]/value
PriceFrac
/preview/page/product/fields/field[@definitionId=1118]/value
Open RTE and insert variables using placeholder syntax
${var}
${PriceInt},${PriceFrac}€
Note, that you can also add static text like decimal separator or currency sign.
Save the template. The price will be rendered according to template.
Strikethrough settings
The common use of strikethrough is for marking the old price that is replaced. The effect is applied to the whole text block. To configure, open the Text Field Settings properties in Template Editor:
Option | Default | Meaning |
---|---|---|
Strikethrough | None | Defines the color of the strikethrough line. To specify the color, type the necessary CMYK values in their respective boxes |
Strikethrough Weight | 0.0 pt | Specifies how thick the line should be. |
Strikethrough Position | Horizontal | Select the type of the strikethrough from:
|