You use the SaveOrderFormHandler
to save the user’s current shopping cart, add the shopping cart to the user’s list of saved carts in ShoppingCart.saved
, and construct a new, empty cart as the user’s current shopping cart in ShoppingCart.current
.
Additionally, you can use the description
property of SaveOrderFormHandler
to set the description
property of the Order
; this enables users to name their shopping carts with meaningful names. If the user doesn’t provide a descriptive name, then the SaveOrderFormHandler
automatically creates one using the user’s locale and the current date and time.
The following JSP code illustrates the use of SaveOrderFormHandler
.
<dsp:importbean bean="/atg/commerce/order/purchase/SaveOrderFormHandler"/> Order # <dsp:valueof bean="ShoppingCart.current.id"/> <dsp:form action="saved_orders.jsp"> Enter a name to identify this order:<p> <dsp:input bean="SaveOrderFormHandler.description" type="text"/> <dsp:input bean="SaveOrderFormHandler.saveOrder" value="Save order" type="submit"/> <dsp:input bean="SaveOrderFormHandler.saveOrderSuccessURL" value="../user/saved_orders.jsp" type="hidden"/> <dsp:input bean="SaveOrderFormHandler.saveOrderErrorURL" value="../user/save_order.jsp" type="hidden"/> </dsp:form>
For descriptions of the handle methods of SaveOrderFormHandler
and detailed information on how an Order
is saved to the Order Repository, see the Saving Orders section of the Configuring Purchase Process Services chapter in the Core Commerce Programming Guide. For a JSP code example illustrating the use of SaveOrderFormHandler
, see the Saving Orders section of the My Account chapter in the Business Commerce Reference Application Guide.
The OrderLookup
servlet bean retrieves one or more Order
objects, depending on the supplied input parameters. You can use this servlet bean to retrieve:
A single order
All orders placed by a particular user
All orders placed by a particular user that are in a specific state
All orders assigned to a particular cost center
The OrderLookup
servlet bean that is provided with Core Commerce is an instance of class atg.commerce.order.OrderLookup
. See Appendix A: Core Commerce Servlet Beans for information.