This section is intended for users who are running ATG Campaign Optimizer for Commerce, want to create tests that involve templates, and have modified the product or category template definitions. It describes the changes that were made to the default product catalog in ATG Campaign Optimizer for Commerce to enable template tests.

ATG Campaign Optimizer for Commerce modifies the definition of product.template and category.template. If you modified the default definitions of either of these properties in the product catalog repository definition, you will not necessarily see the ATG Campaign Optimizer configuration changes. You must update your catalog definition to include the changes that ATG Campaign Optimizer relies on to perform category and product template tests.

To allow template substitution, ATG Campaign Optimizer for Commerce modifies the definition of the template property in both the category and product item descriptors to use the user defined property atg.abtest.substituter.commerce.TemplateSubstituterPropertyDescriptor.

Template substitution with ATG Campaign Optimizer for Commerce will not work in the following cases:

This is the definition of the product.template property before installing ATG Campaign Optimizer for Commerce:

<item-descriptor name="product">
  <table name="dcs_prd_media" type="auxiliary"
         id-column-name="product_id">
    <property category-resource="categoryPresentation" name="template"
              item-type="media" column-name="template_id"
              queryable="false" display-name-resource="template">
      <attribute name="resourceBundle"
                value="atg.commerce.ProductCatalogTemplateResources"/>
      <attribute name="propertySortPriority" value="-2"/>
    </property>
  </table>
</item-descriptor>

The following code sample is the XML-combine input that produces the new template property definition when combined with normal productCatalog.xml. It enables product template substitution by ATG Campaign Optimizer.

<item-descriptor name="product">
  <table name="dcs_prd_media" type="auxiliary"
         id-column-name="product_id">
    <property name="template" xml-combine="remove"/>
    <property category-resource="categoryPresentation"
              name="defaultTemplate" item-type="media"
              column-name="template_id" queryable="false"
              display-name-resource="defaultTemplate">
      <attribute name="resourceBundle" value=
       "atg.abtest.substituter.commerce.ProductCatalogTemplateResources"/>
      <attribute name="propertySortPriority" value="-2"/>
    </property>
  </table>
    <property category-resource="categoryPresentation" name="template"
               item-type="media" queryable="false"
               display-name-resource="template"
               property-type="atg.abtest.substituter.commerce.
                              TemplateSubstituterPropertyDescriptor">
    <attribute name="resourceBundle"
                value="atg.commerce.ProductCatalogTemplateResources"/>
    <attribute name="propertySortPriority" value="-2"/>
              <attribute name="basePropertyName" value="defaultTemplate"/>
    </property>
</item-descriptor>

If you already modified the definitions of the template property for product or category, then modify them further to use the user-defined property atg.abtest.substituter.commerce.TemplateSubstituterPropertyDescriptor. For example, the Motorprise reference application defines product as follows to enable internationalization:

<item-descriptor name="product">
 <table name="dcs_prd_media" type="auxiliary" id-column-name="product_id">
  <property name="template" xml-combine="remove"/>
  <property name="template_en" item-type="media" column-name="template_id"
            queryable="true" category-resource="categoryPresentation"
            display-name-resource="template">
    <attribute name="propertySortPriority" value="-5"/>
    <attribute name="locale" value="en"/>
  </property>
 </table>
 <table name="dbc_product_de" type="auxiliary"
        id-column-name="product_id">
  <property name="template_de" item-type="media" column-name="template_id"
       queryable="true" category-resource="categoryPresentation"
       display-name-resource="template">
    <attribute name="propertySortPriority" value="-5"/>
    <attribute name="locale" value="de"/>
  </property>
 </table>
 <table name="dbc_product_ja" type="auxiliary"
        id-column-name="product_id">
  <property name="template_ja" item-type="media" column-name="template_id"
       queryable="true" category-resource="categoryPresentation"
       display-name-resource="template">
  <attribute name="propertySortPriority" value="-5"/>
    <attribute name="locale" value="ja"/>
   </property>
  </table>
  <property name="template" item-type="media"
            category-resource="categoryPresentationDerived"
            writable="false" display-name-resource="template"
            queryable="true">
   <derivation method="firstWithLocale">
    <expression>template_en</expression>
    <expression>template_de</expression>
    <expression>template_ja</expression>
   </derivation>
   <attribute name="resourceBundle"
          value="atg.projects.b2bstore.CustomCatalogTemplateResources"/>
   <attribute name="propertySortPriority" value="-5"/>
   <attribute name="keyService" value="/atg/userprofiling/LocaleService"/>
   <attribute name="defaultKey" value="en_US"/>
  </property>

