Table of Contents

Class CartItemPromotionRuleBase<TPromotionRuleProperties, TPriceCalculationRequest, TPriceCalculationResult>

Namespace
CMS.Commerce
Assembly
CMS.Commerce.dll

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

TPromotionRuleProperties

Type containing promotion rule properties.

TPriceCalculationRequest

Price calculation request type.

TPriceCalculationResult

Price calculation result type.

Inheritance
object
PromotionRuleBase<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 null when 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

calculationData IPriceCalculationData<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.