Samples > Data load utility samples > Examples: Mapping data > Examples: Mapping catalog data > Examples: Mapping master catalog and sales catalog data


Example: Master and sales catalogs

You can insert, replace, or delete the master and sales catalog using the data load utility at the same time. These examples uses a CSV file to demonstrate how to insert, replace, or delete your master and sales catalog.


CSV file column definitions

Identifier

(Mandatory, String) The catalog identifier. This field cannot be null in Insert and it must be unique. In Replace or Delete, either this field or the CatalogUniqueId is required.

CatalogUniqueId

(Mandatory, BigInt) The internal unique reference number of the catalog. In Replace or Delete, either this field or the Identifier is required.

Name

(String) The language sensitive display name of this catalog.

Description

(String) A language sensitive description of this catalog.

ShortDescription

(String) A language sensitive short description of this catalog.

LongDescription

(String) A language sensitive long description of this catalog.

Thumbnail

(String) The language sensitive thumbnail image path of this catalog. The forward slash '/' should be used in the path. Do not use backward slash '\'. For example, images/G1.jpg.

FullImage

(String)The language sensitive full image path of this catalog. The forward slash '/' should be used in the path. Do not use backward slash '\'. For example, images/G1.jpg .

MasterCatalog

(Boolean) A flag indicating whether the catalog is a master catalog. The default value is false.

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 catalog data


Insert or replace

In this example, you insert four new catalog data. The file contains sample master and sales catalog data. Each column is delimited by a comma. CSV file with sample catalog data

Formatted CSV file with column headings
Identifier Name Description ShortDescription LongDescription Thumbnail FullImage MasterCatalog
Example_master_cat Example master catalog Example master catalog description Example master catalog short description Example master catalog long description master_thumb/image.jpg master_full/image.jpg true
Summer_sales_cat1 Summer sales catalog Summer sales catalog description Summer sales catalog short description Summer sales catalog long description summer_thumb/image.jpg summer_full/image.jpg false
Winter_sales_cat2 Winter sales catalog Winter sales catalog description Winter sales catalog short description Winter sales catalog long description Winter_thumb/image.jpg Winter_full/image.jpg false
Spring_sales_cat3 Spring sales catalog Spring sales catalog description Spring sales catalog short description Spring sales catalog long description Spring_thumb/image.jpg Spring_full/image.jpg false


Delete

In this example, the first three rows of data are deleted, and the fourth row replaces an existing data. Each column is delimited by a comma. CSV file with sample catalog data to be deleted or replaced

Formatted CSV file with column headings
Identifier Name Description ShortDescription LongDescription Thumbnail FullImage MasterCatalog Delete
Example_master_cat Example master catalog Example master catalog description Example master catalog short description Example master catalog long description master_thumb/image.jpg master_full/image.jpg true 1
Summer_sales_cat1 Summer sales catalog Summer sales catalog description Summer sales catalog short description Summer sales catalog long description summer_thumb/image.jpg summer_full/image.jpg false 1
Winter_sales_cat2 Winter sales catalog Winter sales catalog description Winter sales catalog short description Winter sales catalog long description Winter_thumb/image.jpg Winter_full/image.jpg false 1
Spring_sales_cat3 Spring sales catalog Spring sales catalog new description Spring sales catalog new short description Spring sales catalog new long description Spring_thumb/image.jpg Spring_full/image.jpg false  


Map data

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

<_config:DataMapping>     <_config:mapping xpath="CatalogIdentifier/ExternalIdentifier/Identifier" value="Identifier" valueFrom="InputData"/>     <_config:mapping xpath="CatalogIdentifier/UniqueID" value="CatalogUniqueId" valueFrom="InputData"/>     <_config:mapping xpath="primary" value="MasterCatalog" valueFrom="InputData" />     <_config:mapping xpath="Attributes/description" value="Description" valueFrom="InputData" />     <_config:mapping xpath="Description[0]/Name" value="Name" valueFrom="InputData" />     <_config:mapping xpath="Description[0]/ShortDescription" value="ShortDescription" valueFrom="InputData" />     <_config:mapping xpath="Description[0]/LongDescription" value="LongDescription" valueFrom="InputData" />     <_config:mapping xpath="Description[0]/Thumbnail" value="Thumbnail" valueFrom="InputData" />     <_config:mapping xpath="Description[0]/FullImage" value="FullImage" valueFrom="InputData" />     <_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 CatalogMediator. To initialize attribute dictionary for the store, see Initialize the attribute dictionary.


+

Search Tips   |   Advanced Search