Table of Contents

Class CatalogPromotionRule<TPromotionRuleProperties, TProductIdentifier, TPriceCalculationRequest, TPriceCalculationResult>

Namespace
Kentico.Xperience.Admin.DigitalCommerce
Assembly
Kentico.Xperience.Admin.DigitalCommerce.Shared.dll

Represents a catalog promotion rule with built-in functionality for common promotion scenarios.

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

Type Parameters

TPromotionRuleProperties

Promotion properties type. Must inherit from CatalogPromotionRuleProperties to use built-in 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>
CatalogPromotionRule<TPromotionRuleProperties, TProductIdentifier, TPriceCalculationRequest, TPriceCalculationResult>
Implements
IPromotionRule<TPriceCalculationRequest, TPriceCalculationResult>
Inherited Members
Extension Methods

Remarks

This class extends CatalogPromotionRuleBase<TPromotionRuleProperties, TProductIdentifier, TPriceCalculationRequest, TPriceCalculationResult> and provides:

Use this class when you need standard catalog promotion functionality. For custom promotion logic, inherit from CatalogPromotionRuleBase<TPromotionRuleProperties, TProductIdentifier, TPriceCalculationRequest, TPriceCalculationResult> instead.

Constructors

CatalogPromotionRule()

public CatalogPromotionRule()

Methods

GetDiscountAmount(decimal)

Gets the discount amount based on the given unit price and discount value specified in TPromotionRuleProperties.

protected decimal GetDiscountAmount(decimal unitPrice)

Parameters

unitPrice decimal

Item unit price.

Returns

decimal

Discount amount.

GetDiscountValueLabel()

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

public override 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.