Table of Contents

Class OrderPercentageReward

Namespace
Dynamicweb.Ecommerce.Orders.Adjustments.Rewards
Assembly
Dynamicweb.Ecommerce.dll

A reward that applies a percentage discount to the entire order.

[Experimental("DWEX100001")]
[AddInLabel("Percentage (order)")]
[AddInUseParameterSectioning(true)]
[AddInUseParameterGrouping(true)]
public sealed class OrderPercentageReward : Reward
Inheritance
OrderPercentageReward
Inherited Members

Properties

ContextType

The type of context the discount is applied to.

public override AdjustmentContextType ContextType { get; }

Property Value

AdjustmentContextType

OnlyApplyToNonDiscountedProducts

Determines if the discount should include VAT.

[AddInParameterGroup("Reward")]
[AddInParameter("OnlyApplyToNonDiscountedProductsLabel")]
[AddInLabel("Skip discounted products / order lines")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "explanation=This reward only applies to products / order lines without an existing discount. Discounted items are excluded from the reward calculation.")]
public bool OnlyApplyToNonDiscountedProducts { get; set; }

Property Value

bool

Percentage

The percentage to discount the order by.

[AddInParameterGroup("Reward")]
[AddInParameter("Percentage")]
[AddInLabel("Percentage")]
[AddInParameterEditor(typeof(NumberParameterEditor), "minValue=0d;maxValue=100d;required=true")]
public double Percentage { get; set; }

Property Value

double

Methods

ApplyReward(OrderAdjustmentContext)

Applies the discount. The way a reward is applied is up to the implementation. It can use the OrderAdjustmentContext to get a reference to the order and apply the discount to the order.

public override bool ApplyReward(OrderAdjustmentContext context)

Parameters

context OrderAdjustmentContext

The current context containing the order or orderline where the discount is being applied to, depending on the AdjustmentContextType.

Returns

bool

GetDiscountAmount(AdjustmentContext)

Gets the discount amount for the product.

public override PriceInfo? GetDiscountAmount(AdjustmentContext context)

Parameters

context AdjustmentContext

The context containing the product being fetched.

Returns

PriceInfo

The discount amount for the product.

GetDisplayValue(string)

Returns the UI display format for the discount, visible in the Discount overview screen.

public override string? GetDisplayValue(string parameterName)

Parameters

parameterName string

The name of the parameter.

Returns

string
To top