This section describes the following ATG Commerce pricing interfaces:
ItemPricingEngine Interface
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 methods’ 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.
ATG Commerce provides the ItemPricingEngineImpl
class as a default implementation of the ItemPricingEngine
interface. For more information, see Item, Order, Tax, and Shipping Pricing Engine Classes.
ItemPricingCalculator Interface
atg.commerce.pricing.ItemPricingCalculator
modifies the price of a CommerceItem
.
The item pricing engine invokes each calculator’s priceItem
, priceEachItem
, or priceItems
method. The calculator’s priceItem
method modifies the input priceObjects
according to the current pricing context. The specific way in which the calculator modifies an item price varies according to individual implementations.
ATG Commerce includes several classes that are implementations of the ItemPricingCalculator
interface. For example, it includes the atg.commerce.pricing.ItemListPriceCalculator
class, which you can use to determine an initial price for an item without any discounting. For more information on this class and other classes that implement this interface, see Pricing Calculator Classes.
OrderPricingEngine Interface
atg.commerce.pricing.OrderPricingEngine
is an extension of the PricingEngine
interface. It describes an object that determines prices for Order
objects (the total price of all items in a customer’s shopping cart). An OrderPricingEngine
uses the priceOrder
method to determine the price of an order.
The pricing context is defined by the priceOrder
method’s input parameters. Implementations of this interface create an OrderPriceInfo
object that accurately represents the price of an input order
. The way in which they do this is depends on the implementation. The specific way in which the engine creates the order object varies according to individual implementations.
ATG Commerce provides the OrderPricingEngineImpl
class as a default implementation of the OrderPricingEngine
interface. For more information, see Item, Order, Tax, and Shipping Pricing Engine Classes.
OrderPricingCalculator Interface
The OrderPricingCalculator
interface, atg.commerce.pricing.OrderPricingCalculator
, modifies the price of an order.
The order pricing engine invokes the priceOrder
method of the OrderPricingCalculator
(or calculators) that it is configured to use. The priceOrder
method modifies the input pPriceQuote
according to the current pricing context. The specific way in which the calculator modifies an order price varies according to individual implementations.
ATG Commerce includes several classes that are implementations of the OrderPricingCalculator
interface. For example, it includes the atg.commerce.pricing.OrderSubtotalCalculator
class, which you can use to calculate the raw subtotal for an order before any discounts are applied. For more information on this class and other classes that implement this interface, see Pricing Calculator Classes.
ShippingPricingEngine Interface
atg.commerce.pricing.ShippingPricingEngine
is an extension of the PricingEngine
interface. It describes an object that determines prices for ShippingGroup
objects.
Implementations of this interface determine the cost of shipping the contents of a shipping group. The priceShippingGroup
method asks this object to determine a price for the specified shipping group. The getAvailableMethods
call returns the methods available for shipping the specified group.
ATG Commerce provides the ShippingPricingEngineImpl
class as a default implementation of the ShippingPricingEngine
interface. For more information, see Item, Order, Tax, and Shipping Pricing Engine Classes.
ShippingPricingCalculator Interface
The ShippingPricingCalculator
interface, atg.commerce.pricing.ShippingPricingCalculator
, modifies a price object that represents the cost of shipping for an order.
The shipping pricing engine invokes the priceShippingGroup
method of the ShippingPricingCalculator
(or calculators) that it is configured to use. The priceShippingGroup
method modifies the input pPriceQuote
according to the current pricing context. The specific way in which the calculator modifies a shipping price varies according to individual implementations.
ATG Commerce includes several classes that are implementations of the ShippingPricingCalculator
interface. For example, it includes the atg.commerce.pricing.ShippingDiscountCalculator
class, which you can use to apply a promotional discount to the shipping price of an order. For more information on this class and other classes that implement this interface, see Pricing Calculator Classes.
TaxPricingEngine Interface
atg.commerce.pricing.TaxPricingEngine
is an extension of the PricingEngine
interface. It describes an object that determines taxes for Order
objects.
Implementations of this interface determine the price for the tax associated with a specified order object. The interface provides one way to ask for a tax price. Calling code provides the pricing context by inputting the order, any pricing models (promotions), a locale in which the pricing should occur, the current profile, and any additional parameters.
ATG Commerce provides the TaxPricingEngineImpl
class as a default implementation of the TaxPricingEngine
interface. For more information, see Item, Order, Tax, and Shipping Pricing Engine Classes.
TaxPricingCalculator Interface
The atg.commerce.pricing.TaxPricingCalculator
interface modifies the price of tax for an order.
The tax pricing engine invokes the priceTax
method of the TaxPricingCalculator
(or calculators). The calculator’s priceTax
method modifies the input pPriceQuote
according to the current pricing context. The specific way in which the calculator modifies a tax price varies according to individual implementations.
ATG Commerce includes several classes that are implementations of the TaxPricingCalculator
interface. For example, it includes the atg.commerce.pricing.NoTaxCalculator
class, which you can use for situations in which a sales tax of zero is applicable for an order. For more information on this class and other classes that implement this interface, see Pricing Calculator Classes.
PricingConstants Interface
The atg.commerce.pricing.PricingConstants
interface contains constant values for static reference by other classes in the atg.commerce.pricing
package.