atg.commerce.pricing.ItemPricingEngine is an extension of the PricingEngine interface. It describes an object that determines prices for atg.commerce.order.CommerceItem objects. The prices that are generated are ItemPriceInfo objects. For detailed information on ItemPriceInfo objects, refer to the ItemPriceInfo section.

An ItemPricingEngine can determine prices in three ways:

  • The priceItem method prices an item as a single item. It reviews any promotions that are passed in through a pPricingModels parameter.

    The single item that is passed in is the only one available to satisfy the requirements of any promotion. For example, if the item passed in is “5 women’s shorts in blue,” and there is a promotion for “Buy 7 or more blue shorts, get one pair free,” the promotion would not take effect. This call is mainly used for displaying item prices when a customer is browsing the catalog.

  • The priceEachItem method batch processes all the items that are passed in, but they are priced as if they were passed into PriceItem one at a time.

  • The priceItems method prices all input items all in the same context. To continue with the same example, the customer now puts “6 blue men’s shorts” in the shopping cart in addition to the “5 women’s shorts in blue.” While the customer is just browsing the catalog, the “Buy 7 or more blue shorts, get one pair free” promotion is not factored in when displaying prices. Therefore, when the customer makes the decision to add the shorts to the shopping cart, the price shown is still full price for all the shorts. However, when the customer subsequently displays the contents of his or her cart, the promotion takes effect and shows that one pair of shorts is free.

    The pricing context is defined by the method’s input parameters. In the case of priceItem, the context is as follows: the items to be priced, the promotions to factor, the profile of the user, the locale, and any additional parameters.

    The context can be important because some promotions take effect only if the item appears in a pricing context with other items. For example, a certain promotion might give 10 percent off an order if the pricing context includes one shirt and one pair of pants. The items would only receive the discount if priced in the same context.

  • The ItemPricingEngine can also evaluate promotions in a rules format, and determine whether or not promotions should be pre-validated using the rule engine. Rules-based validation uses a rule engine to eliminate promotions that cannot be applied. Note that not every promotion can be represented with a rule. As such, the promotions that contain relatively simple logic, such as a Buy X, Get Y promotion, will be validated quicker than those that contain complex constructs, such as string comparisons.

    By default, this prevalidation is enabled with in the ItemPricingEngine.properties file:

    useRulesBasedPrevValidation=true

    If you set the useRuleBasedPreValidation to false, or a rule cannot be created for a promotion, pre-validation still occurs but does not use a rule engine during the validation process. For more information on rules-based validation, refer to the ATG Platform API Reference.

    Core Commerce provides the ItemPricingEngineImpl class as a default implementation of the ItemPricingEngine interface. It computes the price of items both individually and in a larger context. It invokes a series of ItemPricingCalculators.


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