Prints the campaign's discount percentage or discount percentage range.

Description

The discount percentage is calculated automatically based on the discounts of products added to the campaign. In such case, the products' custom discounts that aren't based on the campaign's general discount percentage are taken into account too.

If the product has multiple discount prices, the tag will print a price range. The range is defined automatically based on the smallest and biggest discount.

The contents produced by the tag does not apply to the campaign's potential line discount but just to product discounts.

Syntax

{CampaignDiscount(
    mode: string,
    precision: int
)}

Scope

Required scope: kampanja

The required scope is always set in the following templates:

Templates
Campaign

Attribuutit

mode:

Defines the format in which the percentage discount should be printed.

Allowed values:

  • 'min': prints the campaign's smallest discount
  • 'max': prints the campaign's biggest discount
  • 'range': prints the range of campaign's discount percentages (e.g. 20–30%)
precision:

Defines the percentage to which the discount to be printed is rounded.

Allowed values:1, 5 & 10. The default value is 1.

For instance, for the value of 1, a precise percentage will be printed, whereas for the value of 5, the percentage will be rounded to the nearest 5 or 10.

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.'