Welcome to the IBM Websphere Commerce Hub


Welcome to the IBM Websphere Commerce Hub

Come join me in my journey to explore the various features and capabilities of IBM Websphere Commerce and understand how retailers can benefit from its really cool out-of-box functionality.

Showing posts with label WCS7. Show all posts
Showing posts with label WCS7. Show all posts

Sunday, June 14, 2015

Attribute Dictionary - Defining Attributes

Basic Concepts :


What is Attribute Dictionary?

An attribute dictionary is a set of common attributes and attribute values that can be reused by multiple products. The attribute management tool in Management Center provides business users the ability to create, update, assign, and manage product attributes.

More detailed understanding can be found here in the Infocenter.


What are defining and descriptive attributes?

There are two types of attributes: descriptive attributes and defining attributes.
  • Descriptive attributes are not intended for SKU resolution. These attributes only provide additional information about the product. An example would be “Operating System Installed” with the values “Windows 7”, “Windows 8” etc.
  • Defining attributes are used for SKU resolution and you won’t be able to buy an item until you have given values for these defining attributes. An example would be a T-Shirt and the defining attributes “Size” and “Colour”. Once a value has been given for the two different defining attributes such as Colour: Red and Size: Medium, we will be able to determine the item/SKU that corresponds to medium, red colour shirt.


Problem Statement:


The task that we have in hand is to display all the "possible" allowed values of the defining attribtes on the PDP so that it can be used for SKU resolution when a customer makes his/her choice of the values of the defining attributes from the dropdown. The reason I say "possible" is because attribute dictionary Standardizes attributes and attribute values that are common among multiple products. For example , in the attribute dictionary , you may have a attribute called size with all allowed values of "XS" , "S" , "M" , "L" , "XL". But for a particular product - the only possible values from the list may be "S" , "M" and "L". In this scenario, I would only want to display the possible "allowed" values of "S" , "M" and "L" - rather than all the 5 allowed values 


Solution & Approach:  


I first wanted to explore if there was any OOB DSL components (get-data expressions / access profiles) which would help me accomplish my requirement.

One useful reference link in Infocenter which could help me understand this was -

From the list of access-profiles listed in the link above , I found that access-profile "IBM_Store_CatalogEntryAttributesParent" . One of the associated sql statements to this access profile in the corresponding tpl file clearly does what we require

<!-- ========================================================== 
     Adds the allowed values of attribute dictionary 
     attributes (ATTRVAL table) to the
      resultant data graph.         
     The allowed values which are not used by valid SKU of the product are filtered out                        
     ========================================================== -->
BEGIN_ASSOCIATION_SQL_STATEMENT
name=IBM_AttributeDictionaryAttributeSchemaAllowedValue

I could not , however , find a get expression associated with this accessprofile. So , I extended the corresponding \Stores\WebContent\WEB-INF\config\com.ibm.commerce.catalog-ext\get-data-config.xml (Please follow the recommended process to extend the get-data-config.xml) and added the below expression:

<expression-builder>
<name>getParentCatalogEntryAttrDictDefiningAttributesByID</name>
<data-type-name>CatalogEntry</data-type-name>
<expression-template>{_wcf.ap=$accessProfile$;_wcf.dataLanguageIds='$dataLanguageIds$'}/CatalogEntry[CatalogEntryIdentifier[(UniqueID='$catEntryId$')]]</expression-template>
<param>
<name>accessProfile</name>
<value>IBM_Store_CatalogEntryAttributesParent</value>
</param>
<param>
<name>dataLanguageIds</name>
<value></value>
</param>
</expression-builder>

And in the storefront JSP , used the following code-snippet to fetch the data using the above get expression:


<wcf:getData type = "com.ibm.commerce.catalog.facade.datatypes.CatalogEntryType" var = "catalogEntryWithAttr" expressionBuilder = "getParentCatalogEntryAttrDictDefiningAttributesByID">
<wcf:contextData name = "storeId" data = "${param.storeId}"/>
<wcf:param name = "catEntryId" value = "${product.productID}"/>
<wcf:param name = "dataLanguageIds" value = "${param.langId}"/>
</wcf:getData>

<c:forEach var="attribute" items='${catalogEntryWithAttr.catalogEntryAttributes.attributes}'> 
<c:if test="${attribute.usage== 'Defining'}" >
<p>
         <label><c:out value = "${attribute.name}"/>:</label>
<select id= "${attribute.name}" name = "${attribute.name}">
     <c:forEach var='attributeVal' items='${attribute.allowedValue}'> 
  <option value="${attributeVal.value}">${attributeVal.value}</option>
     </c:forEach>
