In addition to the category
, product
, and sku
items, the catalog repository includes catalog
items that represent different hierarchies of categories and products. Each user is assigned one catalog, and sees the navigational structure, products and SKUs, and property values associated with that catalog. A given product may appear in multiple catalogs. The product
repository item type includes a catalogs
property whose value is a Set of the catalogs the product is included in.
Depending on how your catalog repository is configured, the property values of individual categories, products, or SKUs may vary depending on the catalog. If so, when you index the catalog, you may need to generate multiple records for each product or SKU (one for each catalog the item is included in).
To support creation of multiple records per product or SKU, the Guided Search integration uses the /atg/commerce/search/CustomCatalogVariantProducer
component. This component is of class atg.commerce.search.producer.CustomCatalogVariantProducer
, which implements the atg.repository.search.indexing.VariantProducer
interface. The variant producer iterates through each catalog individually, so that each record contains only the property values associated with a single catalog.
The CustomCatalogVariantProducer
component is added to the ProductCatalogOutputConfig
component’s variantProducers property by default:
variantProducers+=\
CustomCatalogVariantProducer
The mechanism used for retrieving catalog-specific property values differs depending on the property. For category
, product
, or sku
item properties that use the atg.commerce.dp.CatalogMapDerivation
class to derive catalog-specific values, the correct values are automatically obtained by that class.
To get the value of the catalogs
property of the product
item, the ProductCatalogOutputConfig
component is configured by default to use the /atg/commerce/search/CustomCatalogPropertyAccessor
component. This component is of class atg.commerce.search.producer.CustomCatalogPropertyAccessor
, which implements the atg.repository.search.indexing.PropertyAccessor
interface. This accessor returns, for each record, only the specific catalog the record applies to. The accessor is specified in the /atg/commerce/endeca/index/product-sku-output-config.xml
definition file:
<item is-multi="true" property-name="catalogs"
property-accessor="customCatalog">
The CustomCatalogPropertyAccessor
component is mapped to the name customCatalog
by the ProductCatalogOutputConfig
component’s propertyAccessorMap
property:
propertyAccessorMap+=\
customCatalog=CustomCatalogPropertyAccessor