Example: Relationship data for catalog entries and categories

You can use the Data Load utility to create, update, or delete the parent-child relationship between categories and catalog entries for both the master catalog or a sales catalog.

Feature Pack 6 or laterThis 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.

A relationship exists between your sales categories and any SKUs that are associated with catalog entries in your sales categories. When you are adding or removing the relationship between a parent category and a child product, any child SKUs for the product must first be added to, or removed from, the parent category. If you do not add or remove the child SKUs, searching for, or displaying, the SKUs in Management Center or your storefront might not function correctly. To add or remove the child SKUs, follow the same steps as for adding or removing catalog entries to or from a category.

Note: If you are loading sales categories, products, relationships between categories and catalog entries, and SKUs to be associated with the products, you must load your data in a specific order. If you load your data in an incorrect order, your products might not display for sale correctly in your storefront. You must ensure that you load your categories and catalog entries before you load the relationships between these categories and catalog entries. You must also load the relationship between your categories and catalog entries before you load SKUs for products that are within a sales category. For example, you can load you sales catalog data in the following order
  1. Products
  2. Categories
  3. Category - Product relationships
  4. SKUs

CSV column and XML element definitions

PartNumber
(String) The part number of the catalog entry. 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
(Integer) The internal unique reference number of the catalog entry. Either this field or the PartNumber is required.
ParentGroupIdentifier
(String) The identifier of the parent category. Either this field or the ParentGroupUniqueId is required.
ParentGroupUniqueId
(Integer) The unique reference number of the parent category. Either this field or the ParentGroupIdentifier is required.
ParentStoreIdentifier
(String) The identifier of the store that owns the parent category. Use this field when your site uses the extended sites model, where the store that owns the parent category is different from the store that owns the catalog entry.
ParentStoreUniqueId
(Integer) The unique reference number of the store that owns the parent category.
Sequence
(Decimal) An optional number that is used to control the order in which the catalog entry appears in the parent category.
Delete
(String) A flag that indicates whether to delete. Specify 1 to delete the row.

CSV file with sample catalog entry and category relationship data

Update

In this example, the CSV file contains sample catalog entry and category relationship data. Each column is delimited by a comma. CSV file with sample catalog entry and category relationship data.
Formatted CSV file with column headings
PartNumber Sequence ParentGroupIdentifier
'AuroraWMDRS-1' 1 10006
'AuroraWMDRS-4' 1 10006

Delete

In this example, the CSV file contains sample catalog entry and category relationship data for deletion. CSV file with sample catalog entry and category relationship data for deletion.

Formatted CSV file with column headings
PartNumber Sequence ParentPartNumber Delete
'AuroraWMDRS-2' 1 10006 1
'AuroraWMDRS-3' 1 10006 1

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 wc-loader-catalog-entry-parent-catalog-group.xml catalog entry category relationship loader configuration file.
<_config:DataMapping>
  <_config:mapping xpath="CatalogEntryIdentifier/UniqueID" value="CatalogEntryUniqueId" />
  <_config:mapping xpath="CatalogEntryIdentifier/ExternalIdentifier/PartNumber" value="PartNumber" />
  <_config:mapping xpath="ParentCatalogGroupIdentifier/UniqueID" value="ParentGroupUniqueId" />
  <_config:mapping xpath="ParentCatalogGroupIdentifier/ExternalIdentifier/GroupIdentifier" value="ParentGroupIdentifier" />
  <_config:mapping xpath="ParentCatalogGroupIdentifier/ExternalIdentifier/StoreIdentifier/UniqueID" value="ParentStoreUniqueId" />
  <_config:mapping xpath="ParentCatalogGroupIdentifier/ExternalIdentifier/StoreIdentifier/ExternalIdentifier/NameIdentifier" value="ParentStoreIdentifier" />
  <_config:mapping xpath="displaySequence" value="Sequence" />
  <_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.CatalogEntryParentCatalogGroupMediator.

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.