By default, there is only one type of category and one type of product in the catalog. These item types are sufficient for many commerce sites. However, you may find you need to extend the catalog by creating additional properties for these item types, or by creating additional item types.

To create additional properties for an item type, modify the database schema to add columns to the database tables for that item type, and make the corresponding additions to the repository definition file. For greater flexibility, you can create new item types. There are two ways to create a new item type:

The default category and product item definitions include an enumerated property named type, which you can use to create item sub-types:

<property name="type" data-type="enumerated" column-name="product_type"
      writable="false" hidden="true"> </property>

To create a product sub-type, add an option value to the product type enumeration:

<property name="type" data-type="enumerated" column-
  name="product_type" writable="false" hidden="true">
  <option value="option1"/>
  <option value="option2"/>
</property>

Then add a new item-descriptor to the repository definition file, and set its super-type attribute to the name of the parent item type:

<item-descriptor name="item-name" super-type="type" sub-type-
          value="option1">
          <!-- properties -->
        </item-descriptor>

The new item type inherits all of the defined properties of the parent item type, and can add properties not defined for the parent item type. Inheritance is a very convenient mechanism for creating new item types, especially for creating types that are closely related to each other. However, you should avoid using too many levels of inheritance. Queries against items whose properties span multiple sub-types may require joins of all of the tables in the hierarchy. If you use these kinds of queries, keep in mind that performance decreases as the number of tables joined increases.

In the standard catalog, sub-types are defined for the media item type only. In a purely object-oriented design, there would be a generic catalog item type from which the category, product, and SKU item types would inherit all of their common properties (such as description and displayName). Instead, the catalog replicates the properties in each item definition, to avoid the performance and complexity issues associated with sub-types.

For more information, see the Item Descriptor Inheritance section of the SQL Repository Data Models chapter of the ATG Repository Guide.

 
loading table of contents...