The abstract class atg.commerce.pricing.ItemPriceCalculator is the parent class for many item pricing calculators (for example, ItemListPriceCalculator and ItemSalePriceCalculator), consolidating the functionality that these calculators have in common.

This class determines a price for an object based on a pricesource object and the properties of that pricesource. It contains a single abstract method, priceItems. Extending classes implement this method to leverage the other item pricing functionality that this class provides.

The ItemPriceCalculator class also contains the following properties:

ItemPriceCalculator determines an item’s price based on a property value. The property value comes from a priceSource object. The priceSource object can be one of two objects, depending on the boolean value of the priceFromCatalogRef property.

The catalogRef property of items to be priced points to a SKU in the SKU catalog. The productRef property points to a product in the product catalog. For more information, see the atg.commerce.order.CommerceItem entry in the ATG Platform API Reference.

The pricePropertyName in the ItemPriceCalculator (and therefore the ItemListPriceCalculator and ItemSalePriceCalculator, which extend ItemPriceCalculator) identifies the property on the priceSource object (the SKU or product) that contains the price for the current item. The ItemListPriceCalculator and ItemSalePriceCalculator read this value and return a price object that contains the price.

How Classes that Extend ItemPriceCalculator Determine Prices

The ItemListPriceCalculator extends ItemPriceCalculator. In this example, the ItemListPriceCalculator is set with the following properties:

In this example, the SKU catalog contains a SKU that identifies blue shorts. That SKU has the following properties:

When a CommerceItem is passed to the ItemListPriceCalculator, this particular Itemlistpricecalculator looks at the item’s catalogRef property (SKU) and retrieves the value of that object’s listPrice property (10.00). The ItemListPriceCalculator then modifies the input price to be 10.00 and returns it.

The ItemSalePriceCalculator works in almost the same way. The ItemSalePriceCalculator has an additional property called onSalePropertyName, which is a boolean property on the priceSource object that indicates whether the item is on sale.

In this example, the priceFromCatalogRef property of ItemSalePriceCalculator is set to true. The pricePropertyName property is set to salePrice. A SKU in the SKU catalog has a property called onSale. If a SKU were on sale, the onSale property would be set to true. The onSalePropertyName property of ItemSalePriceCalculator is set to onSale.

When an item is passed to the ItemSalePriceCalculator, it has a catalogRef property that points to a SKU from the SKU catalog.

When the ItemSalePriceCalculator receives this item, it uses the value of the SKU’s onSale property to determine if it is on sale. In this example, the value is true, indicating that the SKU is on sale. The calculator then gets the sale price using the SKU’s salePrice property. The price in this case is 7.00. The calculator then modifies the input price for the item to be 7.00 and registers that a change has been made to the price. This registering is done by creating a new PricingAdjustment and adding it to the adjustments property of the price object, which in this case is an ItemPriceInfo. The adjustment would be -3.00, and it would show that the ItemSalePriceCalculator was responsible for the change.

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