Skip to main content
Grouping discounts combine products into a discount group and grant a discount as soon as the basket reaches a quantity or goods value for that group. Which groups exist and how much discount applies from which threshold is defined in discount.dat. Which product belongs to which group is defined in the product data field “Discount group”. The GD- tags make these rules visible in the template. They are used in two ways: as a loop over all stored tiers to display a discount scale, or as a targeted query for a single discount group to output the currently granted discount on a product or in the basket. Guide: Defining discounts · Reference: discount.dat

Listing the discount scale

GD-Data has three faces. As a single tag, it outputs the number of tiers; as an area tag, it applies if there are any tiers at all; and as a loop, it runs over the tiers.
Each tier has either a quantity threshold or a value threshold, never both. That is why GD-Data_FromQuantity and GD-Data_FromPrice are also area tags: the area applies exactly for the type of threshold this tier uses and stays empty for the other. This way, you write both lines one below the other and always get the right one.
GD-Data_Discount outputs the discount rate without decimal places. For fractional rates, specify the desired number of places from 0 to 5 in the argument, for example ~GD-Data_Discount(2)~ for “7,50”.

Listing only one discount group

With an ID in the argument, the loop is restricted to the tiers of this one discount group. This is the usual case in the product view, where only the scale of the displayed product is of interest.
Within a running @GD-Data loop, there must not be a second loop with a different ID. The shop system only maintains one loop counter, and a nested loop with a different ID is rejected as an invalid tag. Therefore, list several discount groups one after the other, not inside each other.

Highlighting the tier reached

GD-Data_DiscountGranted applies for the tier that is actually granted based on the current basket. Use it to highlight in the scale where the visitor currently stands.
GD-Data_DiscountGranted only works if the loop was opened with a discount group ID in the argument. The shop system determines the granted rate when entering the loop, and it needs the ID for that. In a loop without an argument, the comparison value remains zero, and the area does not apply for any tier.
The assignment is made via the discount rate. If two tiers with the same rate are stored in a discount group, both are marked as reached. This is only noticeable with unusually structured scales.

Querying the discount of a discount group

Outside the scale, you query a discount group directly via its ID. All tags in this section expect the ID as the first argument, usually as $PR-DiscountID$ in the product view or as $BASKET-PR-DiscountID$ on the basket page.
GD-DiscountForID_Available only says that rules exist for this ID, not that a discount is currently being granted. Whether anything is actually granted is answered by GD-DiscountForID_Granted as an area tag. If you only check Available and then output the rate, you write a zero on the page when the threshold has not yet been reached.
Time-dependent tiers only apply within a stored period. GD-DiscountForID_TimeDependent detects that a discount group contains such tiers and allows you to show a corresponding notice such as “Promotional discount”.

Outputting the reference value

Two further tags output what the granted discount is based on. Use them to show the visitor how much they already have in the basket in this discount group.
These two tags are not described in the previous documentation. They behave like GD-DiscountForID_Granted and take the same arguments, but output the reference value or reference quantity instead of the discount rate.

Showing the next higher tier

With two further arguments, the tags calculate as if a certain additional value or quantity were in the basket. This lets you answer the question “What do I get if I add one more?”.
The arguments are, in order: discount group ID, decimal places, additional price, additional quantity.
The third and fourth parameters only work together. The shop system only evaluates them when all four arguments are specified. A call with only three arguments calculates with the unchanged basket, without this being noticeable. Therefore, specify the decimal places even if you want zero places.

The tags at a glance

The tags of the GD-Data_ family only apply within the @GD-Data loop. The remaining tags are permitted on all templates.
The area tags GD-Data_ID, GD-Data_FromQuantity and GD-Data_FromPrice compare with the argument if one is specified. {GD-Data_ID(VIP)} therefore only applies when iterating the discount group VIP. Without an argument, they apply if any value is present.
With GD-Data_Discount, the argument specifies the decimal places. As an area tag with an argument, the shop system nevertheless compares the number of places with the formatted discount rate, which practically never matches. Use GD-Data_Discount with an argument only as a single tag.
  • Guide: Defining discounts
  • Reference: discount.dat
  • Reference: BD- (volume discounts)
  • Reference: PR- (product data)