ShippingDiscountAdjust

Use this component to apply either currency value or percentage value shipping discounts to an order. Shipping discounts apply to an order at the cumulative level, as apposed to an item-specific level, which makes shipping discounts similar to an order-level discount.

Intended use: Order Processing pipeline, Shipping stage, following the Commerce.ShippingMethodRouter component.

Configuration Values

None.

Values Read

The ShippingDiscountAdjust component reads the following values from the indicated dictionaries.

Key Dictionary Description
_currency_decimal_places Order Optional (if not set, the _currency_lcid key must be set, and the number of currency decimal places will be the default for that locale). Describes the number of digits of precision (after the decimal point) for which to round certain intermediate results, and to round to when writing currency values into the OrderForm.

Type: Integer (VT_I4)

_currency_lcid Order Optional (required only if the _currency_decimal_places key is not set, otherwise it is ignored). Describes a locale (LCID) to use to retrieve the number of currency decimal places.

Type: Integer (VT_I4)

_cy_shipping_total Order Required. The total shipping charges for the entire order as computed by a component such as ShippingMethodRouter.

Type: Currency (VT_CY)

Ee796466.note(en-US,CS.20).gifNote

  • If the shipments key is set, then this value will not be used on input, however, it will be modified on output.
_orderlevel_discounts_detail Order Optional (if this key does not exist in the OrderForm, or if the shipping_discount key of this dictionary does not exist, then the _cy_shipping_discounts_total value is set to zero, and no other action is taken). A dictionary that maps special offer types to a list of order level discounts that applies for that special offer type. The SimpleList object under the shipping_discount special offer type key is used.

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.

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)

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

  • discounts_combined: 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: Llast_modified tiemestamp of the discount (VT_DATE)
    • discount_name: Discount name (VT_BSTR)

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)

Ee796466.note(en-US,CS.20).gifNote

  • This is the list used by OrderDiscount to specify to other pipeline components the complete list of order level discounts that should be applied to the basket.
Shipments Order Optional (if the Splitter component is not used, the order will be treated as one single shipment for purposes of applying shipping discounts). The list of shipments in this order, as created by the Splitter component.

Type: IDictionary (VT_DISPATCH)

shipments._cy_shipping_total Order Required. The shipping totals for each individual shipment, as computed by a component such as ShippingMethodRouter.

Type: Currency (VT_CY)

SiteName Context Optional. Used only for reporting the site name as part of some limited error messages, which may be reported to the Event log.

Type: String

Values Written

The ShippingDiscountAdjust component writes the following values to the Order dictionary.

Key Description
_cy_shipping_total Not always written (modified only if one or more shipping discounts apply). The total shipping charges for the order with the discounts (if any) applied.

Type: Currency (VT_CY)

_cy_shipping_discounts_total Always written (if no shipping discounts apply, this is set to zero). Sum of all shipping discounts applied to the order.

Type: Currency (VT_CY)

_shipping_discounts_applied Not always written (only written when no shipments list exists in the OrderForm, and one or more shipping discounts apply). A SimpleList of dictionaries where each dictionary contains information about a shipping discount that was applied to this shipment. The order of the list is significant and represents the order in which the discounts were applied to the shipment.

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)

shipments._cy_shipping_total Not always written (modified only if one or more shipping discounts apply). The total amount of shipping charges for the shipment after shipping discounts have been applied.

Type: Currency (VT_CY)

shipments._cy_shipping_discounts_subtotal Not always written (only written if one or more shipping discounts apply to the shipment). The sum of all shipping discounts applied to this shipment.

Type: Currency (VT_CY)

shipments._shipping_discounts_applied Not always written (only written if one or more shipping discounts apply to the shipment). A SimpeList of dictionaries where each dictionary contains information about a shipping discount that was applied to this shipment. The order of the list is significant and represents the order in which the discounts were applied to the shipment.

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)

Remarks

In Commerce Server 2002 pipelines, the ShippingDiscountAdjust component is used to provide free shipping by writing zero (0) for the _cy_shipping_total key.

For more information about extending the ShippingDiscountAdjust component, see Order Level Discount Pipeline Components.

See Also

OrderLevelDiscountApply

Shipping Object

ShippingManagerCache

ShippingMethodManager Object

ShippingMethodRouter

StepwiseShipping

Copyright © 2005 Microsoft Corporation.
All rights reserved.