</select>
</p>
</c:if>
</c:forEach>

Please ensure proper values are being passed (based on the JSP in which the above snippet is being introduced ) for the input parameters highlighted in red.

An another useful Infocenter link which may help us accomplish this is provided below. I havent tried it myself but providing it for reference.


Tuesday, October 22, 2013

Websphere Commerce Data Cache

  • The WebSphere Commerce data cache can be configured to use DistributedMap object caches, by defining specially named.object caches in the cacheinstances.properties file.
  •  Object caching in specified DistributedMap instances causes each type of data to be cached in its corresponding DistributedMap object.
  • Takes precedence over the dynamic caching configuration specified in cachespec.xml - the configurations are no longer read from the cachespec.xml for the objects cached using the object caches - hence priority, timeout, or inactivity settings cannot be fine-tuned using cachespec.xml and need to be defined using various DistributedMap attributes in the cacheinstances.properties file.
  • Can be configured in two ways :
    • Define DistributedMap objects with the default JNDI names in the cacheinstances.properties file
    • Use the WebSphere Application Server Integrated Solutions Console. From the left menu, click Resources > Cache instances > Object cache instance
  •  The DistributedMap cache objects cannot be viewed in Dynamic Cache Monitor which comes packaged with WAS. The Extended Dynamic Cache Monitor need to be installed. The steps and download can be found in the here

Related Reading:
 IBM WCS 7.0 Infocenter

Thursday, July 25, 2013

Spell Checker in Management Center

You can customize the Spell check feature within the Management Center by adding in new words to the dictionary. Please note that with WCS - new dictionary cannot be created though.

To add words to the Management Center spell check dictionary, create <word> elements as children of the root <dictionary>  element of the file     LOBTools > WebContent > WEB-INF > dictionaries >addenda.xml using the below guidelines and restart the server.
      
SAMPLE:
        <word>sampleword1</word>
        <word>sampleword2</word>
        <word locale="de-DE" >sampleword3</word>
        <word locale="en-US" >sampleword4</word>
        <word locale="en-US,fr-FR" >sampleword5</word>
        <word locale="en-US,fr-FR,it-IT,">sampleword6</word>

Specify a comma separated list of locales in the locale attribute to indicate the languages for which each word is available.

If the locale attribute is not specified, the word will be available for all languages.

The following locales can be specified:
                  
  Language - Country/Region       Locale code
        Afrikaans - South Africa        af-ZA
        Arabic                          ar-XX
        Catalan                         ca-CT
        Czech - Czech Republic          cs-CZ
        Danish - Denmark                da-DK
        German - Switzerland            de-CH
        German (Germany)                de-DE
        Greek - Greece                  el-GR
        English - Australia             en-AU
        English - United Kingdom        en-GB
        English (US)                    en-US
        Spanish (Spain)                 es-ES
        French - Canada                 fr-CA
        French (France)                 fr-FR
        Italian (Italy)                 it-IT
        Norwegian (Bokmal) - Norway     nb-NO
        Dutch - The Netherlands         nl-NL
        Norwegian (Nynorsk) - Norway    nn-NO
        Polish (Poland)                 pl-PL
        Portuguese (Brazil)             pt-BR
        Portuguese - Portugal           pt-PT
        Russian (Russia)                ru-RU
        Swedish - Sweden                sv-SE

Friday, June 7, 2013

Websphere Commerce FEP6 Highlights

1. Search Enhancements : Enhancements to the Search Rules to improve search – enabling to promote , demote or exclude the products from search results based on product attributes and dynamic content such as inventory.

2. Improved Navigation and product Recommendations using Dynamic Merchandising

3. Improved Content Management through Management Centre: 
  • Simplified marketing asset , promotion and attribute management
  • Business control over labels for eMarketing Spots without IT involvement
  • Enable the business user to define image map content by specifying coordinates and links without the need for IT involvement.
  • Enhancements to the Store Update and Preview – In-context previews , “click-to-edit” capabilities , Preview link generation and shares
4. Data load enhancements – Support for XML file uploads and support for delta uploads

5. Mobile enhancements ( using IBM Worklight ) – Integration with IBM Worklight and hybrid Android reference application built on the IBM Worklight platform provided OOB. Worklight software licenses need to be acquired separately

6. Tealeaf Integration- The Aurora starter store checkout flow is pre-configured for Tealeaf Customer Experience in Feature Pack 6.0. Tealeaf software needs to be acquired separately.

