Price Management | Formatters
UnitPrice and PackPrice are formatted using the set formatting rule (in the CS language).
You can also use formatters, which can be appended to the attribute name with '|', to format the output. These can also be concatenated:
{Field|Formatter1()|Formatter2()|...
Formatter | Example | Parameters | Descriptions |
---|---|---|---|
date_format |
PHP
| Date format | The formatter formats the date using the provided formatting parameters analogue to the PHP function. |
number_format |
PHP
| Number format | The formatter formats a numerical value in the current CS language. |
number_format_raw |
PHP
|
| The "number_format" formatter is used by default for the "UnitPrice" and "PackPrice" fields. Therefore, the formatter "number_format_raw" is available that reverses the standard formatting. |
currency_format |
PHP
Example result: CHF 12.34
PHP
Example result: 12.34 Swiss francs | Label or symbol | This formatter is available for the "UnitPrice" and "PackPrice" fields only. If you do not select a parameter, the "Symbol" parameter is used by default. If you use the label, it is always placed at the end. By checking the "Currency" field, the formatter tries to find a CS currency with the same name. If it finds a currency, the currency is placed either before or after the price, depending on the setting. If it does not find a suitable currency, the value from the field is used. If there is no currency in the field, only the price is returned. |
replace |
PHP
This function replaces all occurrences of "piece" and "item" by "Pc". |
| This formatter replaces values. The function requires at least two parameters: Search pattern and replacement. Optionally, you can specify "true" as the third parameter to replace values irrespective of upper and lower case. Multiple replacements are possible by specifying arrays in JSON notation as the search pattern or replacement. In this case, use different quotation marks than those surrounding the JSON string. |
translate |
PHP
| Translation | This formatter translates the value from the specified field into the applicable data language if a translation is available. |
calc |
PHP
| ADDITION SUBSTRACTION DIVISION MULTIPLICATION | The operations are performed from left to right. You can also use several operations. It is important to place the formatter for the calculations before the other formatters. |