Tutorials > Management Center > Add new fields in the Catalogs tool > Customize the Catalogs tool to upload data from custom tables

< Previous | Next >


Create custom versions of the configuration files

In this step of the tutorial, you create custom versions of the data load order and business object configuration files.

By default, the Catalog Upload feature provides various catalog business object configuration files. The configuration files defines the mapping from the comma-separated value (CSV) columns to the Xpath express of the logical business object.

To map the warranty and care instruction data to CSV columns, you create custom version of the catalog entry business object configuration file.

Catalog Upload uses the configuration files in the following directories:

Before loading catalog data, the Catalog Upload feature merges configuration files from both directories.


Procedure

  1. Create a custom version of the catalog entry business object configuration file.

    The Catalog Upload feature catalog entry business object configuration is wc-loader-catalog-entry.xml. You will create a version of the custom business object configuration file from the existing wc-loader-catalog-entry.xml file.

    1. Create the workspace_dir\WC\xml\config\com.ibm.commerce.catalog-ext\dataload directory if it does not already exist.

    2. Copy the workspace_dir\WC\xml\config\com.ibm.commerce.catalog\dataload\wc-loader-catalog-entry.xml file into the workspace_dir\WC\xml\config\com.ibm.commerce.catalog-ext\dataload directory.

    3. Rename the file to wc-loader-catalog-entry-with-warranty.xml.

    4. Open the workspace_dir\WC\xml\config\com.ibm.commerce.catalog-ext\dataload\wc-loader-catalog-entry-with-warranty.xml file and examine its contents.

      In the wc-loader-catalog-entry-with-warranty.xml file:
      1. The attribute value in the <_config:DataReader> element specifies the CSV data reader. You do not need to change this value since the input file is in CSV format.
      2. The attribute value in the <_config:BusinessObjectBuilder> element specifies the base business object builder.
      3. The attribute value in the <_config:BusinessObjectMediator> element specifies the business object mediator class. The catalog entry mediator supports loading custom catalog entry UserData. You do not need to change this value is the catalog entry mediator because the warranty and care instruction data are extension of the CatalogEntry business object.

    5. Map the warranty and care instruction data to CSV column definition. Add the following snippet inside the <_config:DataMapping> element.

      <_config:mapping xpath="UserData/UserDataField/warterm" value="WarrantyTerm" />
      <_config:mapping xpath="UserData/UserDataField/wartype" value="WarrantyType" />
      <_config:mapping xpath="Description/Attributes/careinstruction" value="CareInstruction"  />
      

      The WarrantyTerm, WarrantyType, and CareInstruction are used as CSV column headers when loading a catalog entry.

    6. Save and close the file.

  2. Create a custom version of the data load order configuration file.

    The Catalog Upload feature data load order configuration file is wc-dataload.xml. You will create a custom version of the data load order configuration file in the customization directory.

    To ensure that the Catalog Upload feature picks up the data load order customization, make sure the custom version of the data load order file is also named wc-dataload.xml.

    1. Create a wc-dataload.xml file in the workspace_dir\WC\xml\config\com.ibm.commerce.catalog-ext\dataload directory.

    2. Copy the following content into the wc-dataload.xml file

      <?xml version="1.0" encoding="UTF-8"?>
      <_config:DataLoadConfiguration    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../xsd/wc-dataload.xsd" 
          xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">
          <_config:LoadOrder>
              <_config:LoadItem name="CatalogEntry" loadSequence="3.0" businessObjectConfigFile="wc-loader-catalog-entry-with-warranty.xml"> 
              <_config:DataSourceLocation location="${CatalogEntry}" />
            </_config:LoadItem>
          </_config:LoadOrder>
      </_config:DataLoadConfiguration>
      

      Your custom wc-dataload.xml file is merged with the default Catalog Upload feature wc-dataload.xml file, so you include the custom configurations only. The following is the content of the custom wc-dataload.xml file:

      In the wc-dataload.xml file:
      The name attribute value uses the same load item name as the catalog entry business object. This load item overrides the load item with the same name provided in the default wc-dataload.xml.
      The loadSequence attribute value specifies the load sequence. If you are loading multiple CSV files in a compressed file, it is the load sequence for all the CSV files. A smaller load sequence gets loaded first.
      The businessObjectConfigFile attribute value points to the business configuration file you created.
      The location attribute value is defined by a variable substitution. This variable name is the same as the load item name attribute value.

    3. Save and close the file.

< Previous | Next >


+

Search Tips   |   Advanced Search