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 we use an attribute dictionary, see Sample: Loading attribute dictionary data.
About this sample
Part numbers, attributes, and attribute values loaded in 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
(Developer) On a command line, go to the WCDE_installdir\bin directory.
- (Linux) Open a command line in the Utility server Docker container. 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:
- (Linux) ./dataload.sh ../samples/DataLoad/Catalog/wc-dataload-catalog-entry.XML
(Developer) dataload ..\samples\DataLoad\Catalog\wc-dataload-catalog-entry.XML
For ATP store:
- (Linux) ./dataload.sh ../samples/DataLoad/Catalog/wc-dataload-ATP-catalog-entry.XML
(Developer) dataload ..\samples\DataLoad\Catalog\wc-dataload-ATP-catalog-entry.XML
- Load attributes, allowed values, and specific values for the SKUs:
- (Linux) ./dataload.sh ../samples/DataLoad/Catalog/CatalogEntryAttribute/wc-dataload.xml
(Developer) 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:
- (Linux) ./dataload.sh ../samples/DataLoad/Catalog/CatalogEntryAttribute/wc-dataload-attribute-multi-langs.xml
(Developer) 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 the attribute_id field.
To return all attribute values loaded, enter: select attribute_id,attrvalue_id,catentry_id,name from attrvalue where attribute_id between attribute_id_range_min and attribute_id_range_maxWhere attribute_id_range_min and attribute_id_range_max are the minimum and maximum values of the attribute_id field 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')
We can also verify the load by viewing the attribute data in the Management Center or in the storefront.
Cleaning up the data
To remove the data loaded in this sample from the database, run the CleanUp.sql file in the /samples/DataLoad/Catalog/CatalogEntryAttribute directory.