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

Attribute dictionary data that is loaded in 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
Load the attribute dictionary data in the following sample.
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

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:
  1. HCL Commerce DeveloperOn a command line, go to the WCDE_installdir\bin directory.
  2. LinuxOpen 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.
  3. Enter the following command:
    For a non-ATP store:
    • Linux./dataload.sh ../samples/DataLoad/Catalog/wc-dataload-catalog-entry.XML
    • HCL Commerce Developerdataload ..\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:
    • Linux./dataload.sh ../samples/DataLoad/Catalog/wc-dataload-ATP-catalog-entry.XML
    • HCL Commerce Developerdataload ..\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.
  4. Once the product and SKU data is loaded, enter the following command to load attribute data to the attribute dictionary:
    • Linux./dataload.sh ../samples/DataLoad/Catalog/AttributeDictionaryAttribute/wc-dataload.xml
    • HCL Commerce Developerdataload ..\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.
  5. Optional: Load attributes and predefined values in other national languages. For example, to load attributes and predefined values in French, enter the following command:
    • Linux./dataload.sh ../samples/DataLoad/Catalog/AttributeDictionaryAttribute/wc-dataload-attribute-multi-langs.xml
    • HCL Commerce Developerdataload ..\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'))

Cleaning up the data

To remove the data that is loaded in this sample from the database, run CleanUp.sql file in the /samples/DataLoad/Catalog/AttributeDictionaryAttribute directory.