ATG Campaign Optimizer for Commerce further modifies this as follows to enable template substitution. (See DCS-ABTest/MotorpriseJSP/config/atg/commerce/catalog/custom/customCatalog.xml)

<item-descriptor name="product">
<table name="dcs_prd_media" type="auxiliary" id-column-name="product_id">
  <property name="defaultTemplate" xml-combine="remove"/>
</table>
  <property name="defaultTemplate" item-type="media"
      category-resource="categoryPresentationDerived" writable="false"
      display-name-resource="defaultTemplate" queryable="true">
  <derivation method="firstWithLocale">
   <expression>template_en</expression>
   <expression>template_de</expression>
   <expression>template_ja</expression>
  </derivation>
  <attribute name="resourceBundle"
       value=
      "atg.abtest.substituter.commerce.ProductCatalogTemplateResources"/>
  <attribute name="propertySortPriority" value="-5"/>
  <attribute name="keyService" value="/atg/userprofiling/LocaleService"/>
  <attribute name="defaultKey" value="en_US"/>
 </property>
 <property category-resource="categoryPresentationDerived" name="template"
           item-type="media" queryable="false"
           property-type="atg.abtest.substituter.commerce.
                          TemplateSubstituterPropertyDescriptor"
                          display-name-resource="template"
                          xml-combine="replace">
 <attribute name="basePropertyName" value="defaultTemplate"/>
   <attribute name="propertySortPriority" value="-1"/>
  <attribute name="resourceBundle"
           value="atg.projects.b2bstore.CustomCatalogTemplateResources"/>
  </property>
</item-descriptor>

You may need to make similar modifications if you have changed product.template or category.template. You can verify the results of the XML combination in the product catalog in the ATG Component Browser by looking at the definitionFiles property of the /atg/commerce/catalog/ProductCatalog component. The following sample shows the xml-combine result for the configuration example above for the product repository item.

<item-descriptor name="product" >
  <property queryable="false"
    category-resource="categoryPresentationDerived"
    display-name-resource="template"
    name="template"
    item-type="media"
    property-type="atg.abtest.substituter.commerce.
                   TemplateSubstituterPropertyDescriptor">
    <attribute name="basePropertyName" value="defaultTemplate"/>
    <attribute name="propertySortPriority" value="-1"/>
    <attribute name="resourceBundle"
          value="atg.projects.b2bstore.CustomCatalogTemplateResources"/>
   </property>
  <property queryable="true"
            category-resource="categoryPresentationDerived"
            display-name-resource="defaultTemplate"
            name="defaultTemplate"
            writable="false"
            item-type="media">
    <derivation method="firstWithLocale">
      <expression>template_en</expression>
      <expression>template_de</expression>
      <expression>template_ja</expression>
    </derivation>
    <attribute name="resourceBundle"
                     value="atg.abtest.substituter.commerce.
                     ProductCatalogTemplateResources"/>
    <attribute name="propertySortPriority" value="-5"/>
    <attribute name="keyService"
               value="/atg/userprofiling/LocaleService"/>
    <attribute name="defaultKey" value="en_US"/>
  </property>
    <property category-resource="categoryPresentation"
              queryable="true"
              display-name-resource="template"
              name="template_en"
              column-name="template_id"
              item-type="media">
      <attribute name="propertySortPriority" value="-5"/>
      <attribute name="locale" value="en"/>
    </property>
    <property category-resource="categoryPresentation"
              queryable="true"
              display-name-resource="template"
              name="template_de"
              column-name="template_id"
              item-type="media">
      <attribute name="propertySortPriority" value="-5"/>
      <attribute name="locale" value="de"/>
    </property>
    <property category-resource="categoryPresentation"
              queryable="true"
              display-name-resource="template"
              name="template_ja"
              column-name="template_id"
              item-type="media">
      <attribute name="propertySortPriority" value="-5"/>
      <attribute name="locale" value="ja"/>
    </property>

</item-descriptor>