Sample: Loading attribute dictionary data
This sample demonstrates how to load attributes, attribute values, and
predefined (allowed) values to the attribute dictionary. If you are using the attribute
dictionary, use this sample. If you do not use the attribute dictionary, see Sample: Loading attributes, attribute values, and allowed values
About this sample
Identifier | Type | Name | AllowedValue1 | AllowedValue2 | AllowedValue3 | AllowedValue4 | AllowedValue5 |
---|---|---|---|---|---|---|---|
CordsColor | STRING | Color | Black | Brown | |||
CordsSize | STRING | Size | 29W x 28L |
30W x 32L |
34Wx30L |
||
DressPantColor | STRING | Color | Black | Blue | |||
DressPantSize | STRING | Size | 29W x 32L |
32W x 32L |
|||
DressShirtColor | STRING | Color | White | ||||
DressShirtSize | STRING | Size | 15 | 16 | 17 | ||
CasualShirtColor | STRING | Color | White | Blue | Pink | Purple | |
CasualShirtSize | STRING | Size | Small | Medium | Large | ||
BodysuitColor | STRING | Color | Black | ||||
BodysuitSize | STRING | Size | Petit | ||||
Style | STRING | Style |
Identifier | Type | AttributeType | Sequence | Displayable | Searchable | Comparable | Name | AllowedValue1 | AllowedValue2 | AllowedValue3 | AllowedValue4 | AllowedValue5 |
---|---|---|---|---|---|---|---|---|---|---|---|---|
CordsColor | STRING | AllowedValues | 1.0 | true | true | true | Color | Black | Brown | |||
CordsSize | STRING | AllowedValues | 2.0 | true | true | true | Size | 29W x 28L |
30W x 32L |
34W x 30L |
||
DressPantColor | STRING | AllowedValues | 3.0 | true | true | true | Color | Black | Blue | |||
DressPantSize | STRING | AllowedValues | 4.0 | true | true | true | Size | 29W x 32L |
32W x 32L |
|||
DressShirtColor | STRING | AllowedValues | 5.0 | true | true | true | Color | White | ||||
DressShirtSize | STRING | AllowedValues | 6.0 | true | true | true | Size | 15 | 16 | 17 | ||
CasualShirtColor | STRING | AllowedValues | 7.0 | true | true | true | Color | White | Blue | Pink | Purple | |
CasualShirtSize | STRING | AllowedValues | 8.0 | true | true | true | Size | Small | Medium | Large | ||
BodysuitColor | STRING | AllowedValues | 9.0 | true | true | true | Color | Black | ||||
BodysuitSize | STRING | AllowedValues | 10.0 | true | true | true | Size | Petit | ||||
Style | STRING | AssignedValues | 11.0 | true | true | true | Style |
Prerequisite
- Before you run the Data Load utility for the first time, you must configure the store and database environment settings by performing the rmlsampleprepare.html.
- If you did not use the attribute dictionary before you perform this sample, you must initialize the attribute dictionary for your store .
Procedure
Complete the following steps to ensure that the associated products and SKUs are loaded to the database. The associated products and SKUs must be loaded before you load the attributes, and any attribute predefined values:- Open the command-line interface and go to the following directory:
- WC_installdir/bin
- WCDE_installdir\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
Note: If you prefer to work with data in XML format instead of in CSV format, you can edit the wc-dataload-catalog-entry.xml file and change the location to reference the xml files provided.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
Note: If you prefer to work with data in XML format instead of in CSV format, you can edit the wc-dataload-ATP-catalog-entry.xml file and change the location to reference the xml files provided. - Once the product and SKU data is 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
Note: If you prefer to work with data in XML format instead of in CSV format, you can edit the wc-dataload.xml file and change the location to reference the xml files provided. - Optional: Load attributes and predefined values in other national
languages. For example, to load attributes and predefined 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
Note: If you prefer to work with data in XML format instead of in CSV format, you can edit the wc-dataload-attribute-multi-langs.xml file and change the location to reference the xml files provided.
Verifying 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 predefined 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. The wc-dataload.xml file then calls the wc-loader-catalog-entry-AD-attribute-relationship.xml configuration file that is used to create the relationships between attribute dictionary attributes, attribute values, and catalog entries.Verify that the data is loaded by running the following SQL statements:
- To return all attributes that are 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 for 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 for 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'))