Saving Orders

The SaveOrderFormHandler (class atg.commerce.order.purchase.SaveOrderFormHandler) saves the user’s current Order and adds the Order to the ShoppingCart’s list of saved orders. Additionally, it constructs a new, empty Order and sets it as the user’s current Order. Oracle ATG Web Commerce includes an instance of SaveOrderFormHandler, which is located in Nucleus at /atg/commerce/order/purchase/SaveOrderFormHandler.

If you are writing custom code, to avoid the possibility of deadlocks, be sure to synchronize on the Order before beginning the transaction.

The following table describes the important methods in SaveOrderFormHandler.

Method

Description

handleSaveOrder

This handle method first calls the empty preSaveOrder() method, then calls the saveOrder method to save the order, and finally calls the empty postSaveOrder method.

saveOrder

This method first sets the current Order’s description based on the provided String description. If no description is provided, the method sets the description using the date and time as represented by the user’s locale. Next, the method saves the Order to the repository by calling the OrderManager.updateOrder method. Finally, the method adds the Order to the list of saved orders in the ShoppingCart.saved property, and constructs a new, empty Order that is set as the user’s current order.