The atg.commerce.pricing.PropertyRangeShippingCalculator
class is a highly flexible shipping calculator that identifies an item property and adds the value provided to each item in the shipping group together to create a shipping group total. The total falls into one of the ranges specified in the ranges
property, which provides a shipping cost for each range.
For example, all items may have a property called weight
that correlates to the weight of the item in pounds. To base shipping cost on the cumulative weight total, you set the PropertyRangeShippingCalculator
propertyName
property to weight
. If your shipping group has three items, each of which has a weight of 1, Oracle ATG Web Commerce calculates a total of three and uses the ranges
property to determine how much to charge. The range property takes the format of low:high:price and holds these options:
ranges=00.00:15.99:4.50,\
16.00:30.99:6.00,\
31.00:40.99:7.25,\
41.00:MAX_VALUE:10.00
In this example, shipping charges total $4.50. Note that keyword MAX_VALUE
indicates the maximum possible value in the range.
The PropertyRangeShippingCalculator
also contains the following properties:
addAmount
: If the propertyaddAmount
istrue
, instead of setting the price quote amount to the value of the amount property, the calculator adds the amount to the current amount in the price quote. This can be used to configure a “surcharge” calculator, which increases the shipping price.shippingMethod
: TheshippingMethod
property is set to the name of a particular delivery process. For example: ground, 2-day or next day.ignoreShippingMethod
: Setting theignoreShippingMethod
property totrue
prevents this calculator from exposing the shipping method name (throughgetAvailableMethods
). In addition, this calculator always attempts to perform pricing. This option is useful for situations in which you do not want to give customers a choice of different shipping methods.propertyName
: Set thepropertyName
property to the name of the property that you want to add across all items. For example, “weight” would calculate the total weight of an order by adding together theweight
property values of all the items.useCatalogRef
: If theuseCatalogRef
property is set totrue
, the property value is extracted from thecatalogRef
of theCommerceItem
(usually the SKU). IfuseCatalogRef
property is set tofalse
, theproduct
is used as the source.