Context data available in Order Notes

Common Context

Variables

Variable Name

Description

Variable Name

Description

note_name

Translated name of the given order note. E.g. Order Confirmation

billing_address

The billing address data of a given order. It contains sub-variables:

  • billing_address.title

  • billing_address.first_name

  • billing_address.last_name

  • etc.

Please take a look at the b3_address_orderaddressDB table, to get the up-to-date list of sub-variables.

shipping_address

The shipping address data of a given order. It contains sub-variables:

  • shipping_address.title

  • shipping_address.first_name

  • shipping_address.last_name

  • etc.

Please take a look at the b3_address_orderaddressDB table, to get the up-to-date list of sub-variables.

company

The company name from the billing_address

is_pickup

A boolean, indicating whether pickup delivery is activated for the given order

customer_number

Customer number of the person, who created the order

customer_number_label

The label defined in the Admin Panel: Organizations > Address & User Field Customizations > Customer number label

is_customer_number_shown

The visibility setting from the Admin Panel:
Organizations > Address & User Field Customizations > Customer number visibility

order_date

Creation date of the order

order_obj

The whole order object. It contains sub-variables:

  • order_obj.origin

  • order_obj.full_number

  • order_obj.customer_ip

  • etc.

Please take a look at the b3_order_orderDB table, to get the up-to-date list of sub-variables.

order_lines

Please take a look at the Line Variables section below this table

delivery_time

String representation of the delivery time. It contains either:

  • {min} - {max} days

    • e.g. “2 - 5 days”

  • {min==max} days

    • e.g. “2 days”

service_user

The user who requested to create the given order note. It contains sub-variables:

  • service_user.first_name

  • service_user.last_name

  • service_user.email

  • etc.

Please take a look at the auth_userDB table, to get the up-to-date list of sub-variables.

service_user_name

String representation of the user who requested to create the given order note. It can be either:

  • first name + last name

  • last name

  • first name

  • email

depending on the availability of data

total_weight

The total weight of the order in grams

total_weight_unit

Either g or kg depending on the total weight. Up to 999 grams, the unit will be g, kg otherwise

total_weight_decimals

Either 0 or 1. It should be used as an argument to floatformat Django’s function.
For example:

{{ total_weight|floatformat:total_weight_decimals }}

0 is returned if the total weight is lower than 1000 grams, 1 otherwise

subtotal

The subtotal price of the order. It can be either a net or gross price depending on the Admin Panel setting Organizations > General Settings & Features > Show only Net Prices for customers

post_processings_price

The total cost of post-processings of the given order. It can be either a net or gross price depending on the Admin Panel setting Organizations > General Settings & Features > Show only Net Prices for customers

printing_price

Total print price of the given order. It can be either a net or gross price depending on the Admin Panel setting Organizations > General Settings & Features > Show only Net Prices for customers

fee

Total fee value of the given order. It can be either a net or gross price depending on the Admin Panel setting Organizations > General Settings & Features > Show only Net Prices for customers

difference_to_minimum

The amount applied to the order to compensate for the minimum order price defined in the service settings. It can be either a net or gross price depending on the Admin Panel setting Organizations > General Settings & Features > Show only Net Prices for customers

voucher_discount

Voucher discount that was applied to the order. It can be either a net or gross price depending on the Admin Panel setting Organizations > General Settings & Features > Show only Net Prices for customers

shipping_price

The shipping price of the order. It can be either a net or gross price depending on the Admin Panel setting Organizations > General Settings & Features > Show only Net Prices for customers

total_prices

The total price object of the order. It contains sub-variables:

  • total_prices.currency

  • total_prices.tax

  • total_prices.excl_tax

  • total_prices.incl_tax

tax

The total tax value of the order

tax_rate

The tax rate that was applied to the order

payment_custom_fields

If the given order was paid via a custom payment method, this variable contains a nicely formatted string: field: value, field: value. Those are the custom fields defined on the payment method, that are later filled out by the customer in the checkout

payment_metadata

It is the same as payment_custom_fields, but this is a raw object instead of a formatted string.
For example, the custom field "Bank Account and PW" can then be used in pdf like this:

{{ payment_metadata.bank_account_and_pw }}

theme_font

Open Sans(hardcoded value)

