Handling instructions can be added to either shipping groups or individual commerce items. This section provides an example of how to create handling instructions for gift wrapping one item in a shipping group. The example also uses a repository with a wrapping paper item descriptor.

For additional, detailed examples of how to extend the purchase process to support new commerce objects, see the Extending the Purchase Process section in this guide. For information on how to create new item descriptors in a repository, see the SQL Repository Data Models chapter in the ATG Repository Guide. For more information on HandlingInstruction, see the ATG API Reference.

Step 1: Create a GiftwrapHandlingInstruction class that extends the atg.commerce.order.HandlingInstructionImpl class. Add a property to identify the wrapping paper. For example:

public String getWrappingPaperId();
public void setWrappingPaperId(String pWrappingPaperId);

Step 2: Add support for this class to the OrderTools component. For example, in the localconfig directory add the following lines to /atg/commerce/order/OrderTools.properties:


Step 3: Add support for the new item descriptor to orderrepository.xml. The orderrepository.xml file is located in /atg/commerce/order/orderrepository.xml in the configpath.

First, add the new type to the handlingInstruction item descriptor:

<table name="dcspp_hand_inst" type="primary"
  <property name="type" data-type="enumerated"
            default="handlingInstruction" expert="true"
    <attribute name="useCodeForValue" value="false"/>
      <option value="handlingInstruction" code="0"/>
      <option value="giftlistHandlingInstruction" code="1"/>
     . . .

Second, add the new item descriptor:

      display-name="Gift wrap Handling Instruction">
  <attribute name="writeLocksOnly" value="true"/>
  <table name="dcspp_wrap_inst"
    <property name="wrappingPaperId"
              display-name="Wrapping Paper Id"/>

Step 4: Create a method that adds the handling instruction to the order in a class that extends the HandlingInstructionManager:

public wrapCommerceItemInShippingGroup(ShippingGroup
  pGiftShippingGroup, CommerceItem pWrappedItem,String pWrappingPaperId)
     GiftwrapHandlingInstruction giftwrap = (GiftwrapHandlingInstruction)
     pGiftShippingGroup.getId(), pWrappedItem.getId(),

Step 5: Add any additional processors. For example, you could add a processor to the validateForCheckout pipeline to validate the wrapping paper type.

loading table of contents...