7. Advanced catalog integration - extensive work flow support to foster collaboration in the creation and maintenance of product information, and with advanced access control (sub-trees and field-level), can help ensure trusted data quality of product information.Enabled by IBM InfoSphere® Master Data Management Collaborative Edition V10.1, which is licensed seperately.

WebSphere Commerce Search Cookbook


The IBM Support blog, called the 'Commerce Search Cookbook' covers common customizations requested by customers.

https://www.ibm.com/developerworks/community/blogs/CommerceSearch/?lang=en


This is a great reference  point for SOLR issues and solutions - so sharing with the readers.

Happy Exploring!

Monday, June 3, 2013

Tutorial : E-mail Templates & Custom Placeholders

E-mail templates define the structure and content of marketing e-mails that you send to customers using an e-mail or dialog activity. 
E-mail templates can contain placeholders for content, such as e-Marketing Spots, links, unique promotion codes, and the customer's first and last name. When it is time to deliver the e-mail, the server replaces the placeholders with actual content.

To know more about how to work with e-mail templates , visit the Infocenter link

While using the email templates , we may be faced with providing custom placeholders , as per the client requirements.

Below are the steps to do so. For demonstration purposes , we would be introducing the customer's phone number as a custom placeholder attribute.

1. Customize the Management Center Open-laszlo files to include the new custom tag for your new custom attribute.

 File
/LOBTools/WebContent/WEB-INF/src/lzx/commerce/marketing/restricted/widgets/EmailTemplateRichTextEditor.lzx

Step 1: Modify the  open lazlo file to introduce "Customer Phone Number" in the selection dropdown.

1. Locate the text "<mktTextlistitem value="lastName" displayName="${mktMarketingResources['lastName'].string}"/>"

2. Add the below text in the next line
<mktTextlistitem value="phoneNumber" displayName="Customer Phone Number"/>

The completed code will look as follows :


Step 2: Modify the  on-click handler to insert the custom tag <e-mail:PhoneNumber /> in the editor when the user selects "Customer Phone Number" and clicks on "Insert"


1. Locate the text "<handler name="onclick">"

2. Add the below text in the function implementation
  else if(selected == "phoneNumber") {
     classroot.insertTextAtSelection("<e-mail:PhoneNumber />");
   }


The completed code will look as follows :


Step 3: Build the Open Lazlo project - LOBTools
Right Click "LOBTools" project and click on "Build OpenLaszlo Project" as show in the figure below. Restart server.
.

This concludes the Management Center customizations.

  



2. Introduce a Tag implementation class

1. Create a tag implementation class which would contain the logic to replace the placeholder tag <e-mail:PhoneNumber /> with actual content.

This class should implement the "com.ibm.commerce.emarketing.emailtemplate.tag.Tag" interface. Follow the link to understand the interface methods which need to be implemented.

For the pupose of this tutorial , let the fully qualified name of this class be :

'com.wcshub.commerce.emarketing.emailtemplate.tag.TagPhoneNumber

2. Make an database entry in the table TAGCLASS.
To more about this table , follow the Infocenter link.  The sample query is provided below:

 insert into tagclass values ('PhoneNumber',  'com.wcshub.commerce.emarketing.emailtemplate.tag.TagPhoneNumber' ,  'Implementation class for Phone Number Tag' , NULL  );

The tutorial is now complete. Test the customizations.

I hope you found this topic interesting and informative - Please leave your feedback comments. 

Sunday, January 27, 2013

Business Object Document : Websphere Commerce Web Services

The WebSphere Commerce BOD command framework architecture uses well defined interfaces to decouple the implementation of the presentation layer, business logic layer and persistence layer. From the business logic layer perspective, OAGIS messages are used as the interface for making requests to retrieve business data or invoke business logic. The BOD command framework provides the capability to process these BOD requests and responses.

Found this really nice pictorial description of the various assets and processes involved in the BOD development in the  IBM Red Book (sg247619)

More to come to BOD Command Framework... 

On reader's requests -

See Also:

 

Monday, January 21, 2013

Service Oriented Integration (SOI) - Websphere Commerce Web Services

As part of the WebSphere Commerce transition to SOA, there is an effort to decouple components to allow re-use of WebSphere Commerce business services in other environments besides the WebSphere Commerce application. In order to support this decoupling, the core infrastructure is the first piece that needs to run independently so it can be leveraged in other environments as well. The request handling has changed to create a lightweight runtime environment that new and existing components can use. This lightweight runtime focuses on the processing of business object documents (BODs). This new architecture paves the road to SOA adoption by standardizing on how clients will talk with SOA components.
WebSphere Commerce now provides 4 SOI service modules -- logical groupings of business objects that have been grouped to standardize communication. These service modules are:
  • Member
  • Order
  • Catalog
  • Contract
