ProductCatalog can be extended just like any other repository. We override the out of the box xml-file, and boom, our catalog is ready. Before we continue, you might like to revisit our article on How to Layer Repository XMLs.
There are broadly three ways of extending an item-descriptor:-
1. Adding properties to existing item-descriptors: Already Covered HERE.
2. Creating new Item-descriptors: Already Covered HERE.
3. Creating sub-types of existing item-descriptors: The real deal, which we will discuss here.
Although the topics (1) and (2) are written for non-versioned repositories, and ProductCatalog is a versioned repository; the process remains the same for OUT OF THE BOX versioned repositories too.
[There are some changes when you create a new versioned repository from scratch; which we will discuss when we start with BCC (Business Control Center)]
Now, let us understand the concept of SUB-TYPES of item-descriptors right from the scratch!
WHAT are SUB-TYPES of item-descriptors?
WHY do we need them?
The answer is pretty simple.
Suppose you own a store and deal with women's clothing and shoes.
Both clothing and shoes will have a lot of common attributes like brand, size, color etc.
But for women's shoes, there could be one more attribute, like "heel-size".
The presence of "heel-size" attribute in normal clothing is not required.
Therefore, for your product item-descriptor, you'll have all the common properties like size, color, brand etc.
And you'll create a sub-type of product called "shoe-product" which will have all the properties of "product" item-descriptor along with the new-attribute "heel-size".
We have taken an example where there is one property which is specific to a sub-type of a product. There might be a lot of scenarios where there are multiple properties for a sub-type, and therefore the need of creating a sub-type increases.
HOW to create sub-types of item-descriptors?
Creating a sub-type of an item-descriptor is very much similar to adding new properties to an item-descriptor.
A. First, you create an auxiliary table, as you create for adding new properties to an item-descriptor.
Suppose this table is named "PRODUCT_HEEL_SIZE", with columns "PRODUCT_ID" and "HEEL_SIZE".
B. Next, in the XML, you write the following
1. First, create a new item-descriptor with your desired name. e.g."shoe-product".
Also, specify "sub-type-value" attribute with same value.
2. Specify a super-type [which is an item-descriptor name], i.e. the parent of this item-descriptor from which it should derive the common properties i.e. product.
3. id-space-name: specify an id-space-name if needed. We have specified "product" as the id-space-name. This will generate the "shoe-product" item-descriptor IDs in sync with "product".
For example, last "product" created had id = 224567
Therefore, if a "shoe-product" is generated, it will have the id = 224567 + 1 = 224568.
If you want a separate sequence of IDs, you can remove this attribute altogether.
You can re-visit the ID-generation process HERE.
4. Next, add the <table> and <property> tags in the same way, as you extend an item-descriptor to add new properties.
C. Lastly, once this item-descriptor is created, you have to tell the parent item-descriptor that its child has been created.
1. Define a new property in the parent item-descriptor (in our case "product"). Add this property like any other (create a database column, map the column etc.) This property (say "type") should be "enumerated", and should store all possible sub-types.
2. Define the attribute "sub-type-property" and put its value as the property name defined above ("type" property defined above). This is done, so that item-descriptor knows that which property contains all possible sub-types of this item-descriptor.
You have now successfully created a sub-type for item-descriptors.
NOTE: A very important point to be noted here is that, item-descriptor inheritance cannot be multi-level. In other words, "product" can have multiple sub-types like "shoe-product", "shirt-product"etc. BUT, since "shoe-product" (or "shirt-product") is already a sub-type, it cannot be further extended.
Now that we know how to customize our catalog, we can move on to understand the Inventory Management in ATG!