Each ATG Commerce calculator type has a helper method in the Qualifier class. Multiple calculators can use the same helper method. If you create a new calculator, and it processes a type of object not returned in the result set of an existing helper method, you must add a new corresponding helper method to the Qualifier class.
The following list shows existing helper methods and the type of object they return:
The
findQualifyingItems
method returns a list ofCommerceItems
(specifically, a list ofQualifiedItem
objects that map aCommerceItem
to the number of times it qualified for a discount).The
findQualifyingOrder
method returnsOrders
(specifically, aMatchingObject
object that identifies the order to discount).The
findQualifyingShipping
method returnsShippingGroups
(specifically, aMatchingObject
object that identifies the shipping group to discount).
The following example describes a situation in which a new calculator could use an existing helper method. Assume you created a HalfPlusOneItemDiscountCalculator
that discounts a set of CommerceItems
to half their existing price plus one. Because there is an existing method in the Qualifier to process CommerceItems
, the HalfPlusOneItemDiscountCalculator
could reuse existing ATG Commerce code by calling Qualifier.findQualifyingItems
. You would not need to create an additional helper method for this new calculator.
In contrast, suppose you created a HandlingDiscountCalculator
to calculate an order’s handling costs separately from its shipping costs. No helper method exists for determining the handling objects to discount. Therefore, you would need to create a new findQualifyingHandling
method to help the HandlingDiscountCalculator
.
For new helper methods, use the naming convention findQualifyingXXX
, where XXX is the name of the object in the result set that the method returns.