The SOI modules ultimately maps to the ControllerCommand. And you would often extend the OOB commands for your custom logic - use EJBs for persistance much as the way as you did in WCS 6.0
( I can see a lot of v6 developers expressing a huge sigh of relief ). Most of the time what the developers struggle is how to map a service to a command name. I have put together a small diagram showing the complete flow - Taking a very common scenario - extending the Registration process to store custom membership attributes.

I hope you find it easy to understand and helpful!

 

The sad part is that we may not be able to really see the "actionCode" being used in the method ( registerPerson in this example ) since we do not have the access to the source code ( I narrowed down the command by my past experience in v6 ) - but what IBM is done is help the developer community at large is provide the methodName to CommandName mappings directly in the following link:

http://pic.dhe.ibm.com/infocenter/wchelp/v6r0m0/index.jsp?topic=%2Fcom.ibm.commerce.component-services.doc%2Fconcepts%2Fcwvcs.htm

The following is a mapping for the MemberFacadeClient methods and the corresponding URL commands:
  • Map registerPerson(Map) - UserRegistrationAdd
  • Map updatePerson(Map) - UserRegistrationUpdate
  • Map addAddressForPerson(Map) - AddressAdd
  • Map updateAddressForPerson(Map) - AddressUpdate
  • Map deleteAddressForPerson(Map) - AddressDelete
  • Map registerOrganization(Map) - OrgEntityAdd
  • Map updateOrganization(Map) - OrgEntityUpdate
  • Map addAddressForOrganization(Map) - AddressAdd
  • Map updateAddressForOrganization(Map) - AddressUpdate
  • Map deleteAddressForOrganization(Map) - AddressDelete

If you really want to appreciate the actionCode concept , refer the below method used in the SOITutorialStoreFacadeClient.java 

( Find the details of the above in the Infocenter TutorialStore )

So, though you may not need to follow the entire web of configurations but I feel this is worth knowing.

Happy learning!


Wednesday, November 21, 2012

WC Search Customizations - Introducing new facets

Faceted search is the dynamic clustering of items or search results into categories that let users drill into search results (or even skip searching entirely) by any value in any field. Each facet displayed also shows the number of hits within the search that match that category. Users can then “drill down” by applying specific contstraints to the search results. Faceted search is also called faceted browsing, faceted navigation, guided navigation and sometimes parametric search.



One of the common customization scenario is to introduce custom attributes as facets. The following should guide a developer through the process:

Important SOLR Configuration Files

Location : <WCDE>\search\solr\home\MC_<master_catalog_id>\en_US\CatalogEntry\conf

1. schema.xml
Introduce a child element "field" for the element "fields" for CATENTRY.FIELD1.

Place it at the end of the attributes under "Catentry's basic attributes" for logical grouping

<fields>
 <!--
   Catentry's basic attributes: map to table CATENTRY
   -->
<field name="catentry_id" type="long" indexed="true" stored="true" required="true" multiValued="false"/>
.
.
<field name="catenttype_id_ntk_cs" type="wc_keywordText" indexed="true" stored="true"  multiValued="false"/> 
 <field name="field1" type="long" indexed="true" stored="true" multiValued="false"/>

where ,
indexed: true if this field should be indexed (searchable or sortable)
stored: true if this field should be retrievable

multiValued: true if this field may contain multiple values per document

2. wc-data-config.xml
We will update the queries that are used to populate the Solr index from the WebSphere Commerce database tables. Each query needs to retrieve the data stored in field1 of the CATENTRY table.The wc-data-config.xml file loads catalog entry data in three separate parts. Product data is loaded first. This is followed by bundle data and finally all other catalog entry types. For each of the three sections there is a query for populating the full index and another query for delta updates. For each section (product, bundle and other), we need to update the two queries and then add a new field element to assign the data from the WebSphere Commerce database to the field1 field in the Solr index. All together there are nine updates you need to make to this file.

The modified file can be downloaded from here. Search "FIELD1" in the downloaded file to know the modifications required.


Important Database Tables
SRCHATTR

SQL updates required

insert into srchattr (srchattr_id, indexscope, indextype, identifier) values ((select max(srchattr_id)+1 from srchattr ) , '0', 'CatalogEntry','_cat.Field1');

