atg.commerce.pricing.ItemPricingEngine
is an extension of the PricingEngine
interface. It describes an object that determines prices for atg.commerce.order.CommerceItem
objects. The prices that are generated are ItemPriceInfo
objects.
An ItemPricingEngine
can determine prices in three ways:
The
priceItem
method prices an item as a single item. It reviews any promotions that are passed in through apPricingModels
parameter.The single item that is passed in is the only one available to satisfy the requirements of any promotion. For example, if the item passed in is “5 blue women’s shorts,” and there is a promotion for “Buy 7 or more blue shorts, get one pair free,” the promotion would not take effect. This call is mainly used for displaying item prices when a customer is browsing the catalog.
The
priceEachItem
method batch processes all the items that are passed in, but they are priced as if they were passed intoPriceItem
one at a time.The
priceItems
method prices all input items all in the same context. To continue with the same example, the customer now puts “6 blue men’s shorts” in the shopping cart in addition to the “5 blue women’s shorts.” While the customer is just browsing the catalog, the “Buy 7 or more blue shorts, get one pair free” promotion is not factored in when displaying prices. Therefore, when the customer makes the decision to add the shorts to the shopping cart, the price shown is still full price for all the shorts. However, when the customer subsequently displays the contents of his or her cart, the promotion takes effect and shows that one pair of shorts is free.The pricing context is defined by the method’s input parameters. In the case of
priceItem
, the context is as follows: the items to be priced, the promotions to factor, the profile of the user, the locale, and any additional parameters.The context can be important because some promotions take effect only if the item appears in a pricing context with other items. For example, a certain promotion might give 10 percent off an order if the pricing context includes one shirt and one pair of pants. The items would only receive the discount if priced in the same context.
Oracle ATG Web Commerce provides the ItemPricingEngineImpl
class as a default implementation of the ItemPricingEngine
interface. It computes the price of items both individually and in a larger context. It invokes a series of ItemPricingCalculators
.