For the Pioneer Cycling Catalog, we extended the basic ATG Consumer Commerce product item type with the following new properties:
Property | Description |
---|---|
| This property indicates whether this product is available in the current locale. |
| This |
| This enumerated property classifies items into cheap, normal, expensive, and very expensive price categories. It helps customers locate items in a specified price class. We also use it to track the kinds of items customers buy by storing the (A product’s actual price is stored in a SKU as an absolute number. Thus, we have no way to see how prices compare within a category. For example, a $200 bike could be considered cheap, whereas a $200 helmet would be considered expensive.) |
| This enumerated property classifies the relative weight of a product into heavy, normal, light, and extralight so that customers of Pioneer Cycling can look for bikes in a specific weight range. The exact weight of a product is stored on the SKU. |
| This property is a reference to an item of type “Style” which indicates the sort of style a product is, such as sporty, funky, retro, or feminine. These values are used for finding similarities between products. |
| This property is a reference to an item of type “Manufacturer” that indicates the company that makes the product. |
The standard ATG Consumer Commerce product catalog stores the product item type attributes in the dcs_product
table. We didn’t want to modify the standard ATG Consumer Commerce dcs_product
table, so we created a new SQL table to hold these new attributes. The new table is called b2c_product
. (All the tables we created for the Pioneer Cycling Site have names that start with b2c
.) The b2c_product
table contains columns for all of the new attributes. In order for these properties to be accessible on all products the two tables (the original dcs_product
and the new b2c_product
tables) are “linked” together with the product_id
attribute.
Because these tables are linked together by a join at the database level, performance is impacted. Another option is to add new columns to the dcs_product
table. We elected to use a separate table that joins to dcs_product
because we wanted users to be able to uninstall the Pioneer Cycling site, an example application, and keep other ATG products. When designing a production quality application, developers should use all the techniques they ordinarily would to optimize database performance.
CREATE TABLE b2c_product ( product_id VARCHAR(40) NOT NULLREFERENCES dcs_product(product_id), available TINYINT NULL, manufacturer VARCHAR(40) NULL REFERENCES b2c_manufacturer(manufacturer_id), highlight_priority INTEGER NULL, price_range INTEGER NULL, weight_range INTEGER NULL, style VARCHAR(40) NULL REFERENCES b2c_style(style_id), PRIMARY KEY(product_id) );
Here is the XML file for the new product item type attributes. All of the code is within <item-descriptor name="product">
tags. Because the product item-descriptor already exists in the standard ATG Consumer Commerce XML definition file, this new information is merged with the existing product item-descriptor via the XML File Combination algorithm mentioned earlier. Note that all of the new attributes are between the "<table name="b2c_product">. . .</table>"
tags so that the Repository API knows this data is stored in the new b2c_product database table. Also note that two of the attributes have enumerated values (priceRange
and weightRange
). This means that when product property values are entered in the ACC, the ACC provides a dropdown list of possible values.
<item-descriptor name="product"> <table name="b2c_product" type="auxiliary" id-column-name="product_id"> <property name="available" data-type="boolean" column-name="available"/> <property name="highlightPriority" data-type="int" column name="highlight_priority"/> <property name="priceRange" data-type="enumerated" default="NORMAL" column name="price_range"> <attribute name="useCodeForValue" value="false"/> <option value="CHEAP" code="0"/> <option value="NORMAL" code="1"/> <option value="EXPENSIVE" code="2"/> <option value="VERY EXPENSIVE" code="3"/> </property> <property name="weightRange" data-type="enumerated" default="NORMAL" column name="weight_range"> <attribute name="useCodeForValue" value="false"/> <option value="HEAVY" code="0"/> <option value="NORMAL" code="1"/> <option value="LIGHT" code="2"/> <option value="EXTRA LIGHT" code="3"/> </property> </table> </item-descriptor>