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, you can either add new tables to the schema or modify the database schema to add columns to the database tables for that item type.
Note: Creating separate tables reduces the chance of complications during future Oracle ATG Web Commerce upgrades; however, it can negatively affect performance. If you have a large product catalog, performance may be of more importance.
After altering your database, 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:
Create an entirely new type, whose definition is independent of existing types.
Create an item type that is a sub-type of an existing type. A sub-type inherits the properties from its parent item type, and can include additional properties that are unique to the sub-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>
Then add your new sub-type to the appropriate property of the /atg/commerce/CatalogTools
component:
catalogFolderItemTypes=catalogFolder
catalogItemTypes=catalog
productItemTypes=product
categoryItemTypes=category
SKUItemTypes=sku,configurableSku
For example, if you create a new subtype called customCategory
, add the following to the /atg/commerce/CatalogTools
component::
categoryItemTypes+=customCategory
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.
For more information, see the Item Descriptor Inheritance section of the SQL Repository Data Models chapter of the ATG Repository Guide.