Example: Catalog entry merchandising associations

You can use the Data Load utility to replace, or delete multiple catalog entry merchandising associations at the same time.

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

PartNumber
(Required, String) The unique part number that is used to identify the source catalog entry in the association. This field cannot be null. The part number for a catalog entry displays in Management Center as the value for the catalog entry Code property.
AssociationType
(Required, String) The type of merchandising association you want to use. The available values are CrossSell, UpSell, Accessory, , and Replacement. This field cannot be null.
TargetPartNumber
(Required, String) The unique part number that is used to identify the target catalog entry in the association. This field cannot be null.
TargetStoreIdentifier
(String) The unique identifier of the store the target catalog entry belongs to. If the TargetStoreIdentifier is not provided in the CSV source file, then the StoreIdentifier in the context data is used.
Sequence
(Decimal) The order in which the merchandising associations are displayed.
SemanticSpecifier
(Required, String) The semantic specifier of the merchandising association. Examples of semantic specifiers are comes_with, none, requires, or temp. This field cannot be null.
Quantity
(double) The quantity of target catalog entries that are associated to the source. For example, if the source catalog entry is a camera, and the target catalog entry is the type of battery it uses, the quantity indicates the number of batteries required.
Delete
(String) A flag indicating whether to delete. Specify 1 to delete the row.

Other optional fields not included in the example are:

Field1
(String) A user-defined field available for merchandising association customization purposes.
Field2
(Integer) A user-defined field available for merchandising association customization purposes.
Field3
(Decimal) A user-defined field available for merchandising association customization purposes.
Date1
(Timestamp) A user-defined field available for merchandising association customization purposes.

CSV file with sample catalog entry merchandising associations

Insert or replace

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

Formatted CSV file with column headings.
PartNumber AssociationType TargetPartNumber TargetStoreIdentifier Sequence SemanticSpecifier Quantity
Example-PN-10001 UpSell Example-PN-10004 ExampleTargetB2BStore 1 NONE 23
Example-PN-10002 Accessory Example-PN-10005 ExampleTargetB2BStore 2 NONE 11
Figure 1. Delete

In this example, the CSV file contains sample catalog entry merchandising association data that gets deleted. CSV file with sample catalog entry merchandising association data.

Formatted CSV file with column headings.
PartNumber AssociationType TargetPartNumber TargetStoreIdentifier Sequence SemanticSpecifier Quantity Delete
Example-PN-10001 UpSell Example-PN-10004 ExampleTargetB2BStore 1 NONE 23 1
Example-PN-10002 Accessory Example-PN-10005 ExampleTargetB2BStore 2 NONE 11 1

Mapping data

The following snippet from the sample catalog entry association configuration file demonstrates how to map each value to a business object logical schema path.
<_config:DataMapping>
	<_config:mapping xpath="CatalogEntryIdentifier/ExternalIdentifier/PartNumber" value="PartNumber" />
	<_config:mapping xpath="Association/Name" value="AssociationType" />
	<_config:mapping xpath="Association/CatalogEntryReference/CatalogEntryIdentifier/ExternalIdentifier/PartNumber" value="TargetPartNumber" />
	<_config:mapping xpath="Association/CatalogEntryReference/CatalogEntryIdentifier/ExternalIdentifier/StoreIdentifier/ExternalIdentifier/NameIdentifier" value="TargetStoreIdentifier" />
	<_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" 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.CatalogEntryAssociationMediator.

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.