An ItemPriceCalculator class maintains all the functionality common to all the pricing schemes. The ItemPriceCalculator has the following important properties:

The major public API exposed by this class includes:

Three sub-calculators correspond to the three different pricing schemes. The three different schemes are calculating the list price of an item, calculating the price of an item using bulk pricing, and calculating the price of an item using tiered pricing. For more information on bulk and tiered pricing, see the Using Price Lists section.

All of these calculators implement the ItemSchemePriceCalculator, which only has a priceItem method.

  • ItemListPriceCalculator: Calls the getPrice method from the PriceListManager to retrieve the list price of the CommerceItem. It then multiplies the price by the quantity returned by the getQuantity method of CommerceItem to get the total price. The ItemPriceInfo will contain one DetailedItemPriceInfo for each ShippingGroupCommerceItemRelationship in the CommerceItem. This is because of the Range property in both ShipItemRels and DetailedItemPriceInfos.

  • ItemBulkPriceCalculator: Calls the getPrice method from the PriceListManager to retrieve the complex price for the CommerceItem. It will check each price level of that complex price based on the quantity of the CommerceItem to decide the correct unit price for the item. The ItemPriceInfo will contain one DetailedItemPriceInfo for each ShippingGroupCommerceItemRelationship.

  • ItemTierPriceCalculator: Calls the getPrice method from the PriceListManager to retrieve the complex price for the CommerceItem. It will check each price level of that complex price to decide which unit price is used for each tier. The ItemPriceInfo will might several DetailedItemPriceInfos to reflect different unit prices for each tier.

Using ItemPriceInfo with Price Lists

One ItemPriceInfo class fits three different pricing schemes. Each calculator uses a different description for the PricingAdjustment added to the ItemPriceInfo.

The priceList property of ItemPriceInfo is set to the priceList that was actually used to calculate it. This is nullable since other calculators other than those mentioned here will not set this. The ItemPriceCalculator is responsible for setting this value.

 
loading table of contents...