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.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.
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.
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 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.Related topics
- Guide: Defining discounts
- Reference: discount.dat
- Reference: BD- (volume discounts)
- Reference: PR- (product data)
