If you want to add a simple attribute, such as an integer or string, you can simply add the attribute to the existing product or SKU item type as shown above. However, some item types are more complicated; for example, they may be multi-valued or have several associated attributes. In these cases, you may need to create a brand new item type to contain the values, and then add a reference to this new item type in the product or SKU. We needed to do this for the Pioneer Cycling store.

We added a couple of new item types to the Pioneer Cycling product catalog: manufacturer and style. These item types hold information that product objects can reference. If it was simple information, we could have represented it as a new attribute on the product item type. Because it was more complicated, we pulled it out into a separate new item type. In order to tie the information together, each product contains a reference to one of these new item types. These changes required two steps: creating the new item type, and updating the product to contain a reference to the new information. The steps for adding manufacturer and style were very similar so we only explain one of them here.

Manufacturer

The manufacturer item type defines the manufacturer of a product and has the following attributes:

Item

Description

id

Unique identifier

displayName

Name of manufacturer

description

Description of the manufacturer

longDescription

Detailed description of the manufacturer

image

Manufacturer logo

keywords

List of keywords for this manufacturer (multivalued attribute)

We used SQL DDL scripts for adding the b2c_manufacter database tables. Here is the SQL DDL script we used to add the main manufacturer table to the database:

CREATE TABLE b2c_manufacturer (
        manufacturer_id    VARCHAR(40)   NOT NULL,
        manufacturer_name  VARCHAR(200)  NULL,
        description        VARCHAR(200)  NULL,
        long_description   VARCHAR(40)   NULL REFERENCES
                                         dcs_media_txt (media_id),
        image              VARCHAR(40)   NULL REFERENCES
                                         dcs_media_bin (media_id),
        PRIMARY KEY(manufacturer_id)
);

This is the SQL DDL script we used for the table that holds the multi-valued keyword attribute. (Multi-valued attributes must be stored in a separate table).

CREATE TABLE b2c_mnfr_keywrd (
        manufacturer_id    VARCHAR(40)   NOT NULL
                           REFERENCES b2c_manufacturer(manufacturer_id),
        sequence_num       INTEGER       NOT NULL,
        keyword            VARCHAR(254)  NOT NULL,
        PRIMARY KEY(manufacturer_id, sequence_num)
);

Then, we added an attribute to the b2c_product table so that the product can contain a reference to the new manufacturer object:

CREATE TABLE b2c_product (
…
  manufacturer VARCHAR(40) NULL REFERENCES
                           b2c_manufacturer(manufacturer_id)
…
);

We had to add a new item-descriptor to the XML file for the manufacturer:

<item-descriptor name="manufacturer">
  <table name="b2c_manufacturer" type="primary"
         id-column-name="manufacturer_id">
    <property name="id" column-name="manufacturer_id"/>
    <property name="displayName" data-type="string"
              column-name="manufacturer_name"/>
    <property name="description" data-type="string"
              column-name="description"/>
    <property name="longDescription" item-type="media"
              column-name="long_description"/>
    <property name="image" item-type="media" column-name="image"/>
  </table>
  <table name="b2c_mnfr_keywrd" type="multi"
         id-column-name="manufacturer_id"
         multi-column-name="sequence_num">
    <property name="keywords" data-type="list"
              component-data-type="string" column-name="keyword"/>
  </table>
</item-descriptor>

Finally, we updated the product item-descriptor to include a reference to the new manufacturer property. Here is a portion of that XML script:

<item-descriptor name="product">
…
  <property name="manufacturer" item-type="manufacturer"
            column name="manufacturer"/>
…
</item-descriptor>

After all of these changes were made, the displayName property of a manufacturer of a particular product can be displayed in a JSP file using the following tag:

<dsp:valueof param="childProduct.manufacturer.displayName"/>

The displayName property associates an item with a text string that users will see through the ACC interface. For example, a product item refers to a Manufacturer item. In the ACC, the manufacturer field of a product shows a pick list of the displayNames of all manufacturer items in the repository. If the manufacturer has no display name, then the id property is used.

Style

We added the new style item-type in exactly the same way as manufacturer.

Here is the portion of productCatalog.xml that describes the item type “style”.

<item-descriptor name="style" display-name="Style">
   <table name="b2c_style" type="primary" id-column-name="style_id">
   <property name="id" column-name="style_id"/>
   <property name="displayName" data-type="string" column-name="style_name"/>
   </table>
</item-descriptor>

It has just two properties, id and displayName. Functionally, style is similar to an enumerated type property, which has a code and a value. However, with this implementation, a new style can be added via the ACC while ATG Consumer Commerce is running. If style were an enumerated property of Product, a developer would have to add new styles when ATG Consumer Commerce was not running.

 
loading table of contents...