By default, ATG Commerce includes a session-scoped instance of ProductComparisonList, located in Nucleus at /atg/commerce/catalog/comparison/ProductList. However, your application developers may have configured additional instances of ProductComparisonList to manage multiple comparison lists (for example, a list to compare cameras, a different list to compare televisions, and so on).

The items property of the ProductList component stores the list of Entry objects that represent each product in the product comparison list. Each Entry object combines category, product, SKU, and inventory information in a single object and, by default, exposes the properties described in the table below. (Note that your developers may have extended the product comparison system and added additional properties.)

Property Name

Property Type

Description

product

RepositoryItem

The product being compared.

category

RepositoryItem

The category of the product being compared. If the category is not set explicitly when the product is added to the list, then the product’s default parent category is used. If the product’s default parent category is unset, the category property is null.

sku

RepositoryItem

The product’s SKU. If the SKU is not set explicitly when the product is added to the list, then the first SKU in the product’s childSkus list is used. If the product has no child SKUs, then the sku property is null.

inventoryInfo

InventoryData

The InventoryData object that describes the inventory status for the given product and SKU. If the sku property is null or the inventory information isn’t available, then the inventoryInfo property is null.

productLink

String

An HTML fragment that specifies an anchor tag that links to the product’s page in the catalog. The default format for the link is <a href="product.template.url?id=product.repositoryId">product.displayName</a>. However, you can change the format by setting the ProductComparisonList.productLinkFormat property.

Note:If you display the product comparison information in a table, you can use the productLink property in the configuration of the TableInfo object that maintains the table information, as in the following example:

columns=\
  Product Name=productLink,\
  Price=sku.listPrice,\
  …

Or, similarly, to display the product link in a table column but sort the column on the product’s display name, you could modify the example in the following manner:

columns=\
    Product Name=productLink; product.displayName,\
    Price=sku.listPrice,\
    …

For more information on the TableInfo component, see the Implementing Sortable Tables chapter in the ATG Page Developer’s Guide.

categoryLink

String

An HTML fragment that specifies an anchor tag that links to the category’s page in the catalog. The default format for the link is <a href=category.template.url?id=category.repositoryId>category.displayName</a>. However, you can change the format by setting the ProductComparisonList.categoryLinkFormat property.

Note: Like the productLink property, the categoryLink property can be used in the configuration of a TableInfo component. See the description of the productLink property in this table for more information.

id

Int

A unique ID that names the list entry. You can use this property to retrieve individual entries by calling ProductComparisonList.getItems(id) in the Java code or by using <dsp:valueof bean="ProductList.entries[id]"/> in the JSP. You can also use this property to delete specific entries, for example, with a form handler.

You can refer to the properties of entries in the product comparison list (that is, the Entry objects) using familiar JSP syntax, as in the following example:

<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>
 
loading table of contents...