You probably know that ATG Commerce offers a wide range of pricing features for eCommerce stores through its Pricing Services. How does it do it? The short answer is through Pricing Engines and Calculators.
Lets take a look at the following scheme in order to understand how they work and how the final subtotal is calculated.
1. All Pricing Engines load global promotions (ones that apply to all customers) on a regular basis. Each pricing Engine loads promotions of its type; i.e. an ItemPricingEngine – promotions for items, an OrderPricingEngines promotions for orders, etc.
2. Customers have a handle on the promotions that may apply to them on their profile – the activePromotions property. This includes promotions that may have been applied via targeters or scenarios.
3. When a customer creates a shopping cart (adds an item to the cart) an ItemPricingEngine loads item-level promotions for that particular customer.
4. An ItemPricingEngine determines the right Item Pricing method, of which there are 3:
Price Item Method. Items added to the cart at the same time will be priced as a single item.
E.g. A customer adds 5 shirts to the cart and then adds 3 more. An ItemPricingEngine will price them as 2 single items.
Price Each Item Method. Each item added to the cart will be priced as a single item by an ItemPricingEngine (regardless if all of them were added separately or at the same time).
E.g. A customer adds 5 shirts to the cart and then adds 3 more. An ItemPricingEngine will price them as 8 single items.
Price Items Method. All items that have been added to the cart at any time can be priced as a single item that allows ATG to apply such promotions as ‘buy X items and get free item/shipping or discount’.
E.g. A customer adds 5 shirts to the cart and then adds 3 more. An ItemPricingEngine will price them as 1 single item.
5. An ItemPricingEngine invokes ItemPricingCalculators that look up individual items’ prices in the catalog. There are 4 price lists that ItemPricingCalculators look up prices in:
Item Price List;
Item Price List Sale;
Configurable Item Price List;
Configurable Item Price List Sale.
There is a hierarchy of price lists that you can set up. Based on that hierarchy ItemPricingCalculators check the most prioritized list first and either return an initial item price to the engine or check the next prioritized list for the price (in case the price is not provided for the item in the previous list). The process ends when ItemPricingCalculators find the list containing an item price and returns it to the Engine.
6. An ItemPricingEngine uses a helper method in the Qualifier class to determine what (if anything), when and how can be discounted.
7. An ItemPricingEngine invokes appropriate ItemPricingCalculators that apply promotions and return updated item prices.
8. An OrderPricingEngine loads order-level promotions for the customer.
9. An OrderPricingEngine invokes OrderPricingCalculators that calculate the initial order’s subtotal by summing up items’ prices.
10. An OrderPricingEngine uses a helper method in the Qualifier class to determine whether any order-level promotion is applicable and, if so, how the order can be discounted.
11. An OrderPricingEngine invokes OrderPricingCalculators that apply promotions and return an updated order subtotal.
12. A ShippingPricingEngine loads shipping-level promotions for the customer.
13. A ShippingPricingEngine determines the right shipping method based on the customer’s preferences. There are 3 standard shipping methods customers can choose from:
2 Day Shipping Method that has the same fixed shipping price for all orders.
Next Day Shipping Method that has the same fixed shipping price for all orders.
Ground Shipping Method determines price based on the order subtotal.
14. A ShippingPricingEngine invokes ShippingPricingCalculators that calculates shipping prices and returns an updated initial order subtotal.
15. A ShippingPricingEngine uses a helper method in the Qualifier class to determine whether any shipping-level promotion is applicable and, if so, how the order can be discounted.
16. A ShippingPricingEngine invokes ShippingPricingCalculators that apply promotions and return an updated order subtotal.
17. A TaxPricingEngine loads tax-level promotions for the customer. This is in reality rarely implemented.
18. A TaxPricingEngine invokes TaxPricingCalculators that determine how taxes should be calculated. By default taxes are $0. If ATG Commerce is integrated with any tax-calculating software (e.g. Cybersource or TaxWare) then TaxPricingCalculators determine taxes through that software and return an updated order subtotal that also includes taxes.
19. A TaxPricingEngine uses a helper method in the Qualifier class to determine whether any tax-level promotion is applicable and, if so, how the order can be discounted.
20. A TaxPricingEngine invokes TaxPricingCalculators that apply tax-level promotions and returns an updated order subtotal. This is the final price that the customer will have to pay to complete the check out process.
The information provided here is a generic explanation of how ATG Pricing Services work. If you need a more detailed explanation of this topic you can read the Oracle ATG Commerce official documentation that has been used as the basis for this post.
hi Are you sure that atg provides tax discounts? as per documentation its doesent provide helper method in the qualifier for tax since the tax should not be discounted.
-Shobby
Hi Shobby,
While it is rarely used, ATG allows you to apply promotions to taxes. Here is the part of the Oracle documentation that talks about it a bit https://docs.oracle.com/cd/E24152_01/Platform.10-1/ATGCommProgGuide/html/s0903defaulttaxpricingengine01.html. You can also find info about NoTaxCalculator, TaxDiscountCalculator, BulkTaxDiscountCalculator and TaxProcessorTaxCalculator here (https://docs.oracle.com/cd/E24152_01/Platform.10-1/ATGCommProgGuide/html/s1003notaxcalculator01.html). Hope it helps!
Thanks,
Elena
Hi Elena, appreciate your effort in explaining complexes in easier way. Being a fresher to atg, this post really helped me to understand the high level of pricing. Could you please share the diagrammatic representation with explanation on how an order will be created and how the pipeline will be invoked. And until when the pipeline executed. Also please share the catalog construction and its details. Hope this could help others who are new.
Nice Diagram . Excellent Explanation :-)
Thank you, Srinath! :)
Hi Elena,
i liked the way how drafted it was very helpful, i work for ATG BI Data Warehouse project, was wondering do you have any mapping document that talks relation between DCS_xxx tables from oracle commerce to DW ARF_Xxxx tables?
Regards:
Bhasker.V
Jsglp
Hi Bhasker,
I am glad this post was of use to you. Unfortunately, I don’t have the document that you are looking for.
Elena
Hi Margaret,
There are multiple components, but they should be of different classes.
/atg/commerce/pricing/calculators/ItemPriceListCalculator
Class: atg.commerce.pricing.priceLists.ItemPriceCalculator
and
/atg/commerce/pricing/calculators/PriceListsListCalculator/
Class: atg.commerce.pricing.priceLists.ItemListPriceCalculator
when you are using PriceLists.
ItemPriceListCalculator determines what the price should be, e.g. if the item is marked on sale it will return the sale price.
PriceListsListCalculator will give you the list price, regardless of whether it is on sale or not.
This is useful in presentation when you want to strike thru the original price and say what the actual price is.
Hi Elena,
Thanks for the brief insight of the pricing mechanism. It’s a great article.
I’m looking out for a difference between ItemListPriceCalculator and PriceListsListCalculator. Both of these components are of class ItemListPriceCalculator. I’m wondering when to use which component (out of these two) in case of List Price determination.
Thanks,
Margaret
Hi Diwakar,
Thank you for your feedback!
Information on qualifiers is in chapter 12 of the ATG Commerce Programming guide (http://docs.oracle.com/cd/E22630_01/Platform.1002/pdf/ATGCommProgGuide.pdf). There is a really good overview there.
There are 3 procing engines: Item, Order, and Shipping – each calls the qualifiers’ findQualifyingX method (items, order, shipping) to see if there are things that qualify. The qualifiers have a rule set that the engine compares to for the given promotion.
Hi elena,
Can you please elaborate on qualifiers who will call this Qualifiers (Engines or Calculators ).
Very good and useful post thanks for posting this details .
This is Good one! Nicely explained, diagram helps to a great deal. Thank you.
Excellent Post Very Useful for ATG Progs… please keep Posting More concepts in ATG indepth.
Hi Elena…
Very nice post.It is very useful.
Thank you
Thank you, Maheswari! I am glad you found it helpful.
Nice Post. Informative
Thank you, Bhanu!
[…] read on “ATG Commerce Pricing @ Spark::red”. Also read the comments – may provide additional insight to the article details & […]
hi elena
again thank you for your support,
regards
shyajc
Hi Shyam,
Here is a link to the latest ATG Commerce Programming Guide. It includes Appendix G.
http://docs.oracle.com/cd/E22630_01/Platform.1002/pdf/ATGCommProgGuide.pdf
Good luck!
hi elena,
thanks for your response,
There is no Appendix G in the ATG Commerce Programming Guide
regards
shyajc
preCalculators:
After PricingEngine determines the right pricing method, it invokes preCalculators that look up initial prices (without applying any promotions). It’s step 5 in the post.
postCalculators:
1. Qualifier determines what, when and how an item should be discounted.
2. PricingEngine processes applicable promotions one at a time by priority.
3. While processing any promotions PricingEngine invokes postCalculators that modify the price.
Hi Shyam,
In regards to your first question:
the base cart modifier form handler executes the commerce pipeline servlet chains when items are added to order, removed from order, etc. The servlet chain is basically a set of processors that execute in sequence, making individual updates to the order – for price changes, application of promotions, shipping group updates, etc etc. They are the ones calling the pricing engine.
You don’t call the engines etc directly from the form handler – it is all abstracted so it happens pretty much automatically as long as you use/extend the out of box form handlers.
Take a look at Appendix G in the ATG Commerce Programming Guide for more details.
Best,
Elena
hi,
In above diagram , when pre and post calculator will be called
regards
shyajc
hi, thanks for your reply , i already studied in commerce programming guide,
just want to know how that will call from java class
regards
shyajc
Hi Shyam,
Thank you for your comment. If you take a look at the ATG Commerce Programming Guide’s ‘How Pricing Services Generate Prices’ chapter it gives a detailed explanation of how promotions are loaded. Here’s just a part of it:
‘1. At the start of the customer session, a PricingModelHolder instance is created. PricingModelHolder calls each pricing engine’s getPricingModels() method.
2. The pricing engine getPricingModels() method gets any promotions listed in the activePromotions property of the current customer’s profile and merges them with the global promotions list it previously created’.
Therefore, it is the pricing engine getPricingModels method that loads customer’s promotions.
In this particular post I was trying to give a general explanation of how ATG pricing services work for people new to ATG (this is the goal for all posts in the ATG Commerce Overview category). For this purpose, I minimized the use of ATG-specific terms as long as it doesn’t change the meaning of the post. Therefore I used ‘ItemPricingEngine’ instead of ‘ItemPricingEngine getPricingModels method’.
I hope I answered your question.
Best,
Elena
3. When a customer creates a shopping cart (adds an item to the cart) an ItemPricingEngine loads item-level promotions for that particular customer.
in which class it call itemPricingEngine while adding item to cart
its generally calls CartModifier,PurchaseProcessHelper,OrderHolder,OrderTools
regards
shyajc