Deprecated feature

OrderCalculate URL

Determines a list of catalog items to be included in an order, adds them to the order by calling OrderItemAdd if they are not already in it, and recalculates specified CalculationUsages.

URL

OrderCalculate

Controller command

com.ibm.commerce.order.commands.OrderCalculateCmd

Implementation class

com.ibm.commerce.order.commands.PromotionEngineOrderCalculateCmdImpl ( default )

com.ibm.commerce.order.commands.OrderCalculateCmdImpl ( optional )

Note: OrderCalculateCmdImpl reduces the inventory operations for removing and adding free gifts when recalculating orders. OrderCalculateCmdImpl is recommended as the implementation class if any performance issues are caused by the number of free gift operations. If customization has been performed on the default PromotionEngineOrderCalculateCmdImpl, continue to use the default implementation class to maintain the customization.

Commands called

ResolveOrderItemPricecmd

CalculateOrderCmd

URL structure

http:// host_name/path/
The fully qualified name of your Transaction server and the configuration path.

Parameter values

orderId
Gives the reference number of the order to be displayed. If this parameter is omitted, the OrderCalculate command behaves as if all of the customer's orders for the specified store were included. Abbreviations may be used, but only with pending orders. See the Order abbreviations for a description of the abbreviations. This parameter can be repeated.
calculationUsageId
Required: Gives predefined codes for calculation of discounts (-1), shipping (-2), sales tax (-3), shipping tax (-4), coupons (-5), surcharge (-6) and shipping adjustment (-7). This parameter can be repeated.
outOrderName
Specifies the name-value pairs to be passed to a JSP file. The value of each added name-value pair is the reference number of the order to be displayed. If the name is not provided, the default name (orderId) is used.
keepAutoAddedOrderItemsBeforeCalculate
Indicates if the automatically-added order items in the order need to be kept (true) or removed (false) before the order is recalculated. The default value is false.
updatePrices
Specifies whether the price of the items should be refreshed during OrderCalculate. If the value is 1, it means price will be refreshed. The price is not refreshed by default if the value is other than one.
doPrice
Specifies whether the command should perform the price calculation subtasks. Set to either do the price tasks (Y), or not (N). Turning off these tasks might result in better performance, but customers might not get the most current price, or product entitlement, when changes occur.

Example 1

In the following example OrderCalculate updates an order item with any applicable discounts before displaying it (by way of a redirect to OrderItemDisplay):

http://
myhostname/webapp/wcs/stores/servlet/OrderCalculate?calculationUsageId=-1
&URL=OrderItemDisplay&storeId=10101&catalogId=10101

Example 2

In the following example, the optional doPrice parameter is used. As the value is N, the price for each order item in the order is not refreshed unless the item is expired.
http://
myhostname/webapp/wcs/stores/servlet/OrderCalculate?calculationUsageId=-1
&orderId=123&updatePrices=1&doPrice=N&URL=OrderItemDisplay&storeId=10101&catalogId=10101

Behavior

If updatePrices = 1:

Call ResolveOrderItemPriceCmd to calculate the best price and update the order total.

Pass in parameter doPrice to ResolveOrderItemPriceCmd to control whether the order items can skip pricing again.

Call CalculateOrderCmd to do the calculation based on the calUsageIds passed in.

Exception conditions

CalculationUsageId is a required parameter. If it is not provided, a missing parameter exception is thrown.