Table of Contents

Class CatalogPromotionRuleBase<TPromotionRuleProperties, TProductIdentifier, TPriceCalculationRequest, TPriceCalculationResult>

Namespace
CMS.Commerce
Assembly
CMS.Commerce.dll

Abstract base class for a catalog promotion rule. New catalog promotion rules should inherit from this class. To use inbuilt properties, inherit from CatalogPromotionRule.

public abstract class CatalogPromotionRuleBase<TPromotionRuleProperties, TProductIdentifier, TPriceCalculationRequest, TPriceCalculationResult> : PromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>, IPromotionRule<TPriceCalculationRequest, TPriceCalculationResult>, IPromotionRule where TPromotionRuleProperties : IPromotionRuleProperties, new() where TProductIdentifier : ProductIdentifier where TPriceCalculationRequest : IPriceCalculationRequest where TPriceCalculationResult : IPriceCalculationResult

Type Parameters

TPromotionRuleProperties

Type containing promotion rule properties.

TProductIdentifier

Product identifier type.

TPriceCalculationRequest

Price calculation request type.

TPriceCalculationResult

Price calculation result type.

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

Constructors

CatalogPromotionRuleBase()

protected CatalogPromotionRuleBase()

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(TProductIdentifier, IPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult>)

Gets the promotion candidate that can be used for the specified product.

public abstract CatalogPromotionCandidate GetPromotionCandidate(TProductIdentifier identifier, IPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult> calculationData)

Parameters

identifier TProductIdentifier

Product identifier of a product to be considered for the promotion.

calculationData IPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult>

Price calculation data.

Returns

CatalogPromotionCandidate

Promotion candidate with the value of the discount, null if the promotion is not applicable for the product.

Remarks

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