In Motorprise, a purchase list is a list of frequently ordered items that are typically ordered together. Customers can create and maintain these lists so that they do not have to look through the catalog for the same products each time they want to place the order. Instead, they can create a purchase list once. Then, whenever they want to order those items, they can select the purchase list and add all or some of the items in it to their order.

For example, Lorna Perman, a buyer at USMW US Division, Retail, created a purchase list called Headlamp Blowout. This is a set of headlamps and light bulbs that the Retail Division regularly features in a sale.

Lorna can add all the items in that purchase list to her current order. She can then choose additional items from the catalog or delete items from her order.

Purchase lists are persistent and specific to a buyer. Also, each purchase list for a specific buyer must have a unique name. After Lorna adds a purchase list to her current order, the purchase list remains in her profile. She can use that list again or delete it later on the Purchase List page in My Account.

Buyers can edit, remove, or add purchase lists. Any changes made to a purchase list will not affect orders that have been already submitted using that purchase list. If the buyer edits a purchase list, she is prompted to save these changes permanently.

When a customer is looking at products in the catalog (viewing <ATG11dir>/MotorpriseJSP/j2ee-apps/Motorprise/web-app/en/catalog/product.jsp), she has the option to create a new purchase list or to add the displayed product to a previously saved purchase list.

If she clicks the Add to List button and selects an existing purchase list, the product is added to that purchase list. The following code shows how we implemented this feature in MotorpriseJSP/j22ee-apps/motorprise/web-app/en/catalog/AddToList.jsp.

<dsp:form action="product.jsp" method="post">
  <input name="id" type="hidden" value="<dsp:valueof
    param="product.repositoryId"/>">
  <dsp:input bean="PurchaselistFormHandler.addItemToPurchaselistErrorURL"
     type="hidden" value="product.jsp"/>
  <dsp:input bean="PurchaselistFormHandler.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="PurchaselistFormHandler.catalogRefIds"
           paramvalue="element.repositoryId" type="hidden"/>
         <span class=smallb>Qty</span>&nbsp;
         <dsp:input bean="PurchaselistFormHandler.quantity" size="2" type="text"
           value="1"/>&nbsp;
    </dsp:oparam>
  </dsp:droplet>

  <dsp:select bean="PurchaselistFormHandler.purchaseListId">
    <dsp:droplet name="ForEach">
      <dsp:param bean="Profile.purchaselists" name="array"/>
      <dsp:oparam name="output">
        <dsp:getvalueof id="elem" idtype="atg.repository.RepositoryItem"
          param="element">
          <dsp:option value="<%=elem.getRepositoryId()%>"/>
          <dsp:valueof param="element.eventName">Unnamed Purchase
            List</dsp:valueof>
        </dsp:getvalueof>
      </dsp:oparam>
    </dsp:droplet>
  </dsp:select></td>
  </tr>
  <tr>
    <td><dsp:input bean="PurchaselistFormHandler.addItemToPurchaselist"
      type="submit" value="Add to list"/></td>
  </tr>
<tr>
    <td>
    <table border=0 cellpadding=3 width=100%>
      <tr>
        <td><span class=smallb><dsp:a href="../user/
          purchase_lists.jsp?noCrumbs=false"><dsp:param name="product"
          param="product.repositoryId"/><dsp:param name="noCrumbs"
          value="false"/>Create new purchase list</dsp:a></span></td>
      </tr>
    </table>
    </td>
  </tr>

  </table>
</dsp:form>

If she clicks the Create new purchase list button, she is taken to the Purchase Lists page, user/purchase_lists.jsp, where all of her saved purchase lists are displayed. She has an option here to create a new purchase list. We used the following JSP code to achieve this:

<dsp:form action="purchase_lists.jsp" method="post">
<input name="noCrumbs" type="hidden" value="<dsp:valueof param='noCrumbs'/>">
New purchase list:<br>
<dsp:input bean="PurchaselistFormHandler.listName" maxlength="20" size="20"
   type="text"  value=""/>
      <dsp:input bean="PurchaselistFormHandler.savePurchaseList" type="hidden"
        value=""/>
<dsp:input bean="PurchaselistFormHandler.savePurchaseList" type="submit"
    value="Create list"/>
<br>
<span class="help">List names are limited to 20 characters in length</span>
</dsp:form>

In the above code, the user is provided an input box to suggest a name for the purchase list. If she doesn’t have any purchase lists with that name, we create one for her with the given name and redirect her to the same page, which then displays the newly created purchase list. If the user has another purchase list with that name, we redirect her to the same page displaying the error message saying that a purchase list with that name already exists.

In Motorprise, we extended the Core Commerce gift list functionality to create purchase lists. We extended the GiftlistFormHandler component to create PurchaselistFormHandler. This component is located at atg/projects/b2bstore/purchaselists.

PurchaselistFormHandler.properties:

$class=atg.projects.b2bstore.purchaselists.PurchaselistFormHandler
$scope=request
profile=/atg/userprofiling/Profile
defaultLocale^=/atg/commerce/pricing/PricingTools.defaultLocale

giftlistRepository=/atg/commerce/gifts/Giftlists
giftlistManager=/atg/commerce/gifts/GiftlistManager
orderManager=/atg/commerce/order/OrderManager
shoppingCart=/atg/commerce/ShoppingCart
giftlistTools=/atg/commerce/gifts/GiftlistTools
catalogTools=/atg/commerce/catalog/CatalogTools
profileTools=/atg/userprofiling/ProfileTools

We created a new property, purchaseLists, for users. This property differs from the gift list property in that it does not require event dates, names, and shipping address. We set all of these to null in the PurchaseListFormHandler and just set the name of the purchase list.

PurchaselistFormHandler extends GiftlistFormHandler. Before it passes an event, it sets the various properties of the gift list that are not required by purchase list to null. It also checks for duplicate purchase list names. Also, unlike GiftlistFormHandler, PurchaselistFormHandler does not decrease the quantity of items or remove them from the gift list when they are moved to current order.

We overrode the personalGiftlistsProperty of GiftlistTools in Motorprise to use purchaseLists as the property to hold the user purchase lists.


Copyright © 1997, 2019 Oracle and/or its affiliates. All rights reserved. Legal Notices