Samples > Data load utility samples > Examples: Mapping data > Examples: Mapping catalog data > Examples: Mapping category data


Example: Category relationships

You can insert, replace, or delete the category relationship data simultaneously using the data load utility. These examples uses a CSV file to demonstrate how to insert, replace, or delete the categories relationship data.


CSV file column definitions

GroupIdentifier

(Mandatory, String) The category identifier. This field cannot be null, and it must be unique.

ParentGroupIdentifier

(String) The parent identifier of this category. This will be null if this is a top level category.

Sequence

(Double) An optional number used to control the order in which child categories are displayed in a parent category.

Other optional fields not included in the example are:

storeIdentifier

(String) The identifier of the store the category belongs to. This column is only needed if the category belongs to a store which is different from the store defined in BusinessContext elements of the catalog relationship loader configuration file or the catalog loader configuration file. If this column is not provided in the CSV file, the StoreIdentifier in the business context will be used.

parentStoreIdentifier

(String) The Store identifier the parent category belongs to. Use this field when using the extended sites model, where the parent store is different from the store the new category is being added to.

Delete

(String) Indicates whether to delete. If you are performing a delete operation, specify this column. A value of "1", indicates that the row should be deleted.


CSV file with sample category relationship data


Insert or replace

The CSV file contains sample category relationship data with columns delimited by commas: CSV file with sample category relationship data

Formatted CSV file with column headings
GroupIdentifier ParentGroupIdentifier Sequence
LCD_category TV_category 1
Fridge_category Appl_category 2


Delete

The CSV file contains sample category relationship data with columns delimited by commas: CSV file with sample category relationship data

Formatted CSV file with column headings
GroupIdentifier ParentGroupIdentifier Sequence Delete
LCD_category TV_category 1 1
Fridge_category Appl_category 2 1


Map data

The following code snippet from the catalog relationship 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="ParentCatalogGroupIdentifier/UniqueID" value="ParentGroupUniqueId" />     <_config:mapping xpath="ParentCatalogGroupIdentifier/ExternalIdentifier/GroupIdentifier" value="ParentGroupIdentifier" />     <_config:mapping xpath="displaySequence" value="Sequence" />     <_config:mapping xpath="" value="Delete" deleteValue="1"/>
</_config:DataMapping>

If you are performing 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 CatalogGroupRelationshipMediator.


+

Search Tips   |   Advanced Search