fees

A list of fee objects (fees applied to the order). Every fee object contains sub-variables:

  • fee_obj.fee (name of the given fee)

  • fee_obj.amount (either net or gross value of the fee. Depending on the Admin Panel setting Organizations > General Settings & Features > Show only Net Prices for customers)

This is how you could use it in a template:

{% for fee_obj in fees %} {{ fee_obj.fee }} {% endfor %}

Line Variables

The order_lines variable is an array of line objects. Every object contains info about a single line. Those are sorted by id. This is how you would usually use it:

{% for line in order_lines %} Order Line {{ line.fullName }} ... {% endfor %}

This is a list of sub-variables:

Variable Name

Description

Variable Name

Description

id

Database identifier of the order line (an integer value)

dimensions

An object containing raw dimensions of the order line. It contains the following sub-variables (floating-point values):

  • dimensions.w (width)

  • dimensions.h (height)

  • dimensions.d (depth)

Those will be in inches or mm, depending on the unit of the stlfile (note the measureUnit)

fullName

Full name of the line e.g. 100004-Clamping Connector-1

measureUnit

Unit of the stlfile. Either Inchor mm

name

Name of the line e.g. Clamping Connector

offer

An object containing info about the selected offer. It contains sub-variables:

  • offer.material (name of the material)

  • offer.technology (name of the technology)

  • offer.postProcessings(an array of objects, containing info about selected post processings. You would usually similarly iterate over those objects as over order lines:

    The following sub-variables are available:

    • pp_object.name(name of the post processing)

    • pp_object.colorTitle (color if chosen)

    • pp_object.price (price value of the post processing. Either gross or net depending on the Admin Panel setting Organizations > General Settings & Features > Show only Net Prices for customers)

preferredDueDate

Preferred due date of the order line

prices

This object contains various line prices:

  • prices.currency (currency of the order)

  • prices.unitPrice (unit price of the line)

  • prices.linePrice (total price of the line)

  • prices.printPrice (printing price of the line)

All of those prices are either gross or net depending on the Admin Panel setting Organizations > General Settings & Features > Show only Net Prices for customers

quantity

Ordered quantity of the order line

thumbnail

File download link, to download the thumbnail of the order line

unit

The same as measureUnit

weight_raw_in_grams

Weight of the order line (times the ordered quantity) in grams. So if the single ordered piece weights 50 grams, and the quantity equals 5, then this will contain 250

weight

Same as weight_raw_in_gramsbut this can either be formatted in grams or kilograms. Note the weightUnit

weightDecimals

Either 0 or 1. It should be used as an argument to floatformat Django’s function.
For example:

{{ weight|floatformat:weightDecimals }}

0 is returned if the weight is lower than 1000 grams, 1 otherwise

weightUnit

Either g or kg depending on the weight_raw_in_grams. Up to 999 grams, the unit will be g, kg otherwise

part_requirements

It contains the part-requirements-form object. This is a very complicated object. Please refer to the b3_forms2_forminstance DB table. An example of how to use it:

volume

The volume of the order line in either cm³or in³. Note the volumeUnit.

cm³is rounded to 3 decimal places

in³ is rounded to 2 decimal places

volumeUnit

Either cm³or in³, depending on the measureUnit

Order Confirmation

Only the common context

Invoice Note

Only the common context

Delivery Note

Variables

There are two differences to the common context:

  • There is one additional variable: show_thumbnails. This variable is a boolean, and the user sets it in the UI when generating the document. If set, the order line thumbnails should be displayed in the PDF

  • The order_lines variable is not available. There is a delivered_items variable instead. Please refer to the Line Variables section below

Line Variables

The order_lines variable is not available in the Delivery Note; the delivered_items variable is injected instead. It’s a slightly modified version of the order_lines. As previously, it’s a list of items, and you should iterate over it:

This is a list of sub-variables for each object:

Variable Name

Description

Variable Name

Description

order_line

It’s the same object as in the common context. The only difference is that the weight attributes are scaled to the quantity of delivered items. E.g. the weight_raw_in_gramsis no longer “Weight of the order line (times the ordered quantity)“ but “Weight of the order line (times the delivered quantity)“

delivered

A number, indicating how many copies of a given line were delivered