Thursday, July 31, 2014

Product Comparison Simple Analysis : ATG

 

 

Product Comparison:



 Product Comparison provides the ability to compare the products in the catalog.

 A simple site may offer the user a single product comparison list and enable the user to add and remove products from the list, as well as compare the properties of the products in the list. A more complex site may offer the user multiple comparison lists to compare different types of items (for example, one list to compare funitures, a different list to compare mobiles, and so on).



Components Involved:


1. /atg/commerce/catalog/comparison/ProductList
2. /atg/commerce/catalog/comparison/ProductListContains.
3. /atg/commerce/catalog/comparison/ProductListHandler
4. /atg/commerce/catalog/comparison/ProductComparisonList


ProductList:


1. The items property of the ProductList component stores the list of Entry objects that represent each product in the product comparison list
2. Each Entry object in the ProductList combines category, product, SKU, and inventory information in a single object,
3. A unique ID that names the list entry. You can use this property to retrieve individual entries by calling

<dsp:valueof bean="ProductList.entries[id]"/>


ProductComparisonList:


1. It is a session scoped component located in nucleus,
2. To manage multiple comparison lists (for eg: list to compare mobiles, list to compare  TV's) we can use ProductComparisonList,
3. ProductComparisonList provides some convenience methods like sortProperties and tableColumns that call through to the referenced TableInfo object,
4. ProductList.tableColumns is equivalent to the expression ProductList.tableInfo.tableColumns, you can use either of it.

Example:

   <dsp:param bean="ProductList.tableColumns" name="array"/>
   <dsp:param value="" name="sortProperties"/>




JSP Code Snippet for ProductComparisonList

<dsp:droplet name="ForEach">
  <dsp:param bean="ProductComparisonList.items" name="array"/>
  <dsp:oparam name="output">
    <p>Product Name: 

      <dsp:valueof param="element.product.displayName"/><br>
       Category: 

      <dsp:valueof param="element.category.displayName"/><br>
       Inventory: <dsp:valueof param="element.inventoryInfo.inventoryAvailabilityMsg"/><br>
  </dsp:oparam>
</dsp:droplet>




ProductListContains:


1. It is a global scope component located in nucleus,
2. The very good advantage of using ProductListContains if you dont specify a categoryId for a given product, then ProductListContains checks the list of entry
   whose category matches either the given products default category or if there is no category for the given product (null), we can blindly go with this component,



ProductListHandler:


1. It is a request scope component located in nucleus,
2. This component is used for setting the forms and submitting the forms,
3. This component will provide you the very flexible way of adding and removing the products to the comparison list.

Example:

<dsp:input bean="ProductListHandler.addProductList" value="Add to list"  type="submit"/>

<dsp:input bean="ProductListHandler.removeEntries" value="Remove selected  items" type="submit"/>


<dsp:input bean="ProductListHandler.clearList" value="Remove all" type="submit"/>




Note:
Previously /atg/commerce/catalog/SearchFormHandler has been used for providing the search result for product comparison list.

Example :  <dsp:param bean="SearchFormHandler.searchResults" name="array"/>

Nowa days Oracle Endeca is providing some search component for more flexible way of providing the search results.



Popular Posts