OrderLevelDiscountApply

Use the OrderLevelDiscountApply pipeline component to apply order-level subtotal discounts.

Intended use: Order Processing pipeline, Order Adjust Price stage.

In the Component Properties dialog box, on the Order Level Discount tab, do the following:

Use this

To do this

Apply discounts to all items

Apply order level discounts to all items in the order form.

Apply discounts to items where the following key exists and the corresponding value is nonzero

Apply order level discounts only to items in the order form where the specified item dictionary key exists and the corresponding value is nonzero.

Click Apply to save your changes.

Values Read

The OrderLevelDiscountApply pipeline component reads the following values from the indicated dictionaries.

Key

Dictionary

Description

item._cy_iadjust_currentprice

Order

Required. The current price of all the line items.

Type: Currency (VT_CY)

item.quantity

Order

Required. The total quantity of all the line items.

Type: Integer (VT_I4)

item._cy_oadjust_adjustedprice

Order

Optional (default is 0.0). The total price of all the items, after all the discounts have been applied.

Type: Currency (VT_CY)

Dd452010.alert_note(en-us,CS.95).gifNote:
Total price for the line item can be computed as the following:
Dd452010.alert_note(en-us,CS.95).gifNote:
_n_unadjusted*_cy_iadjust_currentprice+_cy_oadjust_adjustedprice

item._n_unadjusted

Order

Optional (default is equal to the quantity). The quantity of line items that have not been adjusted by the OrderDiscount component or other discounting components (number of line items that are eligible to serve as discount conditions and receive discount awards).

Type: Integer (VT_I4)

_orderlevel_discounts_detail

Order

This component reads discount_basket_display value from each entry. This is a dictionary that maps special offer types to a list of order level discounts that applies for that special offer type.

Each element is a dictionary. The exact format of the dictionary depends on whether the element represents a combination of percentage-off discounts of the same priority, or a single discount.

The following are the dictionary entries if the element represents a single discount:

  • discount_id: Integer (VT_I4)

  • discount_timestamp: Last-modified timestamp of the discount (VT_DATE)

  • discount_name: Discount name (VT_BSTR)

The following are the dictionary entries if the element represents a combined percentage-off discount:

  • discounts_combined: A SimpleList object that describes each of the discounts that were combined. Each element in this list is a dictionary with the following keys:

    • discount_id: Integer (VT_I4)

    • cy_discount_percentage: Value (VT_CY)

    • discount_timestamp: Last-modified timestamp of the discount (VT_DATE)

    • discount_name: Discount name (VT_BSTR)

The following are the dictionary entries that exist in both cases:

  • discount_priority: Priority (rank).

  • discount_type: 1=Currency; 2=Percentage (VT_I4).

  • cy_discount_value: Currency or percentage value (VT_CY). If the element represents a combined percentage-off discount, this is the total percentage.

The order the elements appear in the list is significant, because it is the order that OrderDiscount has determined they should be applied.

Type: Currency (VT_CY)

Dd452010.alert_note(en-us,CS.95).gifNote:
This is the list that is used by OrderDiscount to specify to other pipeline components the complete list of order level discounts that should be applied to the basket.

SiteName

Context

Optional. Used only for reporting the site name as part of several limited error messages that may be reported to the event log.

Type: String

Values Written

The OrderLevelDiscountApply pipeline component writes the following values to the Order dictionary.

Key

Description

item._cy_oadjust_adjustedprice

Not always written (default is 0.0). The total price of all the items, after all the discounts have been applied.

Type: Currency (VT_CY)

Dd452010.alert_note(en-us,CS.95).gifNote:
The price for the line item can be computed as the following:_n_unadjusted*_cy_iadjust_currentprice+_cy_oadjust_adjustedprice
Dd452010.alert_note(en-us,CS.95).gifNote:
If a discount applies to this line item, the whole quantity is considered adjusted. Therefore, it will be the total price for the line item after all item level and order level discounts are applied.

item._n_unadjusted

Not always written (only for items to which a discount will apply by this component). The quantity of items in this line that have not been adjusted.

Type: Integer (VT_I4)

Dd452010.alert_note(en-us,CS.95).gifNote:
If a discount applies to this line item, the whole quantity is considered adjusted. Therefore, it will be set to zero.

_orderlevel_discounts_applied

Optional. This component writes discount_basket_display into each entry in the list. This is a SimpleList of Dictionaries where each Dictionary contains information about an order-level discount that was applied to the order. The order of the list is significant and represents the order in which the discounts were applied to this line item. This key is written even if the discount applied has no affect the price.

The dictionary contains the following elements for each discount:

  • discount_id: Campaign item ID (VT_I4)

  • discount_priority: Discount priority (rank) (VT_I4)

  • discount_timestamp: Last-modified timestamp of the discount (VT_DATE)

  • cy_discount_amount: How much was actually taken off of the item (VT_CY)

  • discount_type: 1=Currency value; 2=Percentage (VT_I4)

  • cy_discount_value: Currency value or percentage value (VT_CY)

  • discount_name: Discount name (VT_BSTR)

Type: Dictionary (VT_DISPATCH)

item._cy_orderlevel_discounts_subtotal

Optional. Not always written (only written if one or more order level discounts apply to the line item). The sum of all order level subtotal discounts applied to this line item. This key is written even if the discount applied has no affect the price.

Type: Currency (VT_CY)

See Also

Other Resources

Discount Objects

CSFLoadDiscounts

CSFScoreDiscounts

ShippingDiscountAdjust