This section provides an overview of the way ATG Commerce uses pricing services to calculate prices.
A pricing engine is invoked from business-layer logic, such as a
PriceItem
servlet bean in a page or from the ATG CommercePricingTools
class. This usually occurs during checkout. (See PricingTools Class for more information.)The pricing engine applies its configured precalculators. A precalculator modifies a price without using any associated promotions. For example, a site could use a list price precalculator or an order subtotal precalculator to establish a base price to which subsequent calculators then apply a discount. All the precalculators (defined in
ItemPricingEngine
) are executed in order. This includes:listPrice
(fixed price, bulk price, tiered price)salePrice
(if item is on sale)
The pricing engine accesses the current customer’s profile and retrieves any promotions listed in the
activePromotions
property of the profile. (You create promotions in the ATG Control Center. For more information, see Creating Promotions.)Note: The list of promotions that the business logic passes to the pricing engine often comes from the engine itself through its
getPricingModels
method. This method looks at theactivePromotions
property to find all promotions associated with a given profile.The pricing engine builds a list of global promotions (ones that you define as applying automatically to all customers). It builds the list by using its
globalPromotionsQuery
property to query the Promotions repository, searching for any promotion whose Automatically Give to All Customers (global
) property is set totrue
.The resulting lists are concatenated. The pricing engine processes one at a time the objects for which it is tasked with generating a price. It applies promotions by priority.
Note: You can also specify a priority level for any promotion by setting its Order of Application (
priority
) property in the Promotion repository. The pricing engine sorts the promotions by this property before it applies them.For each available promotion, ATG Commerce does the following:
Each promotion has a
pricingCalculatorService
property that specifies the calculator that the system must use to apply it. The engine looks up the specified calculator in Nucleus and invokes it, passing in the referring promotion.The promotion calculator consults the qualifier service to get a list of objects that qualify for the discount.
The calculator marks any items that it uses as qualifiers for the promotion. This behavior prevents the qualifier items from being used again during the same price calculation.
The calculator applies the discount to the list of objects.
The pricing engine applies its configured
PostCalculators
, which make any necessary modifications to the price after any discounts have been applied.The pricing engine modifies the
PriceInfo
object of the object being discounted.
This process is repeated every time a price is requested.