Samples > Data load utility samples
Sample: Loading attribute dictionary data
This sample demonstrates how to load attributes, attribute values, and allowed values to the attribute dictionary. If you are using the attribute dictionary, use this sample. If you are using classic attributes, use the sample Load classic attributes, attribute values, and allowed values.
About this sample
Attribute dictionary data loaded in this sample.
Attribute Identifier Attribute type Attribute Value 1 Attribute Value 2 Attribute Value 3 Attribute Value 4 CordsColor Define attribute Black Brown CordsSize Define attribute 29W x 28L 30W x 32L 34Wx30L DressPantColor Define attribute Black Blue DressPantSize Define attribute 29W x 32L 32W x 32L DressShirtColor Define attribute White DressShirtSize Define attribute 15 16 17 CasualShirtColor Define attribute White Blue Pink Purple CasualShirtSize Define attribute Small Medium Large BodysuitColor Define attribute Black BodysuitSize Define attribute Petit Style Descriptive attribute
Procedure
Complete the following steps to ensure that the associated products and SKUs have been loaded to the database before loading the attributes, attribute values, and allowed values:
- Open the command-line interface and navigate to the appropriate directory:
- WC_INSTALL/bin
- WCDE_INSTALL\bin
- Enter the following command:
For a non-ATP store:
- ./dataload.sh ../samples/DataLoad/Catalog/wc-dataload-catalog-entry.xml
- dataload ..\samples\DataLoad\Catalog\wc-dataload-catalog-entry.xml
For an ATP store:
- ./dataload.sh ../samples/DataLoad/Catalog/wc-dataload-ATP-catalog-entry.xml
- dataload ..\samples\DataLoad\Catalog\wc-dataload-ATP-catalog-entry.xml
- Once the product and SKU data have been loaded, enter the following command to load attribute data to the attribute dictionary:
- ./dataload.sh ../samples/DataLoad/Catalog/AttributeDictionaryAttribute/wc-dataload.xml
- dataload ..\samples\DataLoad\Catalog\AttributeDictionaryAttribute\wc-dataload.xml
- (Optional) Load attributes and allowed values in other national languages. For example, to load attributes and allowed values in French, enter the following command:
- ./dataload.sh ../samples/DataLoad/Catalog/AttributeDictionaryAttribute/wc-dataload-attribute-multi-langs.xml
- dataload ..\samples\DataLoad\Catalog\AttributeDictionaryAttribute\wc-dataload-attribute-multi-langs.xml
Verify results
The wc-dataload.xml configuration file calls the wc-loader-AD-attribute-and-allowed-value.xml file to load attribute data from the AttributeDictionaryAttributeAndAllowedValue.csv source file. This file is used to create the attributes and the range of allowed values in the attribute dictionary. The wc-dataload.xml file then calls the wc-loader-AD-attribute-value.xml configuration file to load the specific attribute values for each SKU from the AttributeDictionaryAttributeValue.csv source file.Verify that the data has been loaded by running the following SQL statements:
- To return all attributes loaded, enter:
select * from attr where identifier in ('CordsColor','CordsSize','DressPantColor','DressPantSize','DressShirtColor','DressShirtSize','CasualShirtColor','CasualShirtSize','BodysuitColor','BodysuitSize','Style')
- To return all attribute values loaded, enter:
select * from attrval where attr_id in (select attr_id from attr where identifier in ('CordsColor','CordsSize','DressPantColor','DressPantSize','DressShirtColor','DressShirtSize','CasualShirtColor','CasualShirtSize','BodysuitColor','BodysuitSize','Style'))
- To return the attributes and values the SKU 'Cords-Black-29W x 28L', enter:
select * from attrval where (attr_id,attrval_id) in (select attr_id,attrval_id from catentryattr where catentry_id in (select catentry_id from catentry where partnumber ='Cords-Black-29W x 28L'))
- To return the attributes and values the SKU 'Bodysuit-Black-Petit', enter:
select attr_id,attrval_id,identifier from attrval where attrval_id in (select attrval_id from catentryattr where catentry_id in (select catentry_id from catentry where partnumber ='Bodysuit-Black-Petit'))
Clean up the data
To remove the data loaded in this sample from the database, run CleanUp.sql file located in the /samples/DataLoad/Catalog/AttributeDictionaryAttribute directory.
Related concepts
Related reference