Once the product is displayed to the customer, she has an option on the product page to add a quantity of that item to her current order if she is a registered customer.

We used CartModifierFormHandler to add the product to the current order, as shown in the code below. The product parameter is passed to AddToCart.jsp to be used for adding the product.

<input name="id" type="hidden" value="<dsp:valueof param=
   "product.repositoryId"/>">
   <dsp:input bean="CartModifierFormHandler.addItemToOrderSuccessURL"
      type="hidden" value="../checkout/cart.jsp?noCrumbs=false"/>
   <dsp:input bean="CartModifierFormHandler.SessionExpirationURL" type="hidden"
      value="../common/session_expired.jsp"/>
   <dsp:input bean="CartModifierFormHandler.productId"
      paramvalue="product.repositoryId" type="hidden"/>
   <dsp:droplet name="/atg/dynamo/droplet/ForEach">
      <dsp:param name="array" param="product.childSKUs"/>
      <dsp:oparam name="output">
      <table border=0 cellpadding=3 width=100%>
         <tr>
         <td>
         <dsp:input bean="CartModifierFormHandler.catalogRefIds"
            paramvalue="element.repositoryId" type="hidden"/>
         <span class=smallb>Qty</span>&nbsp;
         <dsp:input bean="CartModifierFormHandler.quantity" size="4" type="text"
            value="1"/>&nbsp;&nbsp;
         <dsp:input bean="CartModifierFormHandler.addItemToOrder" type="submit"
            value="Add to order"/>
         <br>
         </td>
         </tr>
      </table>

      </dsp:oparam>
   </dsp:droplet>

If the item is successfully added to the order, the Add to Order button redirects the user to /checkout/cart.jsp. Otherwise, the user is redirected to the same page showing the errors. We iterate through all the SKUs providing the input option for the user for each SKU and adding it to CartModifierFormHandler.catalogRefIds.

Note: because Motorprise is a demo site, each product only has one SKU. However, we included the code to iterate through all the SKUs of a product so that you could easily apply this code if your catalog contains products with multiple SKUs apiece.