Table of Contents

Class OrderPromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>

Namespace
CMS.Commerce
Assembly
CMS.Commerce.dll

Abstract base class for an order promotion rule. New order promotion rules should inherit from this class. To use inbuilt properties, inherit from OrderPromotionRule.

public abstract class OrderPromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult> : PromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>, IOrderPromotionRule<TPriceCalculationRequest, TPriceCalculationResult>, IPromotionRule<TPriceCalculationRequest, TPriceCalculationResult>, IPromotionRule where TPromotionRuleProperties : IPromotionRuleProperties, new() where TPriceCalculationRequest : IPriceCalculationRequest where TPriceCalculationResult : IPriceCalculationResult

Type Parameters

TPromotionRuleProperties

Type containing promotion rule properties.

TPriceCalculationRequest

Price calculation request type.

TPriceCalculationResult

Price calculation result type.

Inheritance
object
PromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>
OrderPromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>
Implements
IOrderPromotionRule<TPriceCalculationRequest, TPriceCalculationResult>
IPromotionRule<TPriceCalculationRequest, TPriceCalculationResult>
Derived
Inherited Members
Extension Methods

Constructors

OrderPromotionRuleBase()

protected OrderPromotionRuleBase()

Methods

GetDiscountValueLabel()

Gets a human-readable label representing the discount value for display purposes.

public virtual string GetDiscountValueLabel()

Returns

string

A formatted string representing the discount value (e.g., "25%" for percentage discounts or "$30.00" for fixed amount discounts). Returns null by default if not overridden in derived classes.

Remarks

This method is typically used to populate the display label in promotion candidates, which can be shown to users in the UI. Derived classes should override this method to provide a formatted representation of the discount value based on the promotion rule properties.

GetPromotionCandidate(IPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult>)

Gets the promotion candidate that can be used for the whole order.

public abstract OrderPromotionCandidate GetPromotionCandidate(IPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult> calculationData)

Parameters

calculationData IPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult>

Price calculation data.

Returns

OrderPromotionCandidate

Promotion candidate with the order promotion amount calculated based on the order total, null if the promotion is not applicable for the order.

Remarks

The price calculation service will retrieve all applicable promotion candidates for the order. The best promotion candidate will be applied to the order total. If multiple promotion candidates have the same discount amount, the newly created promotion candidate will be applied.