The ATG Commerce purchase process supports features such as browsing the catalog, adding items to a shopping cart, selecting payment methods, entering billing and shipping information, and the entire checkout process.

To also support purchasing gifts off a gift list, components in the order package (atg.commerce.order) have been extended. To understand how gift lists work in ATG Commerce, it is important to know which components in the order package support this functionality. This section describes how order management and the purchasing process have been extended to support gift lists. (See the Configuring Purchase Process Services chapter for more information on the purchase process.)

The following components provide gift list functionality to the purchase process:


atg.commerce.order.purchase.CartModifierFormHandler is one class that provides the functionality to support shopping carts and the purchase process in ATG Commerce. More importantly, the addItemToOrder method of CartModifierFormHandler provides support for purchasing items that appear on gift lists. CartModifierFormHandler and the addItemToOrder method are described in Understanding the CartModifierFormHandler in the Configuring Purchase Process Services chapter.

Adding a gift item to an order is virtually the same as adding any item to an order. A gift item is distinguished by two additional form input fields, CartModifierFormHandler.giftlistId and CartModifierFormHandler.giftlistItemId. When these two fields contain non-null values, addItemToOrder calls addGiftToOrder in the GiftListManager component, which does additional processing for the gift as required by the purchase process.

The following code sample demonstrates how to use the CartModifierFormHandler in a template for gifts. It is an example of how to set up input and URL properties and make calls to handle methods in the form handler. In this example, a customer is purchasing an item from another customer’s gift list and adding it to the shopping cart.

<dsp:droplet name="/atg/commerce/gifts/GiftlistLookupDroplet">
 <dsp:param param="giftlistId" name="id"/>
 <dsp:param value="giftlist" name="elementName"/>

 <dsp:oparam name="output">
 <table cellpadding=0 cellspacing=0 border=0>
   <td class=box-top-store>
   Get this gift for
   <dsp:valueof param="giftlist.owner.firstName">someone</dsp:valueof>

   <td class=box>
    <dsp:form action="<%=request.getRequestURI()%>" method="post">
     <input value='<dsp:valueof param="Product.repositoryId"/>'
      type="hidden" name="id">
     <input type="hidden" name="itemType" value="Product">
     <input value='<dsp:valueof param="Product.repositoryId"/>'
      type="hidden" name="itemId">
     <dsp:input bean="CartModifierFormHandler.addItemToOrderSuccessURL"
                      value="../checkout/cart.jsp" type="hidden"/>
     <dsp:input bean="CartModifierFormHandler.productId"
                      paramvalue="Product.repositoryId" type="hidden"/>
     <dsp:input bean="CartModifierFormHandler.giftlistId"
                      paramvalue="" type="hidden"/>
     <dsp:input bean="CartModifierFormHandler.giftlistItemId"
                      paramvalue="giftid" type="hidden"/>
     <dsp:droplet name="/atg/commerce/gifts/GiftitemLookupDroplet">
     <dsp:param param="giftId" name="id"/>
     <dsp:param value="giftitem" name="elementName"/>
     <dsp:oparam name="output">
     <dsp:input bean="CartModifierFormhandler.catalogRefIds"
                      paramvalue="giftitem.catalogRefId" type="hidden"/>

     <dsp:valueof param="giftlist.owner.firstName">firstname</dsp:valueof>
     <dsp:valueof param="giftitem.quantityDesired">?</dsp:valueof>
     <dsp:valueof param="giftitem.catalogRefId">sku</dsp:valueof><br>
     and so far people have bought
     <dsp:valueof param="giftitem.quantityPurchased">?</dsp:valueof>.

     Buy <dsp:input bean="CartModifierFormHandler.quantity" size="4"
value="1" type="text"/>
     <dsp:input bean="CartModifierFormHandler.addItemToOrder"
value="Add to Cart" type="submit"/>


The GiftlistHandlingInstruction specifies what special handling needs to be done for a gift. For example, it could update gift list information to reflect that the item was purchased. A separate GiftlistHandlingInstruction could indicate that the gift should be wrapped.

A GiftlistHandlingInstruction is created in the following sequence of events: When a person purchases an item off a gift list, CartModifierFormHandler calls addGiftToOrder in GiftlistManager. addGiftToOrder performs additional tasks to adding the item to an order. These tasks include:

For more information on Handling Instructions, see Setting Handling Instructions in the Configuring Purchase Process Services chapter.

ShippingGroupDroplet and ShippingGroupFormHandler

Your site may use ShippingGroupDroplet and ShippingGroupFormHandler to pull shipping information from the user’s profile and to allow the user to assign shipping addresses to items in an order. Both of these components have been extended for gift lists so that shipping information for gift items is automatically preserved. See Adding Shipping Information to Shopping Carts in the Implementing Shopping Carts chapter of the ATG Commerce Guide to Setting Up a Store and Preparing a Complex Order for Checkout in the Configuring Purchase Process Services chapter for descriptions of these components.


A pipeline is an execution mechanism that allows for modular code execution. Pipelines are used in ATG Commerce to execute a series of tasks such as saving an order, loading an order and everything required during checkout. The PipelineManager used by ATG Commerce is located in /atg/commerce/PipelineManager.

The commerce pipeline configuration file contains the definition for the processOrder chain. The ProcUpdateGiftRepository processor is added to the processOrder chain to support gift lists. It goes through the order and looks for a gift that has been added to the shopping cart. If one has been added, it updates the Giftlists repository to update the purchased count of items off the gift list.


The ProcSendGiftPurchasedMessage processor is added to the processOrder chain. It goes through the order and looks for a gift that has been purchased. If one has been purchased, it sends a message that contains the order, gift and recipient profile to the Scenarios module. This message can be used to trigger an event such as sending an e-mail message to the recipient.

loading table of contents...