Class CatalogPromotionRuleBase<TPromotionRuleProperties, TProductIdentifier, TPriceCalculationRequest, TPriceCalculationResult>
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
TPromotionRulePropertiesType containing promotion rule properties.
TProductIdentifierProduct identifier type.
TPriceCalculationRequestPrice calculation request type.
TPriceCalculationResultPrice calculation result type.
- Inheritance
-
objectPromotionRuleBase<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
nullby 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
identifierTProductIdentifierProduct identifier of a product to be considered for the promotion.
calculationDataIPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult>Price calculation data.
Returns
- CatalogPromotionCandidate
Promotion candidate with the value of the discount,
nullif 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.