This section describes the following atg.commerce.pricing
classes:
FilteredCommerceItem
Represents a CommerceItem
that is currently participating in a rules evaluation in the Qualifier. This object holds a reference to the object it is wrapping. Item
points to the wrapped CommerceItem
. All CommerceItem
methods call through to the wrapped item except for quantity
.
atg.commerce.pricing.FilteredCommerceItem
adds two properties that are used to determine if and how the wrapped CommerceItem
should participate in pricing:
quantityAsQualifierDetails
: a map ofDetailedItemPriceInfo
objects to Range objects which state which units of the details have acted as a qualifier for something.detailsRangesValidForTarget
: a map ofDetailedItemPriceInfo
objects to the number of each details that are available for discounting basic on the exclusion rules defined by various properties in Qualifier.
PricingModelHolder
atg.commerce.pricing.PricingModelHolder
is a session-scoped component that holds all a customer’s active 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, these collections are essentially a session cache of promotions.
After deployment, this service queries each pricing engine and loads the customer’s pricing models. If new promotions are given to the customer during the session, this component’s initialization methods should be called so that the PricingModelHolder
can query the pricing engines again for the new promotions.
If you create a promotion that is designed to give a discount 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 (2 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.
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.
PricingAdjustment
The atg.commerce.pricing.PricingAdjustment
class represents an element of a price’s audit trail. A chain of these objects represents all changes made to the price. These objects appear in the adjustments
list of AmountInfo
. A PricingAdjustment
is created by a pricing calculator when it modifies an AmountInfo
object.
The PricingAdjustment
class contains the following properties:
adjustmentDescription
: A short description of the adjustment that this object recorded.pricingModel
: The ID of the pricing model, if any, that adjusted the price.manualPricingAdjustment
ID of the manual adjustment that was applied to the order, if any. Manual adjustments are applied by agents using CSC; see the ATG Commerce Service Center User Guide.totalAdjustment:
The total adjustment. The total adjustment amount is calculated by multiplying the adjustment property by the quantity of the adjusted object.quantityAdjusted
: The quantity of the object whose price was adjusted.adjustment
: The unit adjustment. The price adjustment per quantity of one object. For example,CommerceItems
might have an adjustment of more than one. This value is calculated by dividing the value of thetotalAdjustment
property by the value of thequantityAdjusted
property.
PricingCommerceItem
The atg.commerce.pricing.PricingCommerceItem
is a simple CommerceItem
used as a placeholder while pricing items. This CommerceItem
cannot be added to an order.
The pricing engines can only compute prices in the context of a CommerceItem
. There may be times, however, when you want to price an entity for a customer and no CommerceItem
is available. This problem is most evident when prices are shown for products in the catalog. Products and SKUs are usually represented by RepositoryItems
, which the pricing engines do not handle. PricingCommerceItem
is an inexpensive CommerceItem
class into which you can plug the product and SKU objects. The item pricing servlet beans deal with input, which are plain RepositoryItems
, and “convert” them to CommerceItems
.
These CommerceItems
cannot be used in the default order management system. Use the OrderManager
APIs to add a CommerceItem
to an order.
PricingModelProperties
The atg.commerce.pricing.PricingModelProperties
class contains the names of properties of the ItemDescriptor
in the Promotions repository that represents pricing models.
The PricingModelProperties
class stores these names so that they may be internationalized or otherwise changed to suit a particular installation. For more information, refer to the ATG API Reference. If the name of a property descriptor is changed in the ItemDescriptor
that defines the pricing models in the Promotions repository, you must change the corresponding value here as well. For example, the PricingModelRepository
holds all pricing models. It contains an item descriptor called pricingModel
. The properties of this item descriptor need to appear in the PricingModelProperties
class.
By default, the properties have the following names:
displayName
description
creationDate
startDate
endDate
media
URL
version
global
priority
type
pricingCalculatorService
adjuster
PMDLRule
uses
beginUsable
endUsable
giveToAnonymousProfiles
discountType
allowMultiple
PMDLCacheAdapter
The atg.commerce.pricing.PMDLCacheAdapter
class is an adapter that stores PricingModels
as keys mapped to their Java object representations.