Class Name |
|
|---|---|
Components |
|
The CollectionFilter servlet beans use collection filtering components to reduce objects in a collection. Each servlet bean works with a different collection filtering component.
InventoryFilterDropletreturns product SKUs that are in stock as determined by the Inventory Manager at the time of execution. This servlet bean accessesInventoryFilter, which handles the filtering action.ExcludeItemInCartFilterDropletreturns those products that are not in the user’s shopping cart. This servlet bean relies onExcludeItemsInCartFilterto determine the items in the shopping cart and to eliminate them from the collection.ProductFilterDropletexecutes bothInventoryFilterDropletandStartEndDateFilterDropletto return only those items that satisfy both sets of requirements. For example, a product that’s in stock and has an activestartDatewill be returned while one with the samestartDatebut is out of stock won’t be returned. This servlet bean accessesProductFilter, which handles the filtering action.
The primary discussion of this class resides in Appendix B: ATG Servlet Beans of the ATG Page Developer’s Guide. For details about collection filtering components and caching, see the Filtering Collections chapter in the ATG Personalization Programming Guide.
Note that the filter input parameter has a different default value for each component of class CollectionFilter:
InventoryFilterDropletuses/atg/registry/CollectionFilters/InventoryFilterExcludeItemInCartFilterDropletuses/atg/registry/CollectionFilters/ExcludeItemInCartFilterProductFilterDropletuses/atg/registry/CollectionFilters/ProductFilter
Example
In this example, ProductFilterDroplet causes the filters (InventoryFilter and StartEndDateFiler)specified in the ProductFilter to apply their filtering mechanisms to a collection of products. The resultant collection of products that are in stock and active are displayed.
<dspel:droplet name="/atg/commerce/catalog/CategoryLookup">
<dspel:param name="Id" param="catId"/>
<dspel:oparam name="output">
<%
String collIdentifierKey = request.getParameter("catId") + "-childprd";
%>
<dspel:droplet name="/atg/collections/filter/droplet/ProductFilterDroplet">
<dsp:param name="collection" param="item.childproducts/>
<dsp:param name="collectionIdentifierKey" value="<%=collIdentifierKey
%>"/>
<dspel:oparam name="output">
Featured Plants:
<p><dsp:droplet name="/atg/dynamo/droplet/ForEach">
<dsp:param name="array" param="filteredCollection"/>
<dsp:oparam name="output">
<dspel:valueof param="element"/>
</dspel:oparam>
</dsp:droplet>
</dspel:oparam>
<dspel:oparam name="empty">
There are currently no outdoor plants
</dspel:oparam>
</dspel:droplet>
</dspel:oparam>
</dspel:droplet>
