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 ATG 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 ATG 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 (ATG Business Commerce only)
The OrderLookup
servlet bean that is provided with ATG Commerce is an instance of class atg.commerce.order.OrderLookup
if you are using ATG Consumer Commerce, or atg.b2bcommerce.order.B2BOrderLookup
if you are using ATG Business Commerce.
The behavior of the servlet bean is governed by several properties that are set in the OrderLookup
component. You can use the Pages and Components > Components by Path area of the ATG Control Center to view and modify the OrderLookup
component, which is located at /atg/commerce/order/
. The following properties are important when configuring the OrderLookup
servlet bean.
Property | Description | |
---|---|---|
| If this property is set to false, any user can view any order. If this property is set to true, users are restricted to viewing only their own orders. A user is considered to own an order if the profile ID associated with the order matches the profile ID of that user. By default, this property is set to true. | |
| The path of the global | |
| The path to the | |
| This property contains a list of order states that indicate that an order is open. Because several order states can indicate that an order is open, you can use this property to specify those states. Consequently, when you query for all “open” orders, you retrieve all orders with states specified in this property. By default, this property is set to the following: -- You can override this list of “open” states by using the optional | |
| This property contains a list of order states that indicate that an order is closed. Because several order states can indicate that an order is closed, you can use this property to specify those states. Consequently, when you query for all “closed” orders, you retrieve all orders with states specified in this property. By default, this property is set to the following: -- You can override this list of “closed” states by using the optional | |
| Error messages generated by this servlet bean can be localized. If this boolean property is set to | |
| This property specifies the default locale to use to localize error messages. The | |
| If this property is set to false, the servlet bean does not set the |
The OrderLookup
servlet bean takes the following input parameters:
Parameter | Description |
---|---|
| The ID of the order to retrieve. Note: If you are using ATG Consumer Commerce, either this or |
| The ID of the user profile whose orders will be retrieved. Note: If you are using ATG Consumer Commerce, either this or |
(ATG Business Commerce only) | The ID of the cost center whose orders will be retrieved. Note: This parameter applies to ATG Business Commerce only. Either this, |
| The desired state of the orders to retrieve. This parameter can be used in conjunction with -- any one of the states defined in -- open -- closed If you specify “open,” then all orders whose states are specified in the |
| A comma-separated list of states that correspond to “open” state. This parameter can be used in conjunction with the |
| A comma-separated list of states that correspond to “closed” state. This parameter can be used in conjunction with the |
| A string that specifies an This parameter can be used in conjunction with |
| True or false. This parameter is used in conjunction with the |
| The number of orders to return for the given query. |
| The index of the first order in the result set. This parameter is useful for cycling through a large number of orders. |
| Indicates whether the number of retrieved orders will be calculated into a total that’s accessible through the |
| Indicates whether the total number of orders and the orders themselves are produced from the servlet bean. Setting this parameter to Omitting this parameter, which is the same as setting it to If |
The OrderLookup
servlet bean sets the following output parameters:
Parameter | Description |
---|---|
| The array of |
| If an error occurred, this is the detailed error message for the user. |
| The size of the array of |
| If the |
| Identical to the |
| The index number that marks the beginning of a range of orders. For example, if 5 orders were returned from a given |
| The index number that marks the end of a range of orders. For example, if 5 orders were returned from a given |
| The index of the first order in the next set of results. If the |
| The index of the first order in the previous set of results. If the |
The OrderLookup
servlet bean renders the following open parameters:
Parameter | Description |
---|---|
| The |
| The |
| The |
The following example describes how to use the OrderLookup
servlet bean to retrieve all open orders for the current user and to display their IDs:
<dsp:droplet name="/atg/commerce/order/OrderLookup"> <dsp:param bean="/atg/userprofiling/Profile.repositoryId" name="userId"/> <dsp:param value="open" name="state"/> <dsp:oparam name="output"> <dsp:droplet name="/atg/dynamo/droplet/ForEach"> <dsp:param param="result" name="array"/> <dsp:oparam name="outputStart"> <OL> </dsp:oparam> <dsp:oparam name="outputEnd"> </OL> </dsp:oparam> <dsp:oparam name="empty"> No open orders. </dsp:oparam> <dsp:oparam name="output"> <LI> <dsp:valueof param="element.id">no order number</dsp:valueof> </dsp:oparam> </dsp:droplet> </dsp:oparam> <dsp:oparam name="error"> <span class=profilebig>ERROR: <dsp:valueof param="errorMsg">no error message</dsp:valueof> </span> </dsp:oparam> </dsp:droplet>
The following example describes how to use the OrderLookup
servlet bean to display information about a particular order with the ID of 123:
<dsp:droplet name="/atg/commerce/order/OrderLookup"> <dsp:param value="123" name="orderId"/> <dsp:oparam name="error"> <p> ERROR: <dsp:valueof param="errorMsg">no error message</dsp:valueof> <p> </dsp:oparam> <dsp:oparam name="output"> <p> order #<dsp:valueof param="result.id">no order id</dsp:valueof> <p> This order is in state: <dsp:valueof param="result.stateAsString"/> <P> This order was placed on <dsp:valueof date="MMMMM d, yyyy" param="result.submittedDate"/>. <P> </dsp:oparam> </dsp:droplet>