<dsp:importbean bean="/atg/commerce/order/purchase/RepriceOrderDroplet" />
<dsp:droplet name="RepriceOrderDroplet">
<dsp:param name="pricingOp" value="ORDER_TOTAL" />
</dsp:droplet>
在对应的购物车部分内容,可能会发生价格变化的jsp页面里添加以上的代码,可让购物车的价格时刻保持正常的价格.
As described earlier in this chapter inAdding 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 toremove 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 theRepriceOrderDroplet
servlet bean. In fact, you can use theRepriceOrderDroplet
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.
By default, RepriceOrderDroplet
is configured to invoke the repriceOrder
pipeline chain to reprice an order. As such, it provides a mechanism for updating the price of an order every time a customer accesses the shopping cart page. This is useful if your site enables customers to access their shopping carts through non-form actions, such as standard hyperlinks. Because of dynamic pricing, customers could potentially view inaccurate prices in their shopping carts when accessing the shopping cart through a hyperlink.