Skillnad mellan versioner av "Templating:Printed orders"

Från Vendre Help
Hoppa till: navigering, sök
(Skapade sidan med 'This page documents the Twig template variables and extensions available in printed orders. ==Twig extensions== ===admin_langstr, order_langstr=== <tt>admin_langstr</tt> and...')
Rad 1: Rad 1:
 
This page documents the Twig template variables and extensions available in printed orders.
 
This page documents the Twig template variables and extensions available in printed orders.
 +
 +
==Twig variables==
 +
 +
===Special variables===
 +
{|class="wikitable"
 +
!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.
 +
 +
{|class="wikitable"
 +
!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[].attributes
 +
|Selected attributes, as an array.
 +
|-
 +
|products[].attributes[].option
 +
|Attribute name.
 +
|-
 +
|products[].attributes[].value
 +
|Attribute value.
 +
|-
 +
|products[].attributes[].price
 +
|Attribute cost.
 +
|}
  
 
==Twig extensions==
 
==Twig extensions==

Versionen från 31 oktober 2018 kl. 11.38

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[].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 }}