CatalogSearchFormHandler
can search for any type of repository item in the catalog repository. You specify the item types to find by setting the itemTypes
property in the form handler’s properties file to a list of strings, each naming one item type.
Item types typically include category
or product
, but you can configure search form handlers to search for SKUs or for custom category or product subtypes you have created. You can also create multiple instances of CatalogSearchFormHandler
and configure them to search for different kinds of objects. For example, you could have one form handler that searches only for clothing products and another that searches for all products and categories; a clothing search page might use the first form handler, while a more general search page would use the second.
In addition to specifying the item types to search for, you must also set the property catalogTools
so that it refers to a CatalogTools
object that provides access to categories, products, SKUs, and other catalog information. Unless you have implemented your own catalog management system, you should use the default CatalogTools
component at /atg/commerce/catalog/CatalogTools
.
The following is an example of a properties file for a CatalogSearchFormHandler
component that can perform all four types of searching:
$class=atg.commerce.catalog.custom.CatalogSearchFormHandler $scope=session doKeywordSearch=true keywordsPropertyNames=keywords doTextSearch=true textSearchPropertyNames=description,displayName doHierarchicalSearch=true ancestorCategoriesPropertyName=ancestorCategories doAdvancedSearch=true advancedSearchPropertyNames=weightRange,manufacturer,childSKUs catalog^=/atg/commerce/catalog/custom/CatalogTools.catalog itemTypes^=/atg/commerce/customCatalogTools.productItemTypes
Because there are so many possible combinations of search options, it is convenient to have several CatalogSearchFormHandler
components, each configured differently. Oracle ATG Web Commerce includes five different CatalogSearchFormHandler
components (see Preconfigured Catalog Search Components), and you can create additional instances. You can also change the behavior of a CatalogSearchFormHandler
component for an individual page by setting hidden input fields. For example, suppose your Commerce application has a CatalogSearchFormHandler
component named KeywordSearch
that is configured only for keyword searching, but you have one page where you want to enable text searching as well. You could use this component and just enable keyword searching on the page by including this tag:
<dsp:input type="hidden" bean="KeywordSearch.doTextSearch" value="true">