Example: Catalog entry and attribute dictionary attribute values

Use the Data Load utility to insert, replace, and delete relationship between catalog entry and attribute dictionary attribute values simultaneously.

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.

Note: If your site uses SEO and plans to load SEO URLs for catalog entries with the Data Load utility, configure the Data Load utility to load SEO information. In the load order configuration file, you must include the loadSEO parameter with a value set to be "true". This parameter must be set within the data load order configuration file with the following format:
<_config:property name="loadSEO" value="true"/>

CSV column and XML element definitions

PartNumber
(Required, String) The catalog entry identifier (SKU). Either this field or the CatalogEntryUniqueId is required. The part number for a catalog entry displays in Management Center as the value for the catalog entry Code property.
CatalogEntryUniqueId
(Required, Integer) The internal unique reference number of the catalog entry (SKU). Either this field or the PartNumber is required.
Identifier
(Required, String) The unique reference name for identifying the attribute. Either this field or the AttributeUniqueId is required.
AttributeUniqueId
(Required, Integer) The unique reference number of the attribute. Either this field or the Identifier is required.
ValueIdentifier
(String) The unique identifier of the attribute value. Use this field when the attribute has any allowed values that are defined. If the attribute does not have any allowed values that are defined, then this field is used as the value identifier of the newly created value.

To load multiple allowed values for the same Attribute in the same Catalog Entry, add multiple rows in the CSV file and provide a unique ValueIdentifier for each row.

Value
(String) The language-specific value of the attribute. Attribute values are based on the data type such as text, number, or decimal.

To load multiple assigned values for the same Attribute in the same Catalog Entry, add multiple rows in the CSV file and provide a unique Value for each row.

Language
(Integer) The language identifier for language sensitive fields. For example: -1 for English, -2 for French.
LanguageId
(Integer) The language identifier for language-specific fields. For example:
  • -1 for English
  • -2 for French.
The Language column is renamed to LanguageId. You must specify only one language identifier; use LanguageId instead of Language as the language identifier.
(Integer) The language ID for language-specific fields (Name, ShortDescription, LongDescription, AuxDescription1, AuxDescription2, Thumbnail, FullImage, Published, and Keyword). For instance:
  • -1 for English
  • -2 for French.
Usage
(String) The usage of the attribute in relation to the catalog entry. It is 'Defining' for defining attribute which is used for SKU resolution; 'Descriptive' for descriptive attribute.
Sequence
(Decimal) A number that is used to control the order in which attributes display for a catalog entry. Attributes display in ascending order. The default value is 0.

Other optional fields not included in this example are:

AttributeStoreUniqueId
(Integer) The unique reference number of the store that owns the attribute dictionary.
AttributeStoreIdentifier
(String) The identifier of the store that owns the attribute dictionary. When you are using the extended sites store, use this field to identify the store that owns the attribute. In an extended sites store, the store that owns the attribute dictionary and attribute can be different than the store your catalog entry belongs to.
Field1
(Integer) A custom field for the catalog entry and attribute relationship information. (FIELD1 column of CATENTRYATTR table).
Field2
(Integer) A custom field for the catalog entry and attribute relationship information. (FIELD2 column of CATENTRYATTR table).
Field3
(String) A custom field for the catalog entry and attribute relationship information. (FIELD3 column of CATENTRYATTR table).
Delete
(String) A flag that indicates whether to delete. To delete a row, specify 1.

CSV file with sample attribute dictionary attribute and value data

In this example, the CSV file contains attribute dictionary data.
PartNumber AttributeIdentifier ValueIdentifier
Shirt-Red-Large ShirtColor Red
Shirt-Red-Large ShirtSize Large

Mapping data

The following code snippet demonstrates how to map each value to a business object logical schema path. This code snippet is from the catalog entry and attribute relationship load configuration file
<_config:DataMapping>
  <_config:mapping xpath="CatalogEntryIdentifier/ExternalIdentifier/PartNumber" value="PartNumber" valueFrom="InputData"/>
  <_config:mapping xpath="CatalogEntryIdentifier/UniqueId" value="CatalogEntryUniqueId" valueFrom="InputData"/>
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AttributeIdentifier/ExternalIdentifier/Identifier" value="Identifier" valueFrom="InputData"/>
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AttributeIdentifier/UniqueId" value="AttributeUniqueId" valueFrom="InputData"/>
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/Value/identifier" value="ValueIdentifier" valueFrom="InputData" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/Value/value" value="Value"  />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/language" value="Language"  valueFrom="InputData" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/languageId" value="LanguageId"/>
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/usage" value="Usage"  valueFrom="InputData" />
  <_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/displaySequence" value="Sequence" valueFrom="InputData" />
  <_config:mapping xpath="CatalgoEntryAttributes/Attributes[0]/AttributeIdentifier/ExternalIdentifier/StoreIdentifier/UniqueId" value="AttributeStoreUniqueId"/>
  <_config:mapping xpath="CatalgoEntryAttributes/Attributes[0]/AttributeIdentifier/ExternalIdentifier/StoreIdentifier/ExternalIdentifier/NameIdentifier" value="AttributeStoreIdentifier"/>
  <_config:mapping xpath="CatalgoEntryAttributes/Attributes[0]/ExtendedData/AttributeRelationshipField1" value="Field1"/>
  <_config:mapping xpath="CatalgoEntryAttributes/Attributes[0]/ExtendedData/AttributeRelationshipField2" value="Field2"/>
  <_config:mapping xpath="CatalgoEntryAttributes/Attributes[0]/ExtendedData/AttributeRelationshipField3" value="Field3"/>
  <_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 data load framework provides a business object mediator for inserting, replacing, and deleting relationship between catalog entries and attribute dictionary attributes. The mediator class name is com.ibm.commerce.catalog.dataload.mediator.CatalogEntryAttributeDictionaryAttributeMediator.

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.