Prints purchase tools (variation and customization selection) and the button with which a product can be added to the shopping cart.

Description

The purchase form should always be implemented by using this tag as our system's further development may break any custom-made purchase forms.

The tag doesn't print anything in the following situations:

  • The product is out of stock (and the sales were set to stop in stock management if the product is out of stock)
  • The product doesn't have a price

Purchase tools include the following:

  • Variation selection
  • Customization fields
  • Downloadable file selection

Syntax

{ProductBuy(
    includetax: boolean,
    stock: boolean,
    variations: string,
    variation_codes: boolean,
    variation_availability: boolean,
    variation_compare_price: boolean,
    show: string,
    quantity: string,
        values: int,
        default: int
)}

Scope

Required scope: tuote

The required scope is always set in the following templates:

Templates
Single product template
Product images

Attribuutit

includetax:

Calculates the sum to be printed either with or without VAT.

Allowed values:true/false. The default value is true.

stock:

Defines whether the product's stock balance should be printed.

Allowed values:true/false. The default value is false.

variations:

Defines the HTML selection element used for printing product variations.

Allowed values:

  • 'select': variation selection is printed as a select list (default value)
  • 'radio': variation selection is printed as radio buttons.
variation_codes:

Sets the tag to also print variation's product codes on the selection list.

Allowed values:true/false. The default value is false.

variation_availability:

Sets the tag to also print variations' stock balance.

Allowed values:true/false. The default value is true.

variation_compare_price:

Sets the tag to print also the variation's comparison price, i.e. the original price if the product has been discounted.

Allowed values:true/false. The default value is true.

show:

Defines whether to print all variations or just the variations that are available.

Allowed values:

  • 'all': prints all variations (default value)
  • 'available': prints only the variations that are currently available
quantity:

Defines the HTML element used for selecting the quantity.

Allowed values:

  • 'input': a text field is used as a selection element (default value)
  • 'select': a select list is used as a selection element
values:

Defines the values available on the quantity attribute's select list (only integers allowed).

The attribute is used only if the quantity attribute's value is 'select'.

Allowed values: pipe-separated integers. E.g. values: '1|2|3|4'.

default:

Defines the default value of the quantity attribute's select list.

The attribute is used only if the quantity attribute's value is 'select'.

Allowed values: integers

after/before:

By using the after and before attributes you can define content that is output either after or before the tag's output.

Allowed values:The HTML and Interface markup

E.g.

  • before: '<p>Tämä merkkaus näkyy ennen tagin omaa sisältöä.</p>'
  • after: '<p>Tämä taas näkyy tagin oman sisällön jälkeen.</p>'

If the tag does not produce any content, neither the content of the after and before attributes will be output.

escape:

Adds an escape character before quotation marks in the output.

The attribute makes it easier to process the tag-produced content when using JavaScript.

Allowed values:true/false. The default value is false.

or:

Defines alternative content that is displayed if the tag itself does not produce any content.

Allowed values:The HTML and Interface markup

E.g. or:'Sisältöä ei löytynyt.'