Skillnad mellan versioner av "Templating:Printed orders"

Från Vendre Help
Hoppa till: navigering, sök
(New variables)
Rad 54: Rad 54:
 
|products[].specifications
 
|products[].specifications
 
|Product specifications as an array.
 
|Product specifications as an array.
 +
|-
 +
|products[].specifications[].id
 +
|Specification id.
 +
|-
 +
|products[].specifications[].name
 +
|Specification value.
 +
|-
 +
|products[].specifications[].type
 +
|Either value or text.
 +
|-
 +
|products[].specifications[].value
 +
|Specification value
 +
|-
 +
|products[].specifications[].unit
 +
|Unit information.  Note that the correct language might not be used.
 +
|-
 +
|products[].specifications[].unit.id
 +
|Unit id.
 +
|-
 +
|products[].specifications[].unit.abbr
 +
|Unit abbreviation.
 +
|-
 +
|products[].specifications[].unit.relation_id
 +
|Unit relation id.
 +
|-
 +
|products[].specifications[].unit.calculation_value
 +
|Unit calculation value.
 +
|-
 +
|products[].specifications[].short_value
 +
|The short value, only when type is text.
 
|-
 
|-
 
|products[].attributes
 
|products[].attributes

Versionen från 31 oktober 2018 kl. 11.43

This page documents the Twig template variables and extensions available in printed orders.

Twig variables

Special variables

variable description
stylesheets A list of CSS files that should be included for proper rendering. The files differ depending on what rendering method is being used.
header A block of HTML containing the administration elements.
header A block of HTML containing the administration elements.

Old variables

There are many, prefer adding new variables instead of using them.

New variables

These variables are available under the variables admin and order. These variables are not available when printing pickinglists.

variable description
products The products on the order as an array. The products are sorted according the the store's configuration.
products[].id Product id.
products[].quantity Number of products ordered.
products[].price Price used.
products[].tax Tax rate used.
products[].model Product model.
products[].name Product name used.
products[].package_content Package content for units.
products[].specifications Product specifications as an array.
products[].specifications[].id Specification id.
products[].specifications[].name Specification value.
products[].specifications[].type Either value or text.
products[].specifications[].value Specification value
products[].specifications[].unit Unit information. Note that the correct language might not be used.
products[].specifications[].unit.id Unit id.
products[].specifications[].unit.abbr Unit abbreviation.
products[].specifications[].unit.relation_id Unit relation id.
products[].specifications[].unit.calculation_value Unit calculation value.
products[].specifications[].short_value The short value, only when type is text.
products[].attributes Selected attributes, as an array.
products[].attributes[].option Attribute name.
products[].attributes[].value Attribute value.
products[].attributes[].price Attribute cost.

Twig extensions

admin_langstr, order_langstr

admin_langstr and order_langstr are functions that take a language string and return its value for either the administration's language or the order's language. Language strings are loaded from the global namespace.

order_langstr is not available when printing pickinglists.

Example:

{{ admin_langstr('TEXT_HEADER_DEFAULT') }}

admin_currency_format, order_currency_format

admin_currency_format and order_currency_format are filters that take a currency value and format it according to the administration's default currency or the order's currency.

order_currency_format is not available when printing pickinglists.

Example:

{{ 12.345 | admin_currency_format }}