In most of the ecommerce implementations the merchant would use an external Order management system to maintain the catalog subsystem which includes items and it's attributes, we usually end up loading and defining catalog in WCS master catalog, in earlier versions WCS used to support a schema for defining descriptive and defining attributes for a product, one of the main limitations of this model was that you would end up defining the attributes for each product/item even if the attribute names are the same, for instance every product in your catalog might have a descriptive attribute by name BUYING_GUIDE which indicates the buying guide URL, you would define a new attribute BUYING_GUIDE as an attribute for every product.
Attribute dictionary is a new feature supported from V7 onwards, consider the previous example, you can now define just one attribute with name BUYING_GUIDE and share it among all product of your catalog, the value of this attribute alone can be different based on the catentry to which it is associated,with this new schema you can simplify the process of keeping attribute names and values consistent across your site.
Loading attribute using classic attribute model
CATENTRY -----> ATTRIBUTE ----> ATTRIBUTEVALUE
a. Define wc-dataload-env.xml and wc-dataload.xml dataloader files, wc-dataload-env.xml file consists of details related to your database environment, wc-dataload.xml defines the dataload source data.
you can reuse the env file located at following location and load it to OOB Apache derby database
WCDE_ENT70\samples\DataLoad\Catalog\wc-dataload-env.xml
Define WCDE_ENT70\samples\DataLoad\Catalog\CatalogEntryAttribute\wc-dataload.xml as follows.
<_config:DataLoadConfiguration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../../../../xml/config/xsd/wc-dataload.xsd"
xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">
<_config:DataLoadEnvironment configFile="../wc-dataload-env.xml" />
<_config:LoadOrder commitCount="100" batchSize="1" dataLoadMode="Replace">
<_config:property name="firstTwoLinesAreHeader" value="true" />
<_config:LoadItem name="ClassicAttributeAndValue" businessObjectConfigFile="wc-loader-classic-attribute-and-value.xml" >
<_config:DataSourceLocation location="ClassicAttributeAndValue.csv" />
</_config:LoadItem>
</_config:LoadOrder>
</_config:DataLoadConfiguration>
b. Define the business object config file which defines the mapping of source data file fields with the database fields.
Define wc-loader-classic-attribute-and-value.xml in WCDE_ENT70\samples\DataLoad\Catalog\CatalogEntryAttribute\wc-loader-classic-attribute-and-value.xml as follows
<_config:DataloadBusinessObjectConfiguration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../../../../xml/config/xsd/wc-dataload-businessobject.xsd"
xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">
<_config:DataLoader className="com.ibm.commerce.foundation.dataload.BusinessObjectLoader" >
<_config:DataReader className="com.ibm.commerce.foundation.dataload.datareader.CSVReader" firstLineIsHeader="true" useHeaderAsColumnName="true" />
<_config:BusinessObjectBuilder className="com.ibm.commerce.foundation.dataload.businessobjectbuilder.BaseBusinessObjectBuilder"
packageName="com.ibm.commerce.catalog.facade.datatypes.CatalogPackage" dataObjectType="CatalogEntryType" >
<_config:DataMapping>
<!-- The part number of the catalog entry -->
<_config:mapping xpath="CatalogEntryIdentifier/ExternalIdentifier/PartNumber" value="PartNumber" />
<!-- The unique reference number of the catalog entry -->
<_config:mapping xpath="CatalogEntryIdentifier/UniqueID" value="CatalogEntryUniqueId" />
<!-- The unique reference number of the attribute -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AttributeIdentifier/UniqueID" value="AttributeUniqueId" />
<!-- The attribute data type -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AttributeDataType" value="Type" />
<!-- The attribute language -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/language" value="Language" />
<!-- The attribute name -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/Name" value="Name" />
<!-- The attribute usage -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/usage" value="2" valueFrom="Fixed" />
<!-- The attribute display sequence -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/displaySequence" value="Sequence" />
<!-- The attribute description -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/Description" value="Description" />
<!-- The attribute secondary description -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/SecondaryDescription" value="SecondaryDescription" />
<!-- The attribute group name -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/DisplayGroupName" value="GroupName" />
<!-- The attribute custom field 1 -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/Field1" value="Field1" />
<!-- The attribute footnote -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/Footnote" value="Footnote" />
<!-- The units in which the attribute is measured -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/UnitOfMeasure" value="UnitOfMeasure" />
<!-- The attribute value -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/Value/value" value="Value" />
<!-- The attribute value language -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/language" value="Language" />
<!-- The Delete indicator -->
<_config:mapping xpath="" value="Delete" deleteValue="1" />
</_config:DataMapping>
<_config:BusinessObjectMediator className="com.ibm.commerce.catalog.dataload.mediator.CatalogEntryAttributeMediator" componentId="com.ibm.commerce.catalog" />
</_config:BusinessObjectBuilder>
</_config:DataLoader>
</_config:DataloadBusinessObjectConfiguration>
c. Run the dataloader as follows, refer to the screenshot below.
d. you can query following tables to understand the changes made by this dataload process.
you would notice that it has created two attributes with the same name in attribute table and associated it to individual catentries.
select * from attribute where CATENTRY_ID in
(select CATENTRY_ID from catentry where partnumber in ('TATA-0101','FUCO-0101'));
Loading attribute using attribute dictionary model
CATENTRY -----> CATENTRYATTR ---->ATTR
|
|
---------------->ATTRVAL
a. Define WCDE_ENT70\samples\DataLoad\Catalog\CatalogEntryAttribute\wc-dataload.xml as follows.
<_config:DataLoadConfiguration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../../../../xml/config/xsd/wc-dataload.xsd"
xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">
<_config:DataLoadEnvironment configFile="../wc-dataload-env.xml" />
<_config:LoadOrder commitCount="100" batchSize="1" dataLoadMode="Replace">
<_config:property name="firstTwoLinesAreHeader" value="true" />
<_config:LoadItem name="ADAttributeAndValue" businessObjectConfigFile="wc-loader-AD-attribute-and-allowed-values.xml" >
<_config:DataSourceLocation location="ADAttribute.csv" />
</_config:LoadItem>
<_config:LoadItem name="ADCatentryAttributeAndValue" businessObjectConfigFile="wc-loader-ad-attribute-and-value.xml" >
<_config:DataSourceLocation location="ADAttributeAndValue.csv" />
</_config:LoadItem>
</_config:LoadOrder>
</_config:DataLoadConfiguration>
b. reused the file located in WCDE_ENT70\samples\DataLoad\Catalog\AttributeDictionaryAttribute\wc-loader-AD-attribute-and-allowed-values.xml as is.
c. reused WCDE_ENT70\samples\DataLoad\Catalog\AttributeDictionaryAttribute\wc-loader-catalog-entry-AD-attribute-relationship.xml
d. Created ADAttribute.csv with following content
ADAttributeAndValue,,,,,,,,
Identifier,Type,Name,AllowedValue1,AllowedValue2,AllowedValue3,AllowedValue4,AllowedValue5,Delete
BUYING_GUIDE,STRING,BUYING_GUIDE,,,,,,
e. Created ADAttributeAndValue.csv file with following content
CatalogEntryAttributeDictionaryAttributeRelationship,,,,,,
PartNumber,AttributeIdentifier,ValueIdentifier,Value,Usage,Sequence,Delete
TATA-0101,BUYING_GUIDE,,Http://mycompany.com/PartNumberA1.pdf,Descriptive,1,1
FUCO-0101,BUYING_GUIDE,,Http://mycompany.com/PartNumberA1.pdf,Descriptive,1,
Run the dataload script as follows.
C:\IBM\WCDE_ENT70\bin>dataload.bat C:\IBM\WCDE_ENT70\samples\DataLoad\Catalog\At
tributeDictionaryAttribute\wc-dataload.xml
The dataload process will first define the attribute BUYING_GUIDE in following tables.
Table name: ATTRDICT, Affected number of rows: 1.
Table name: ATTR, Affected number of rows: 1.
Table name: ATTRDESC, Affected number of rows: 1.
BUYING_GUIDE Attribute value is defined and then associated to the catentry.
Table name: ATTRVAL, Affected number of rows: 2.
Table name: ATTRVALDESC, Affected number of rows: 2.
Table name: CATENTRYATTR, Affected number of rows: 2.
As you can notice from the two datamodel, with Attribute dictionary model sample attribute and names can be shared among multiple catentries.
Here are reference to some of the useful Infocenter links on this topic.
Attribute dictionary data model
http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/index.jsp?topic=/com.ibm.commerce.data.doc/refs/rdmattrdict.htm
An excellent IBM tutorial on Classic attribute and attribute dictionary
http://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/topic/com.ibm.iea.wcs/wcs/6.0.0.4/Customization/WCS6004_CatalogAttributeDictionary.pdf
Steps to hide display of classic attribute in Management Center.
http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.management-center.doc/tasks/tpnhideclassattrib.htm
Attribute dictionary is a new feature supported from V7 onwards, consider the previous example, you can now define just one attribute with name BUYING_GUIDE and share it among all product of your catalog, the value of this attribute alone can be different based on the catentry to which it is associated,with this new schema you can simplify the process of keeping attribute names and values consistent across your site.
Loading attribute using classic attribute model
CATENTRY -----> ATTRIBUTE ----> ATTRIBUTEVALUE
a. Define wc-dataload-env.xml and wc-dataload.xml dataloader files, wc-dataload-env.xml file consists of details related to your database environment, wc-dataload.xml defines the dataload source data.
you can reuse the env file located at following location and load it to OOB Apache derby database
WCDE_ENT70\samples\DataLoad\Catalog\wc-dataload-env.xml
Define WCDE_ENT70\samples\DataLoad\Catalog\CatalogEntryAttribute\wc-dataload.xml as follows.
<_config:DataLoadConfiguration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../../../../xml/config/xsd/wc-dataload.xsd"
xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">
<_config:DataLoadEnvironment configFile="../wc-dataload-env.xml" />
<_config:LoadOrder commitCount="100" batchSize="1" dataLoadMode="Replace">
<_config:property name="firstTwoLinesAreHeader" value="true" />
<_config:LoadItem name="ClassicAttributeAndValue" businessObjectConfigFile="wc-loader-classic-attribute-and-value.xml" >
<_config:DataSourceLocation location="ClassicAttributeAndValue.csv" />
</_config:LoadItem>
</_config:LoadOrder>
</_config:DataLoadConfiguration>
b. Define the business object config file which defines the mapping of source data file fields with the database fields.
Define wc-loader-classic-attribute-and-value.xml in WCDE_ENT70\samples\DataLoad\Catalog\CatalogEntryAttribute\wc-loader-classic-attribute-and-value.xml as follows
<_config:DataloadBusinessObjectConfiguration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../../../../xml/config/xsd/wc-dataload-businessobject.xsd"
xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">
<_config:DataLoader className="com.ibm.commerce.foundation.dataload.BusinessObjectLoader" >
<_config:DataReader className="com.ibm.commerce.foundation.dataload.datareader.CSVReader" firstLineIsHeader="true" useHeaderAsColumnName="true" />
<_config:BusinessObjectBuilder className="com.ibm.commerce.foundation.dataload.businessobjectbuilder.BaseBusinessObjectBuilder"
packageName="com.ibm.commerce.catalog.facade.datatypes.CatalogPackage" dataObjectType="CatalogEntryType" >
<_config:DataMapping>
<!-- The part number of the catalog entry -->
<_config:mapping xpath="CatalogEntryIdentifier/ExternalIdentifier/PartNumber" value="PartNumber" />
<!-- The unique reference number of the catalog entry -->
<_config:mapping xpath="CatalogEntryIdentifier/UniqueID" value="CatalogEntryUniqueId" />
<!-- The unique reference number of the attribute -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AttributeIdentifier/UniqueID" value="AttributeUniqueId" />
<!-- The attribute data type -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/AttributeDataType" value="Type" />
<!-- The attribute language -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/language" value="Language" />
<!-- The attribute name -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/Name" value="Name" />
<!-- The attribute usage -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/usage" value="2" valueFrom="Fixed" />
<!-- The attribute display sequence -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/displaySequence" value="Sequence" />
<!-- The attribute description -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/Description" value="Description" />
<!-- The attribute secondary description -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/SecondaryDescription" value="SecondaryDescription" />
<!-- The attribute group name -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/DisplayGroupName" value="GroupName" />
<!-- The attribute custom field 1 -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/Field1" value="Field1" />
<!-- The attribute footnote -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/Footnote" value="Footnote" />
<!-- The units in which the attribute is measured -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/ExtendedData/UnitOfMeasure" value="UnitOfMeasure" />
<!-- The attribute value -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/Value/value" value="Value" />
<!-- The attribute value language -->
<_config:mapping xpath="CatalogEntryAttributes/Attributes[0]/language" value="Language" />
<!-- The Delete indicator -->
<_config:mapping xpath="" value="Delete" deleteValue="1" />
</_config:DataMapping>
<_config:BusinessObjectMediator className="com.ibm.commerce.catalog.dataload.mediator.CatalogEntryAttributeMediator" componentId="com.ibm.commerce.catalog" />
</_config:BusinessObjectBuilder>
</_config:DataLoader>
</_config:DataloadBusinessObjectConfiguration>
c. Run the dataloader as follows, refer to the screenshot below.
d. you can query following tables to understand the changes made by this dataload process.
you would notice that it has created two attributes with the same name in attribute table and associated it to individual catentries.
select * from attribute where CATENTRY_ID in
(select CATENTRY_ID from catentry where partnumber in ('TATA-0101','FUCO-0101'));
Loading attribute using attribute dictionary model
CATENTRY -----> CATENTRYATTR ---->ATTR
|
|
---------------->ATTRVAL
a. Define WCDE_ENT70\samples\DataLoad\Catalog\CatalogEntryAttribute\wc-dataload.xml as follows.
<_config:DataLoadConfiguration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../../../../xml/config/xsd/wc-dataload.xsd"
xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">
<_config:DataLoadEnvironment configFile="../wc-dataload-env.xml" />
<_config:LoadOrder commitCount="100" batchSize="1" dataLoadMode="Replace">
<_config:property name="firstTwoLinesAreHeader" value="true" />
<_config:LoadItem name="ADAttributeAndValue" businessObjectConfigFile="wc-loader-AD-attribute-and-allowed-values.xml" >
<_config:DataSourceLocation location="ADAttribute.csv" />
</_config:LoadItem>
<_config:LoadItem name="ADCatentryAttributeAndValue" businessObjectConfigFile="wc-loader-ad-attribute-and-value.xml" >
<_config:DataSourceLocation location="ADAttributeAndValue.csv" />
</_config:LoadItem>
</_config:LoadOrder>
</_config:DataLoadConfiguration>
b. reused the file located in WCDE_ENT70\samples\DataLoad\Catalog\AttributeDictionaryAttribute\wc-loader-AD-attribute-and-allowed-values.xml as is.
c. reused WCDE_ENT70\samples\DataLoad\Catalog\AttributeDictionaryAttribute\wc-loader-catalog-entry-AD-attribute-relationship.xml
d. Created ADAttribute.csv with following content
ADAttributeAndValue,,,,,,,,
Identifier,Type,Name,AllowedValue1,AllowedValue2,AllowedValue3,AllowedValue4,AllowedValue5,Delete
BUYING_GUIDE,STRING,BUYING_GUIDE,,,,,,
e. Created ADAttributeAndValue.csv file with following content
CatalogEntryAttributeDictionaryAttributeRelationship,,,,,,
PartNumber,AttributeIdentifier,ValueIdentifier,Value,Usage,Sequence,Delete
TATA-0101,BUYING_GUIDE,,Http://mycompany.com/PartNumberA1.pdf,Descriptive,1,1
FUCO-0101,BUYING_GUIDE,,Http://mycompany.com/PartNumberA1.pdf,Descriptive,1,
Run the dataload script as follows.
C:\IBM\WCDE_ENT70\bin>dataload.bat C:\IBM\WCDE_ENT70\samples\DataLoad\Catalog\At
tributeDictionaryAttribute\wc-dataload.xml
The dataload process will first define the attribute BUYING_GUIDE in following tables.
Table name: ATTRDICT, Affected number of rows: 1.
Table name: ATTR, Affected number of rows: 1.
Table name: ATTRDESC, Affected number of rows: 1.
BUYING_GUIDE Attribute value is defined and then associated to the catentry.
Table name: ATTRVAL, Affected number of rows: 2.
Table name: ATTRVALDESC, Affected number of rows: 2.
Table name: CATENTRYATTR, Affected number of rows: 2.
As you can notice from the two datamodel, with Attribute dictionary model sample attribute and names can be shared among multiple catentries.
Here are reference to some of the useful Infocenter links on this topic.
Attribute dictionary data model
http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/index.jsp?topic=/com.ibm.commerce.data.doc/refs/rdmattrdict.htm
An excellent IBM tutorial on Classic attribute and attribute dictionary
http://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/topic/com.ibm.iea.wcs/wcs/6.0.0.4/Customization/WCS6004_CatalogAttributeDictionary.pdf
Steps to hide display of classic attribute in Management Center.
http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.management-center.doc/tasks/tpnhideclassattrib.htm
Hi i got trained for basics things in WCS for ten days and need to take up WCS6 certification.. What are the ways i need to prepare myself for this exam...
ReplyDeleteIBM education assistant is a good starting point, and you can also take some sample tests for USD 30 from prometric.
ReplyDeletehttp://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/index.jsp
Hi Hari,
ReplyDeleteWould you have a sample code to access attribute dictinary attributes for a CatentryId?
Thanks in advance,
Sam
Sam, JSP code is available in slide number 16 of IBM tutorial.
ReplyDeletehttp://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/topic/com.ibm.iea.wcs/wcs/6.0.0.4/Customization/WCS6004_CatalogAttributeDictionary.pdf
Hi Hari,
ReplyDeleteI need to get the attributes in Java code, not in JSP. Can't find any documentation for this.
Thanks,
Al
Hi,
ReplyDeleteThere is a small glitch in the retrieval part in the jsp. If i uncheck the comparable, searchable or viewable fields for an attribute in management center, the catalogEntry facade always returns default values.
ie earlier if it is viewable and not viewable now, both times the attribute.viewable flag is always false. Can you help?
Hi I am looking for a solution to simplify the URL in WCS 7 FEP 3
ReplyDeleteFrom
protocol://hostname/webapp/wcs/stores/servlet/Logon?storeId=00000&langId=000
To
protocol://hostname/myaccount/Logon?storeId=00000&langId=000
and
protocol://hostname/webapp/wcs/stores/servlet/ShoppingCart?storeId=00000&langId=000
protocol://hostname/ordering/ShoppingCart?storeId=00000&langId=000
and many more like this on the same site
Hi Hari,
ReplyDeleteI am having a specific issue.. I am using dictionary model to load the data.1. When there are 3 records in catentryattr table and if new entry wants to add , then Replace mode is deleting the existing 3 rows and adding new row. I tried setting Delete flag to '0' explicitly and adding following line to Mediator object, both do not work. When i try to run dataload with 4 records (3 existing and 1 new) the said problem happens. Any idea please...thanks<_config:property name="markForDelete" value="false" />
thanks, Phani
Hi Hari,
ReplyDeleteIf we need to add new attributes (of products), in what tables we must add? Just the names only. Also, how should the xml file look like? Thanks
-Ven
This comment has been removed by the author.
ReplyDeleteHari - Thanks for the guide in this page. Do you have your ClassicAttributeAndValue.csv file that you can share? In V7, there are acutally three files that are used by default which, to me, over complicates the process. If you used just one file for Classic attribute load I would be interesting in seeing what it looks like.
ReplyDeleteWell explained. Got to learn new things from your Blog on Coded UI.Coded UI Training in Chennai
ReplyDeleteThe Collection Marts is platform where you can view latest designs about home décor and bedding. We have large range in different categories with finest fabric in cotton and silk. jaipur cotton bed sheets online , bridal bed sheets You can view not only present trends but also view huge collection with reasonable price. The Collection Marts can provide fast service about delivery as well as customer support too. Our products are not only self-made but also, well connected with markets to ensure for possibility of available designs if client want to purchase. The Collection Marts customer support open 24/7 to guide their customers about material or product stuff.
ReplyDeleteLoved learning about the history behind this. So much work clearly went into the research. It's impressive how much was uncovered. Definitely gave me a new appreciation for the subject matter. Well written and really fleshed things out thoroughly. Thanks for the thoroughly enjoyable and informative read. black tarpaulin
ReplyDeleteGreat job covering all the key areas. A very thorough discussion that tackled multiple sides of the issue.
ReplyDeletetarpaulin covers