Class Name

atg.commerce.catalog.custom.CatalogItemLookupDroplet

Component(s)

/atg/commerce/commerce/catalog/CategoryLookup

/atg/commerce/catalog/ProductLookup

/atg/commerce/catalog/SKULookup

Servlet beans instantiated from CatalogItemLookupDroplet use the ID of a RepositoryItem to look up the item in a repository. If the item isn’t found, the empty open parameter is rendered. If the item is found, the servlet bean then checks if the item belongs to the user’s catalog in his current Profile. Or, if a catalog is specified via the catalog input parameter, the servlet bean instead checks if the item belongs to the specified catalog. In either case, if the item is found, then the servlet bean renders the output open parameter. If the item isn’t found, then the servlet bean renders the wrongCatalog open parameter.

Through properties, you can configure the repository and the item descriptor type to use when looking up a given item, and you can define a mapping from a key to an alternate set of repositories. For example, you might have a ProductLookup servlet bean with the following properties:

$class=atg.commerce.catalog.custom.CatalogItemLookupDroplet
repository=/atg/commerce/catalog/ProductCatalog
itemDescriptor=product
alternateRepositories=\
      fr_FR=/atg/commerce/catalog/FrenchProductCatalog
      ja_JP=/atg/commerce/catalog/JapaneseProductCatalog
      de_DE=/atg/commerce/catalog/GermanProductCatalog

If the useParams property is true, then the repository and item descriptor can be resolved through input parameters.

Note:CategoryLookup, ProductLookup, and SKULookup servlet beans that are instances of atg.commerce.catalog.custom.CatalogItemLookupDroplet can be used with custom catalogs. For information on the corresponding servlet beans used with standard catalogs, refer to ItemLookupDroplet in this appendix. If you are an ATG Consumer Commerce user and you want to migrate to custom catalogs, refer to Converting from Standard to Custom Catalogs section in the ATG Commerce Programming Guide for more information.

Input Parameters

id (Required)
The id of the item to lookup.

catalog
The catalog in which to look for the item. The catalog must be a RepositoryItem.

Note that this parameter usually isn’t needed. If unset, the servlet bean checks for the item in the catalog that is in the user’s profile. However, if you want to check for the item in a catalog other than the user’s current catalog, or if there is no current session (for example, within the context of an e-mail template), then you can explicitly provide the catalog via this parameter.

elementName
If specified, this name will be used for the parameter set within the output open parameter.

itemDescriptor
The name of the item descriptor to use to load the item.
(Note: Use of this parameter is not recommended. A better approach is to specify the item descriptor through the itemDescriptor property of the servlet bean.)

repository
The repository in which to look for the item.
(Note: Use of this parameter is not recommended. A better approach is to define different instances of CatalogItemLookupDroplet for each set of repositories you want to use.)

repositoryKey
If specified, this parameter will be used as a key to map to a secondary set of repositories.

Output Parameters

element
The RepositoryItem that corresponds to the supplied id. (This parameter name can be changed by setting the elementName input parameter.)

error
The open parameter rendered if an error occurs while looking up the item.

Open Parameters

output
The open parameter rendered if the item is found in the repository and belongs to the current user’s catalog (or instead, if specified, to the catalog passed in via the catalog input parameter).

wrongCatalog
The open parameter rendered if the item is found in the repository but doesn’t belong to the current user’s catalog (or instead, if specified, to the catalog passed in via the catalog input parameter). This makes the item accessible if you need it.

empty
The open parameter rendered in all other cases, such as when the item is not found in the repository or the user did not specify a required parameter.

noCatalog
The open parameter is rendered if the droplet cannot determine which catalog is associated with the user. This would be the case if you called the droplet without an explicit catalog parameter and there was no catalog in the user profile.

Example
<dsp:droplet name="ProductLookup">
  <dsp:param param="productId" name="id"/>
  <dsp:param bean="/OriginatingRequest.requestLocale.localeString"
             name="repositoryKey"/>
  <dsp:param value="product" name="elementName"/>
  <dsp:oparam name="output">
   <dsp:getvalueof id="a10" param="product.template.url"
               idtype="java.lang.String">
<dsp:a href="<%=a10%>">
     <dsp:param param="product.repositoryId" name="prod_id"/>
     <dsp:valueof param="product.displayName"/>
   </dsp:a></dsp:getvalueof>
  </dsp:oparam>
</dsp:droplet>

If the mapping for the provided key is found, then that repository is used. Otherwise, the system falls back to the default repository and searches for the item.

If the item cannot be found in the repository searched (e.g. the French product catalog), then the servlet bean once again falls back to the default repository and attempts to find the item using the same ID. This is only useful if the items have the same ID in each repository. For example, suppose you are viewing a site in French, and you attempt to look at product 1234. If the ID is defined in the French product catalog, you will see the French version of that product. However, if 1234 is not defined in the French product catalog, then you will see the default English version of product 1234.

This behavior can be modified with the use of the useDefaultRepository and getDefaultItem properties. If useDefaultRepository is false and an alternate repository cannot be found, then no repository is searched and the empty open parameter is rendered. Similarly, if an alternative repository is selected, but the item cannot be found, and if getDefaultItem is false, then the empty open parameter is rendered.

 
loading table of contents...