The atg.commerce.pricing.PricingModelHolder class is a session-scoped component that holds the merged list of a customer’s active and global promotions while he or she is using the Web application. The pricing engine APIs define a method for collecting a customer’s pricing models. Because it can be resource intensive to perform this operation, the PricingModelHolder is essentially a session cache of promotions.

If a new promotion becomes available during a user’s session, the user’s promotions must be reloaded for the user to see this new discount. The reinitializeTime property in the pricingModelHolder is set to reload a user’s promotions every 10 minutes by default. You can change this time if desired. Setting the reinitializeTime property to a smaller value (two minutes) will affect performance, but will minimize the risk of a user missing a promotion that is added during his or her session. You should consider changing the reinitializeTime value if new promotions are added frequently. You should also decrease this value if promotions are being delivered by scenarios with short delays in them, for example, giving a promotion two minutes after a user logs in.

Before adding a promotion to the list, the PricingModelHolder runs a series of checks to eliminate as many promotions as possible from consideration (for example, a “buy one rain hat, get a free umbrella” promotion where the customer’s cart does not contain a rain hat). This saves considerable processing effort, as fewer promotions have to be evaluated at pricing time.

The PricingTools class uses PricingModelHolder to perform order pricing. Each pricing engine takes only the collection of pricing models related to its own type as a parameter. For example, order pricing engines take only the pricing models related to order pricing. The PricingTools method, which accepts a PricingModelHolder, extracts individual collections and passes the collections into the appropriate pricing engines.

Developers should not create an instance of this class and call into the PricingTools class. Instantiate an instance of this class only as a session-scoped component that can be resolved through the request. This is the pattern that the item pricing servlet beans use. If no pricing models are supplied as explicit parameters, the PricingModelHolder is resolved from the request, and the collection is retrieved.

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices