The SQL Repository allows you to define properties that return repository items. The value of one of these items is the object ID. The SQL Repository can transform the ID into the repository item and return the actual object. This mechanism enables you to define the relationship between categories and products in many ways.

Most properties of the SQL Repository return values retrieved from the database. The SQL Repository also provides the ability to compute values of certain properties through Java code. Properties computed dynamically are called user-defined properties. This mechanism is used for the default definitions of several properties of the category and product items, to allow for dynamic definition of item relationships. For more information about user-defined properties, see the SQL Repository Item Properties chapter of the ATG Repository Guide.

Deriving the childCategories and childProducts Properties

The hierarchical relationships between categories and products are determined by their properties. The childCategories and childProducts properties of a category define the list of categories and products that are children of the category.

The childCategories property is a list of all categories that are children of the category. This is a user-defined property that is computed by the atg.repository.NotEmptyChooserPropertyDescriptor class, which sets the value of the property by merging the lists of categories in the fixedChildCategories and dynamicChildCategories properties. In the repository definition file, the definition of the childCategories property looks like this:

<property name="childCategories"
  property-type="atg.repository.NotEmptyChooserPropertyDescriptor"
  data-type="list" component-item-type="category" writable="false"
  queryable="false">
  <attribute name="properties"
    value="fixedChildCategories,dynamicChildCategories"/>
  <attribute name="merge" value="true"/>
</property>

This structure enables a page developer to refer to one named property (in this case, childCategories) whose value is assembled from different sources.

The fixedChildCategories property is an explicit list of categories you specify. The dynamicChildCategories property is a user-defined property that is computed by the atg.repository.GroupMembersPropertyDescriptor class. This class looks at the childCategoryGroup property, which specifies the name of a content group, retrieves the list of categories in that content group, and sets the value of dynamicChildCategories to that list.

This mechanism enables you to use business rules to determine the list of child categories. For example, you can create a content group that consists of categories that share a particular attribute, and set the value of childCategoryGroup to the name of this content group.

The childProducts property of the category is computed in the same way, using the fixedChildProducts, dynamicChildProducts, and childProductGroup properties.

For example, suppose your site has a category called Hats, and some of the hats are available all year, while others are seasonal. You could set the fixedChildProducts property of the Hats category to a list of the hats that are available all year. You could also create a content group called Seasonal Hats, which contains a list of hats that changes from season to season, and set the childProductGroup property of the Hats category to the name of this content group.

When a user accesses a page that refers to childProducts, Oracle ATG Web Commerce computes the current value of childProducts as follows:

For information about creating content groups, see the ATG Personalization Guide for Business Users.

Deriving the relatedCategories and relatedProducts Properties

In addition to the childCategories property, the category item has a property named relatedCategories. This property defines a list of categories that are related to the category, but which do not form a hierarchy with it. Related categories are useful for cross-selling. For example, if the Fruit category has Vegetables as a related category, you can use this relationship to display a link to the Vegetables category on the Fruit page.

The relatedCategories property is a user-defined property that is derived in a similar way to the childCategories property. The relatedCategories property is computed by the atg.repository.NotEmptyChooserPropertyDescriptor class, which sets the value of the property by merging the lists of categories in the fixedRelatedCategories and dynamicRelatedCategories properties. The dynamicRelatedCategories property is also a user-defined property, which the atg.repository.GroupMembersPropertyDescriptor class computes by retrieving the list of categories in the content group specified by the relatedCategoryGroup property.

The product item has a relatedProducts property that is computed in the same way, using the fixedRelatedProducts, dynamicRelatedProducts, and relatedProductGroup properties.

Removing the SQL Repository Definitions of User-Defined Properties

If you do not plan to use dynamically related products or categories on your commerce site, you can remove these properties from the repository definition. System performance improves when you simplify the data model to use only fixed relationships. For example, if all categories are explicitly related, you can remove the definitions of the childCategories, dynamicChildCategories, and childCategoryGroup properties, and just use the fixedChildCategories property, which you can then rename as childCategories.


Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved.

Legal Notices