As described earlier in this chapter in Adding Items to Shopping Carts, CartModifierFormHandler automatically reprices a shopping cart when it is used to add items to the cart. (Note that it also reprices the cart when it is used to remove items from the cart.) However, you’ll need to reprice shopping carts via some other mechanism if customers can make changes that affect order price through other form handlers that do not reprice shopping carts (for example, by making shipping changes via the form handlers that create and manage shipping groups), or if the shopping carts are modified through some other means in ways that affect order price, such as the delivery of a promotion via a scenario.

If your site has any pages where you need to reprice a shopping cart, but you cannot do so through a form action and corresponding handle method, use the RepriceOrderDroplet servlet bean. In fact, you can use the RepriceOrderDroplet servlet bean to reprice a customer’s shopping cart every time the customer accesses a shopping cart page. This ensures that the customer always views accurate pricing information as he or she makes changes to cart.

The RepriceOrderDroplet servlet bean takes one required input parameter, pricingOp, that should be set to the pricing operation to execute. The possible pricing operations are defined in atg.commerce.pricing.PricingConstants, and they include the following:

ORDER_TOTAL
ORDER_SUBTOTAL
ORDER_SUBTOTAL_SHIPPING
ORDER_SUBTOTAL_TAX
ITEMS
SHIPPING
ORDER
TAX
NO_REPRICE

Typically, the pricingOp input parameter is the only parameter you need to specify when using RepriceOrderDroplet. For a detailed list of all the parameters of RepriceOrderDroplet, see RepriceOrder in Appendix: ATG Commerce Servlet Beans.

To use RepriceOrderDroplet in a page on your site, simply import the servlet bean into the page using the following import statement:

<dsp:importbean
bean="/atg/commerce/order/purchase/RepriceOrderDroplet">

Then add JSP code similar to the following before displaying any pricing information for the current shopping cart.

<dsp:droplet name="RepriceOrderDroplet">
  <dsp:param value="ORDER_SUBTOTAL" name="pricingOp"/>
</dsp:droplet>-->

For additional information on the RepriceOrderDroplet servlet bean, see the Repricing Orders section of the Configuring Purchase Process Services chapter in the ATG Commerce Programming Guide.

 
loading table of contents...