Class CartItemPromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>
Abstract base class for a cart item promotion rule. New cart item promotion rules should inherit from this class.
public abstract class CartItemPromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult> : PromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>, IPromotionRule<TPriceCalculationRequest, TPriceCalculationResult>, IPromotionRule where TPromotionRuleProperties : IPromotionRuleProperties, new() where TPriceCalculationRequest : IPriceCalculationRequest where TPriceCalculationResult : IPriceCalculationResult
Type Parameters
TPromotionRulePropertiesType containing promotion rule properties.
TPriceCalculationRequestPrice calculation request type.
TPriceCalculationResultPrice calculation result type.
- Inheritance
-
objectPromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>CartItemPromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>
- Implements
-
IPromotionRule<TPriceCalculationRequest, TPriceCalculationResult>
- Inherited Members
- Extension Methods
Constructors
CartItemPromotionRuleBase()
protected CartItemPromotionRuleBase()
Methods
GetDiscountValueLabel()
Gets a short label that shows the discount value, for example "15%" or "$10.00".
public virtual string GetDiscountValueLabel()
Returns
- string
The label, or
nullwhen the rule does not supply one.
GetPromotionCandidates(IPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult>)
Gets the promotion candidates that can be used for the cart item.
public abstract IReadOnlyList<CartItemPromotionCandidate> GetPromotionCandidates(IPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult> calculationData)
Parameters
calculationDataIPriceCalculationData<TPriceCalculationRequest, TPriceCalculationResult>Price calculation data.
Returns
- IReadOnlyList<CartItemPromotionCandidate>
One candidate for every cart item the promotion discounts, each with the value of the discount and the number of units covered; an empty list when the promotion does nothing for this cart.
Remarks
The price calculation gets all promotion candidates once for the whole cart, not once per cart item, because the promotion can depend on the whole cart content.