Example: Catalog entries

We can insert, replace, or delete product, SKU, bundle, and kit data using the Data Load utility. These examples use a CSV file to demonstrate how to insert, replace, or delete multiple product, SKU, bundle, and kit data.

This example uses a CSV file to demonstrate how to insert, replace, or delete your data. We 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 the 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, we 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:


CSV column and XML element definitions

Other optional fields not included in the example are:


CSV file with sample catalog entry data

Insert or replace

In this example the data source is a CSV file. The file contains sample catalog entry data: CSV file with sample catalog entry data. Due to the large number of fields in the CSV file, the table is split into four sections:

Formatted CSV file with column headings
PartNumber Type CurrencyCode DefaultOfferPrice ListPrice
Example-PN-10001 ProductBean USD 6795 6795
Example-PN-10002 ItemBean USD 3599 3999
Example-PN-10003 ItemBean CAD 1999 2450

Formatted CSV file with column headings - continued
ParentGroupIdentifier Sequence Language_ID Name ShortDescription
TV_category 8 -1 Color CRT television Color CRT short description
Appl_category 19 -1 200-watt microwave 200-watt microwave short description
Appl_category 20 -1 150-watt microwave 150-watt microwave short description

Formatted CSV file with column headings - continued
LongDescription Thumbnail FullImage AuxDescription1 AuxDescription2
Color CRT long description TV_thumb/image.jpg TV_full/image.jpg Color CRT auxiliary description 1 Color CRT auxiliary description 2
200-watt microwave long description 200_microw_thumb/image.jpg 200_microw_full/image.jpg 200-watt microwave auxiliary description 1 200-watt microwave auxiliary description 2
150-watt microwave long description 150_microw_thumb/image.jpg 150_microw_full/image.jpg 150-watt microwave auxiliary description 1 150-watt microwave auxiliary description 2

Formatted CSV file with column headings - continued
Available Published AvailabilityDate_LocaleSpecific Keyword
1 1 2008-04-20 16:00:00 CRT TV keyword
1 1 2008-04-20 16:00:00 200-watt microwave keyword
0 1 2008-04-20 16:00:00 150-watt microwave keyword


Delete

There are two ways to perform a delete operation on a catalog entry: mark for delete, and physical delete. When we use the mark for delete option, the catalog entry still exists in the database but the part number of the catalog entry is renamed, and the markForDelete column of the catalog entry is set to 1. When you use the physical delete option, which is the second option, the catalog entry is deleted from the database. By default, the data load utility uses the mark for delete option. This is the recommended option. To use the physical delete option, we must set the markForDelete attribute in the CatalogEntryMediator to "false". A sample catalog entry loader configuration file is shown:

In this example, the CSV file contains sample catalog entry data that will be deleted. Each column is delimited by a comma: CSV file with sample catalog entry data. Due to the large number of fields in the CSV file, the table is split into four sections:

Formatted CSV file with column headings
PartNumber Type CurrencyCode DefaultOfferPrice ListPrice
Example-PN-10001 ProductBean USD 6795 6795
Example-PN-10002 ItemBean USD 3599 3999
Example-PN-10003 ItemBean CAD 1999 2450

Formatted CSV file with column headings - continued
ParentGroupIdentifier Sequence Language_ID Name ShortDescription
TV_category 8 -1 Color CRT television Color CRT short description
Appl_category 19 -1 200-watt microwave 200-watt microwave short description
Appl_category 20 -1 150-watt microwave 150-watt microwave short description

Formatted CSV file with column headings - continued
LongDescription Thumbnail FullImage AuxDescription1 AuxDescription2
Color CRT long description TV_thumb/image.jpg TV_full/image.jpg Color CRT auxiliary description 1 Color CRT auxiliary description 2
200-watt microwave long description 200_microw_thumb/image.jpg 200_microw_full/image.jpg 200-watt microwave auxiliary description 1 200-watt microwave auxiliary description 2
150-watt microwave long description 150_microw_thumb/image.jpg 150_microw_full/image.jpg 150-watt microwave auxiliary description 1 150-watt microwave auxiliary description 2

Formatted CSV file with column headings - continued
Available Published AvailabilityDate_LocaleSpecific Keyword Delete
1 1 20/4/2008 CRT TV keyword 1
1 1 20/4/2008 200-watt microwave keyword 1
0 1 20/4/2008 150-watt microwave keyword 1


Mapping data

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

If you perform an insert or replace operation, do not specify the "Delete" column in the CSV file or we can leave the "Delete" column empty.


Business object mediator

The mediator class name is CatalogEntryMediator.

Note: When we use a mediator that is provided with WebSphere Commerce with the Data Load utility, the utility assumes that we are loading data for all columns for a business object. 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. See Configure a column exclusion list.