The RequiredOrderAdjustPrice component, which appears in the Order Adjust Price stage of an order processing pipeline, calculates and initializes the _oadjust_adjustedprice
and _oadjust
_discount
name/value pairs for each item in the items
SimpleList. The following example illustrates how this component works.
A site is offering a discount on an item priced at $12.00, such that if a customer purchases two items at the regular price, the customer gets a third at half that price. Suppose further that you have chosen to purchase three of these items.
When the RequiredOrderAdjustPrice component is executed, the item Dictionary for this item already contains the following name/value pairs.
Name/ | Value |
---|---|
_iadjust _currentprice |
Adjusted price of this item. |
Quantity |
Number of the items of this SKU being purchased. |
_n_unadjusted |
Number of the items identified by Quantity that do not need to have their prices adjusted. |
In this example, the value of Quantity
is 3, and the number of _n_unadjusted
is also 3, because the default value of _n_unadjusted is always (the total number of items minus the number of items purchased at the regular price). By default, the _n_unadjusted
name/value pair is equal to the total Quantity, unless it has been decremented by a previous component, such as DbOrderPromo.
To adjust the price for this item, RequiredOrderAdjust multiplies Quantity
by _n_unadjusted
, and writes the resulting value to the _oadjust
_adjustedprice
name/value pair. This value represents the total price for the items of this SKU.
Next, RequiredOrderAdjust multiplies Quantity
by the value in _iadjust
_adjustedprice
, and subtracts the adjusted price of the total items (now stored in _oadjust
_adjustedprice
) from the result. The new result represents the total discount for this item, and is written to the _oadjust
_discount
name/value pair.
If you are not running the Pipeline Editor in expert mode, the RequiredOrderAdjustPrice component is automatically inserted into the Order Adjust Price stage, but is not displayed in the Pipeline Editor user interface. This component appears in the user interface only if you run the Pipeline Editor in expert mode.