Oracle ATG Web Commerce includes functionality that allows you to filter collections of gift lists and gift items so that you display only those lists/items that are appropriate for the customer’s site context. In a multisite environment, any time you retrieve a collection of gift lists or gift items by referring to a repository item’s property, such as Profile.giftlists or Profile.wishlist.giftlistItems, you get back an unfiltered list that may contain items from multiple sites. For these situations, you should consider whether the collection should be filtered or not and, if so, implement the filtering functionality described in this section.

Filtering is particularly important for wish lists. Customers can only have one wish list, making it more likely that items from multiple sites will exist in a single wish list. To limit wish list item display to only those items that are appropriate for the site context, you must filter out any items affiliated with sites that are outside of the site context.

Two components facilitate the filtering of gift lists and gift items:

The GiftlistSiteFilterDroplet is a globally-scoped instance of the class atg.service.collections.filter.droplet.CollectionFilter designed to render a filtered set of gift lists/gift items. It has the following properties:

GiftlistSiteFilter is a globally-scoped component of class atg.commerce.gifts.GiftlistSiteFilter. This class extends the generic collection filtering class atg.service.collections.filter.CachedCollectionFilter by overriding the generateFilteredCollection() method to take site scope and site ID parameters into consideration when filtering gift lists or gift items. GiftlistSiteFilter resolves the site scope and site ID values as follows:

When filtering gift lists, the GiftlistSiteFilter determines the site scope and then compares the siteId’s of the gift lists/gift items in the repository to the IDs in its list, as shown in the following table:

Compatibility Test

All

Current

ShareableType ID

Gift list/gift item’s siteId is in the site IDs list

Include gift list/gift item in filtered results

Include gift list/gift item in filtered results

Include gift list/gift item
in filtered results

Gift list/gift item’s siteId is not in the site IDs list

Include gift list/gift item in filtered results

Do not include gift list/gift item in filtered results

Include gift list/gift item in filtered results if the gift list/gift item’s siteId is in the specified sharing group (for example, the shopping cart sharing group) with any of the sites in the site IDs list.

Gift list/gift item’s siteId is null

Note: This is also the wish list case.

The gift list/item is universal and should be included in filtered results

The gift list/item is universal and should be included in filtered results

The gift list/item is universal and should be included in filtered results

Properties for the GiftlistSiteFilter component include:

Note that, unlike the GiftlistSearch form handler, the GiftlistSiteFilter component does not have siteScope or siteIds properties. Instead, the site scope and list of site IDs are passed to GiftlistSiteFilter by the GiftlistSiteFilterDroplet, as described below.

This JSP excerpt shows one example of how you can use GiftlistSiteFilterDroplet to filter gift lists. No site scope is passed in, so the GiftlistSiteFilter uses the GiftlistManager component’s siteScope, which for the purposes of this example is set to the atg.ShoppingCart shareable type component. Also, no site IDs are provided, so the filtered gift lists will come from the current site and sites that share a shopping cart with the current site only.

<dsp:droplet
name="/atg/commerce/collections/filter/droplet/GiftlistSiteFilterDroplet">
  <&-- Specify the collection to filter --%>
  <dsp:param name="collection" bean="Profile.giftlists"/>

  <dsp:oparam name="output">

    <%-- Iterate through the collection. --%>
      <dsp:importbean bean="/atg/dynamo/droplet/ForEach"/>
      <dsp:droplet name="ForEach">
        <dsp:param name="array" param="filteredCollection"/>

        <dsp:oparam name="output">
          <dsp:setvalue param="giftList" paramvalue="element"/>
          <dsp:getvalueof var="eventName" param="giftList.eventName"/>
          <c:out value="${eventName}"/>
        </dsp:oparam>
      </dsp:droplet>

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

This JSP excerpt filters a collection of wish list items. A site scope value of current is passed to the filter along with a set of site IDs, resulting in a collection of items from the specified sites only.

<dsp:droplet
name="/atg/commerce/collections/filter/droplet/GiftlistSiteFilterDroplet">
  <&-- Specify the collection to filter and the site scope. --%>
  <dsp:param name="collection" bean="Profile.wishlist.giftlistItems"/>
  <dsp:param name="siteScope" value="current"/>
  <dsp:param name="siteIds" value="siteA,siteB"/>

  <dsp:oparam name="output">

    <%-- Iterate through the collection. --%>
      <dsp:importbean bean="/atg/dynamo/droplet/ForEach"/>
      <dsp:droplet name="ForEach">
        <dsp:param name="array" param="filteredCollection"/>

        <dsp:oparam name="output">
          <dsp:setvalue param="giftItem" paramvalue="element"/>
          <dsp:getvalueof var="displayName" param="giftItem.displayName"/>
          <c:out value="${displayName}"/>
        </dsp:oparam>
      </dsp:droplet>

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

Notes:


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