insert into srchattrprop (srchattr_id, propertyname, propertyvalue)
values ((select max(srchattr_id) from srchattr ),'facet','field1');

Here , propertyvalue ' field1' is the name specified in the schema.xml

Also, srchattr_id should match in both the above queries

Code File Changes



1. SearchFacetsDisplay.jspf
Location : /Stores/WebContent/Madisons/Snippets/ReusableObjects/
This JSP fragment loops through the available global facets and includes another JSP fragment to display each facet’s data.We will introduce code to display the facet data for field1 in the left sidebar.

Search for the below <c:otherwise> tag and introdule the below code before the tag:

<c:when test="${facetField.value eq 'field1'}">
         <%@ include file="../../Snippets/Search/Field1FacetDisplay.jspf" %>
         <c:set var="f" value="${f + 1}" />                   
</c:when>

We will create  "Field1FacetDisplay.jspf" in the next step.

2. Field1FacetDisplay.jspf
Download the file from here and place it in the location "/Stores/WebContent/Madisons/Snippets/Search/".

Republish and Test!

Demo Video
Coming shortly

Saturday, September 22, 2012

Aurora - Watch out Madison! ;)

Aurora - is the new starter store launched with WCS 7 FEP 5 - it has really sleek and neat look.
Though it looks like it is still in the nascent state and does not support all the features which are available in the Madisons store - but I am sure we will see her growing fast.

Looks like Madisons has a competition in the B2C space. ;)

To read more about Aurora , refer the below link :
Aurora Starter Store

Catch the below video to know more about Aurora :





References :
Bob Balfe - blog.balfes.net

RESOLVED : DB2 9.7 setdbtype createdb issues



Issues Faced during the database creation while executing the setdbtype.bat

When we checked the “reorgdb2.err.log”, we found the few of the packaged failed during the reorg operations and we can find errors similar to below in the log file:

SQL0551N: The user “XXXXXX” does not sufficient priviliges to rebind the package 'SYSIBMADM.P201372405' of database 'WCS7DB'. UniqueId=213123…..

Problem (Abstract)
In DB2 Version 9.7, a user who holds SYSADM authority no longer has implicit DBADM authority and therefore has limited capabilities compared to those available in Version 9.5.  

Symptom
Example authorization errors are SQL1092N, SQL0551N and SQL0552N:
SQL1092N
authorization-ID does not have the authority to perform the requested command or operation.

SQL0551N
authorization-ID does not have the required authorization or privilege to perform operation operation on object object-name.

SQL0552N
authorization-ID does not have the privilege to perform operation operation.
 
Cause
Prior to DB2 Version 9.7 a user with SYSADM authority had implicit DBADM authority. Common configurations have the instance owner account as a member of the SYSADM group. Applications that are run under the instance owner account had unlimited authority on the database.
In DB2 V9.7 a user with SYSADM authority no longer has implicit DBADM authority. As a result any applications that are run under the instance owner account might experience authorization errors when trying to perform operations that are no longer within the scope of a SYSADM.
 
Environment
The UPGRADE DATABASE command and the RESTORE DATABASE command (for a downlevel database) grant DBADM authority to the SYSADM group, however this is not the case for any new V9.7 database.


Resolving the problem
The resolution to the errors is to verify the authorities for the userid.
To get the list of authorities held by the instance owner authorization ID perform these steps:

1.       Use the SYSPROC.AUTH_GET_INSTANCE_AUTHID() scalar function to determine the instance owner authorization ID.
For example:

VALUES SYSPROC.AUTH_GET_INSTANCE_AUTHID()

1
-----------------------------------------------------------------
XXXXXX

1 record(s) selected.

2.       Get the list of authorities for this authorization ID.
For example:
SELECT * FROM
TABLE (SYSPROC.AUTH_LIST_AUTHORITIES_FOR_AUTHID (XXXXXX, 'U'))AS T
ORDER BY AUTHORITY

3.       Grant any missing authorities.
For example:
GRANT DBADM ON DATABASE TO USER XXXXXX
Connect to database using db2admin/password and then execute the above grant query.

4.       Execute a reorg for the entire database.
1.       Run the db2cmd
2.       Navigate to the WCInstall_Dir\bin
3.       Execute the following command
reorg.db2.bat databasename username password schemaname
Example:
reorg.db2.bat WCS7DB xxxxxx passw0rd XXXXXX
4.       Monitor the “reorgdb2.err.log” to ensure there are no errors.

Reference Link:
http://www-01.ibm.com/support/docview.wss?uid=swg21385801