Hierarchical searches look in a subset of categories, starting from a given category, and including also that category’s child categories, the children of those children, and so on. The given category is indicated by the repository ID in the hierarchicalCategoryId property. To perform hierarchical searches, you must generate the ancestorCategories property for each product and category item, as described in Running the Standard Catalog Maintenance System section.

To enable hierarchical searches in the form handler, set the property doHierarchicalSearch to true. Specify the category from which to start the search by setting the form handler’s hierarchicalCategoryId property to the repository id of the category whose descendants you want to find. This property is typically set through a hidden input tag, or specified by the customer through a form input field.

Hierarchical searching requires that each category and product item have a multi-valued property whose value is a complete list of all of its ancestor categories. Hierarchical searching restricts the search results to items whose ancestor categories include the category specified through hierarchicalCategoryId.

Specify the name of the ancestor category property by setting the ancestorCategoriesPropertyName property of the form handler. If you are using the standard catalog schema, each category and product item has an ancestorCategories property whose value is a Set of that item’s ancestor categories The values of these properties can be generated automatically using the component /atg/commerce/catalog/ancestorGeneratorService. If your catalog does not use the default schema, you may be able to configure this component to generate ancestor categories for your catalog items, or you can specify ancestor categories by setting properties manually. See Generating Ancestor Categories for more information.

 
loading table of contents...