Example: Category merchandising associations

You can use the Data Load utility to insert, replace, or delete multiple category merchandising associations at the same time. These examples use a CSV file to demonstrate how to insert, replace, or delete category merchandising associations.

This example uses a CSV file to demonstrate how to insert, replace, or delete your data. You can also create and use an XML formatted file to insert, replace, or delete your data. If you choose to create and use an XML formatted file, ensure that your XML elements use the same names as are used for CSV column names.

CSV column and XML element definitions

GroupIdentifier
(Required, String) The category identifier. This field cannot be null, and it must be unique.
AssociationType
(Required, String) Use this field to indicate the type of association wanted. This field cannot be null. The default association options are CrossSell, UpSell, Accessory, and Replacement.
TargetGroupIdentifier
(Required, String) The identifier of the category that is the target of the association.
Sequence
(Double) An optional number that is used to control the order in which the category merchandising associations are displayed.
SemanticSpecifier
(Required, String) The semantic specifier you want to use for this merchandising association. This field cannot be null. Examples of semantic specifiers are comes_with, none, requires, , or temp.
Quantity
(Double) The quantity of the association.
Date1
(Timestamp) A customizable field of timestamp type.
Delete
(String) A flag indicating whether to delete. Specify 1 to delete the row.

Other optional fields not included in the example are:

StoreIdentifier
(String) The identifier of the store the source category belongs to. This column is only needed if the source category belongs to a store which is different from the store that is defined in BusinessContext element of either the wc-dataload.xml configuration file or the catalog association loader configuration file. If this column is not provided in the CSV file, the StoreIdentifier in the business context is used.
TargetStoreIdentifier
(String) The identifier of the store the target category belongs to. This column is only needed if the target category belongs to a store which is different from the store that is defined in BusinessContext element of either the wc-dataload.xml configuration file or the catalog association configuration file. If this column is not provided in the CSV file, the StoreIdentifier in the business context is used.
Field 1
(String) A user-defined field available for customization purposes.
Field 2
(Integer) A user-defined field available for customization purposes.
Field 3
(Decimal) A user-defined field available for customization purposes.

CSV file with sample category merchandising association data

Insert or replace

In this example, the CSV file contains sample category merchandising association data. Each column is delimited by a comma. CSV file with sample category merchandising association data.

Formatted CSV file with column headings
GroupIdentifier AssociationType TargetGroupIdentifier Sequence SemanticSpecifier Quantity Date1
TV_category CrossSell DVD_category 2 REQUIRES 1 2008-06-22 05.00.00
CRT_category UpSell LCD_category 1 COMES_WITH 1 2008-06-22 05.00.00
Delete

In this example, the CSV file contains sample category merchandising association data. The first row of data gets deleted. CSV file with sample category merchandising association data .

Formatted CSV file with column headings
GroupIdentifier AssociationType TargetGroupIdentifier Sequence SemanticSpecifier Quantity Date1 Delete
TV_category CrossSell DVD_category 2 REQUIRES 1 2008-06-22 05.00.00 1
CRT_category UpSell LCD_category 1 COMES_WITH 1 2008-06-22 05.00.00

Mapping data

The following code snippet from the catalog association loader configuration file demonstrates how to map each value to a business object logical schema path.


<_config:DataMapping>
	<_config:mapping xpath="CatalogGroupIdentifier/UniqueID" value="GroupUniqueId" />
	<_config:mapping xpath="CatalogGroupIdentifier/ExternalIdentifier/GroupIdentifier" value="GroupIdentifier" />
	<_config:mapping xpath="CatalogGroupIdentifier/ExternalIdentifier/StoreIdentifier/ExternalIdentifier/NameIdentifier" value="StoreIdentifier" valueFrom="DataSourceData" />
	<_config:mapping xpath="Association/Name" value="AssociationType" />
	<_config:mapping xpath="Association/CatalogGroupReference/CatalogGroupIdentifier/UniqueID" value="TargetGroupUniqueId" />
	<_config:mapping xpath="Association/CatalogGroupReference/CatalogGroupIdentifier/ExternalIdentifier/GroupIdentifier" value="TargetGroupIdentifier" />
	<_config:mapping xpath="Association/CatalogGroupReference/CatalogGroupIdentifier/ExternalIdentifier/StoreIdentifier/ExternalIdentifier/NameIdentifier" value="TargetStoreIdentifier" valueFrom="DataSourceData" />
	<_config:mapping xpath="Association/displaySequence" value="Sequence" />
	<_config:mapping xpath="Association/semantic" value="SemanticSpecifier" />
	<_config:mapping xpath="Association/quantity" value="Quantity" />
	<_config:mapping xpath="Association/Attributes/field1" value="Field1"/>
	<_config:mapping xpath="Association/Attributes/field2" value="Field2"/>
	<_config:mapping xpath="Association/Attributes/field3" value="Field3"/>
	<_config:mapping xpath="Association/Attributes/date1" value="Date1"/>
	
<_config:mapping xpath="" value="Delete" valueFrom="InputData" deleteValue="1"/>

</_config:DataMapping>
If you perform an insert or replace operation, do not specify the "Delete" column in the CSV file or you can leave the "Delete" column empty.

Business object mediator

The mediator class name is com.ibm.commerce.catalog.dataload.mediator.CatalogGroupAssociationMediator.

Note: When you use a mediator that is provided with WebSphere Commerce with the Data Load utility, the utility assumes that you are loading data for all columns for a business object. If you want to update the data in only specific columns, configure a column exclusion list for the load process. A column exclusion list causes the Data Load utility to ignore specific columns during the load operation. If you do not use a column exclusion list, the utility updates all columns in the row of a database table row when the utility updates the row. If no value is set in the input file, the utility can replace the existing column value with a default value or set the value to be null. For more information, see Configuring a column exclusion list.