Sample: Loading attributes, attribute values, and allowed values
This sample demonstrates how to load attributes together with the associated
allowed values and attribute values in a single load operation.If you use an attribute
dictionary, see Sample: Loading attribute dictionary data.
About this sample
| Attribute Identifier | Attribute type | Attribute Value 1 | Attribute Value 2 |
|---|---|---|---|
| CordsColor | Defining attribute | Black | Brown |
| CordsSize | Defining attribute | 29W x 28L | |
| DressPantColor | Defining attribute | Black | Blue |
| DressPantSize | Defining attribute | 29W x 32L | |
| DressShirtColor | Defining attribute | White | |
| DressShirtSize | Defining attribute | 15 | 16 |
| CasualShirtColor | Defining attribute | White | Blue |
| CasualShirtSize | Defining attribute | Small | Medium |
| BodysuitColor | Defining attribute | Black | |
| BodysuitSize | Defining attribute | Petit |
Procedure
On a command line, go to the
WCDE_installdir\bin directory.
Open a command line in the .
Change the directory to
utilities_root/bin directory.
For information about entering and leaving containers, see
Running utilities from the Utility server Docker container.- Load the products and SKUS:For non-ATP store:
./dataload.sh
../samples/DataLoad/Catalog/wc-dataload-catalog-entry.XML
dataload
..\samples\DataLoad\Catalog\wc-dataload-catalog-entry.XML
For ATP store:
./dataload.sh
../samples/DataLoad/Catalog/wc-dataload-ATP-catalog-entry.XML
dataload
..\samples\DataLoad\Catalog\wc-dataload-ATP-catalog-entry.XML
- Load attributes, allowed values, and specific values for the SKUs:
./dataload.sh
../samples/DataLoad/Catalog/CatalogEntryAttribute/wc-dataload.xml
dataload
..\samples\DataLoad\Catalog\CatalogEntryAttribute\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/CatalogEntryAttribute/wc-dataload-attribute-multi-langs.xml
dataload
..\samples\DataLoad\Catalog\CatalogEntryAttribute\wc-dataload-attribute-multi-langs.xml
Verifying results
The wc-dataload.xml configuration file loads attribute data from the CatalogEntryDefiningAttributeAndAllowedValue.csv source file. The file is used to create the attributes and the range of allowed values for the products. The wc-dataload.xml file then calls the wc-loader-catalog-entry-defining-attribute-value.xml configuration file to load the specific attribute values to each SKU from the CatalogEntryDefiningAttributeValue.csv source file.Verify that the data is
loaded by running the following SQL statements:
- To return all attributes loaded,
enter:
select attribute_id,catentry_id,name from attribute where name in ('Color','Size') and language_id=-1 and catentry_id in (select catentry_id from catentry where partnumber like 'Cords%' or partnumber like 'Classic pleated dress pant%' or partnumber like 'Dress shirt%' or partnumber like 'Casual shirt%' or partnumber like 'Bodysuit%')Note: Record the range of values returned for theattribute_idfield. - To return all attribute values loaded,
enter:
Where attribute_id_range_min and attribute_id_range_max are the minimum and maximum values of theselect attribute_id,attrvalue_id,catentry_id,name from attrvalue where attribute_id between attribute_id_range_min and attribute_id_range_maxattribute_idfield returned in the previous SQL statement. - To return the attributes and values of a specific SKU,
enter:
select attribute_id,attrvalue_id,catentry_id,name from attrvalue where catentry_id in (select catentry_id from catentry where partnumber ='Cords-Black-29W x 28L')
You can also verify the load by viewing the attribute data in the Management Center or in the storefront.