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.

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

   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

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}" />                   

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

Friday, November 2, 2012

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.  

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

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

authorization-ID does not have the privilege to perform operation operation.
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.
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:



1 record(s) selected.

2.       Get the list of authorities for this authorization ID.
For example:

3.       Grant any missing authorities.
For example:
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
reorg.db2.bat WCS7DB xxxxxx passw0rd XXXXXX
4.       Monitor the “reorgdb2.err.log” to ensure there are no errors.

Reference Link:

Thursday, August 9, 2012

SQL1032N - Issues with DB2START - DB2 9.5 ESE & DB2 9.7 ESE

If db2start command fails giving the error code SQL1042C SQL1032N

SQL8000N DB2START processing failed; a valid product license was not found.
SQL1032N No start database manager command was issued. SQLSTATE=57019


These error typically indicate that the DB2 UDB product license has not been activated.


To activate the DB2 UDB product license, run this command:

db2licm -a license_filename

Where license_filename is the name of the license file.


The file db2ese.lic is the DB2 Enterprise Server Edition license file. The license file should be copied to a local directory (e.g. /tmp) and updated with the following command (resulting output shown):

=> db2licm -a /tmp/db2ese.lic
DBI1402I License added successfully.

DBI1426I This product is now licensed for use as specified in
the License Acceptance and License Information
documents pertaining to the licensed copy of this
DIRECTORY: /usr/opt/db2_08_01/license/en_US.iso88591

The license information can be queried with this command (resulting output shown):

=> db2licm -l
Product Name = "DB2 Enterprise Server Edition"
Product Password = "DB2ESE"
Version Information = "8.1"
Expiry Date = "Permanent"
Registered Connect User Policy = "Disabled"
Number Of Entitled Users = "5"
Enforcement Policy = "Soft Stop"
Number of processors = "1"
Number of licensed processors = "1"
Annotation = ""
Other information = ""

Management Center : Increasing the Promotion Code Upload Limit

By default, the maximum file size of your CSV file or .zip is 10 MB. You can change the maximum file size.

The maximum file size limit is defined in both the Open Lazlo client and Websphere Commerce instance file.

Below are the steps required to be performed to increase the promotion code upload limit :

1. Update the client
  1. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
  2. In the Enterprise Explorer view, expand LOBTools > WebContent > config> commerce> promotion> objectDefinitions
  3. Open the PromotionCodeImportPrimaryObjectDefinition.def file, and locate the defination name proBasePromotionCodeImportPrimaryObjectDefinition.
  4. Update the value of the maximumFileSize attribute. The default value is 10000000 bytes. You can change this value as needed, however, keep in mind the impact that larger files might have on your server.
    <PrimaryObjectDefinition copyProtected="true" creatable="true" definitionName="proBasePromotionCodeImportPrimaryObjectDefinition" displayName="${promotionResources.promotionCodeImportObjectName}" displayNameProperty="fileName" fileNamePropertyName="fileName" fileSizePropertyName="fileSize" headerIcon="promotionCodeImportHeaderIcon" helpLink="tasks/tprimportpromo.htm" icon="promotionCodeImportIcon" idProperty="promotionCodeImportId" isBaseDefinition="true" isFileObject="true" maximumFileSize="new_size" newDisplayName="${promotionResources.promotionCodeImport_newPromotionDisplayName}" newObjectMenuItemText="${promotionResources.contextMenuNewPromotionCodeImport}" objectGroups="PromotionCodeImportGroup" propertiesDefinitionName="proPromotionCodeImportProperties" searchType="FindPromotionCodeImports" writeUsage="IBM_ManagePromotionTool"> 

    where new_size is the size you want (in bytes).
  1. Update the server.
    1. Open the Updating the WebSphere Commerce configuration file, and locate the command element for com.ibm.commerce.promotion.commands.CreatePromotionCodeImportCmd name.
    2. Change the value of the maxuploadsize attribute to match the value specified for the client.
    3. Run the ANT target: UpdateEAR target to update the runtime configuration with the master configuration file.
After you complete your customization:
  1. Right-click LOBTools Project; then click Build OpenLaszlo Project to produce an updated ManagementCenter.swf file under the workspace_dir\LOBTools\WebContent directory. This setting is the default environment setting.
  2. Test your changes by viewing them in the Management Center, using this URL: https://hostname:8000/lobtools.
  3. Deploy your changes to your production environment.

Remote Widgets

Found this cool video which talks about Remote Widgets.. Hope this post also goes viral ! ;)

Tuesday, May 22, 2012

RESOLVED : An EJB JAR does not exist for the selected project and Map Validation cannot run


1. Incase if you ever see the below error in the "Problems" tab of the RAD -
    "An EJB JAR does not exist for the selected project and Map Validation cannot run"
2. The Deployment Descriptor file is not seen/found in the "WebsphereCommerceServerExtensionData" project
3. Clicking on the Map.mapxmi , the file does not open and an error is displayed "The ejb or database is nor defined in the ejb-jar.xml"


It is implicitly assumed in RAD 6 that the source folder which contains the deployment descriptor xml file (DD) should be the FIRST source folder of the project. Otherwise the DD cannot be found.

So, the solution for this problem is to put the folder that contains the deployment descriptor at the top of the Order and Export list in the Project Properties. Then the DD can be found.

So, move the folder "WebsphereCommerceServerExtensionData/ejbModule" to the top in the Order/Export list in the Project Properties.

Incase you do not find that folder in the list , use the following steps to create the new folder -

  1. Open RAD and create a new EJB project
  2. Right click on the Project in Project Explorer, and choose: Properties
  3. Select Java Build Path
  4. Go to the Source tab
  5. Click Add Folder...> Create New Folder...
  6. Go to Order and Export, move the new folder upwards so that it is found at the top of the list.
  7. Press OK to close the properties View
  8. Run Project > Clean (followed by Build Automatically)
  9. Check the Problems view; you will see the above errors


Friday, April 27, 2012

A file does not exist for module element having uri: Rest.war

When you start the WebSphere Commerce Test Server, you receive an error that states that a file does not exist.


When starting the WebSphere Test Server after enabling the Management Center feature, a file does not exist error is displayed in the startup logs. For example,
[11-3-1 15:02:39:484 CST] 00000009 ApplicationMg E   WSVR0100W: An error occurred 
initializing, WC
A file does not exist for module element having uri: Rest.war


To resolve this issue, you need to rebuild the LOBTools project and republish the test server, as follows:
  1. Open your WebSphere Commerce Developer workspace.
  2. Right-click the LOBTools project and rebuild it.
  3. If necessary, start the test server in the Servers view and ignore the error that states the file does not exist.
  4. After the test server starts, right-click the test server and click Publish. After publishing is complete, the error should no longer be displayed when you subsequently restart the test server.

Sunday, April 22, 2012

Know what features are enabled on WCS 7?

Query the database table SITE and you can find the list of features enabled in your WCS 7 application.
You can aslo find out the fix pack level.

You can find out the fix pack level and installed feature pack details using the versionInfo.bat

Day 7 : Generating Sitemaps to submit to search engine providers

A Sitemap is an xml list of all the pages in your store that is submitted to search engines so that they will know what to crawl and index. The Sitemap Generator has been enhanced in Feature Pack 3 to index the new friendly website addresses and search landing pages.

For more information on Sitemaps, see WebSphere Commerce integration with sitemaps.

With the WebSphere Commerce integration with sitemaps, you can create a sitemap XML file, sitemap_ storeID.xml, that contains a list of URLs for your site. This way, customers are able to easily find your site when they perform a search, promoting activity to your site, and increasing the probability of sales.
The sitemap_ storeID.xml file is placed in the following directory:
The OOB command SitemapGenerate can be scheduled at regular intervals to generate the SiteMap XML. Please refer the link Creating and scheduling the SitemapGenerate job for more details on the scheduling.

This concludes our week long SEO marathon. :)

Related Blogpost

Day 6 : Title and meta description (TMD) for SEO pages

Title and metadata information is valuable for allowing your store's pages to stand out on the internet. With the search engine optimization feature for WebSphere Commerce Version 7 Feature Pack 3, each web page in your store is provided with unique content to improve its ranking in search results.

The title and meta description data is comprised of:  
Page title
The page title appears in the customer's browser's title bar For example: Large Adjustable Desk Lamp | Madisons
Meta description
The meta description is used by search engines to provide a description of your site and the current web page's contents for a search results page. It is stored in the web pages HTML and is not viewable on the page itself.
Meta keyword
 The meta keyword is used for your store's static pages such as the contact us or help page for search engines to accurately rank and index the web page. It is stored in the web page's HTML and is not viewable on the page itself.
Image alt text
Image alt text describes the contents of an image for search engines to accurately rank and index the image. It is viewable by hovering over the image on the web page and can be used for text to speech systems for the visually impaired.

The TMD is defined as templates in the SEOPAGEDEF and SEOPAGEDEFDESC tables with the help of the SEO substitution parameters.
Other important tables wrt the TMD is SEOPAGEDEFOVR  and SEOPAGEDEFSUBPARAM.

Demo Video

In this demo video , we will learn how to define the TMD for the new static "Suggestions and Complaints" page which we have created in the Day 4 : Demo - Creating short SEO URLs for new static views.We will also understand the OOB tables.

Lets start the final legs of our marathon!

Demo Help Content

SQL Queries

insert into seopagedef (seopagedef_id, pagename, storeent_id, lastupdate, createdtime) values ((select max(seopagedef_id)+1 from seopagedef), 'SUGGESTIONS_PAGE', (select storeent_id from storeent where identifier = 'Madisons'), '2012-04-22 00:00:00.00', '2012-04-22 00:00:00.00');

update keys set counter = counter+1 where tablename like 'seopagedef';

insert into seopagedefdesc (seopagedef_id, language_id, title, meta_desc, meta_keyword, image_alt_desc, lastupdate, createdtime) values ((select max(seopagedef_id) from seopagedef), -1, 'Suggestion and Complaints at <seo: StoreName/>', 'Suggestion and Complaints at <seo: StoreName/>', 'Suggestion and Complaints <seo: StoreName/>', 'Image for Suggestion and Complaints at <seo: StoreName/>', '2012-04-22 00:00:00.00', '2012-04-22 00:00:00.00');

select * from seopagedef where storeent_id = (select storeent_id from storeent where identifier = 'Madisons');

select * from seopagedefdesc where SEOPAGEDEF_ID in (select SEOPAGEDEF_ID from seopagedef where storeent_id =  (select storeent_id from storeent where identifier = 'Madisons')) and language_id = -1;

select * from SEOPAGEDEFOVR;

JSP Changes
The SuggestionComplaints.jsp used can be downloaded from this link. Place it in the following directory - /Stores/WebContent/Madisons/StoreInfoArea/

Additional Read
Retrieving search engine optimization (SEO) substitution parameters for populating the Management Center UI

Related Blogpost
Smarter SEO for Smarter Commerce

Thursday, April 19, 2012

Paypal Integration with WCS 6.0

PayPal is one of the most well-known worldwide payment service providers. The flow for PayPal is different from traditional payment gateways, such as Visanet®. During shopping, an online store redirects the shopper to the PayPal web site to process the payment. PayPal Express Checkout is PayPal's premier checkout solution, which streamlines the checkout process for buyers and keeps them on the merchant's site after making a purchase.

The Express Checkout button gives buyers another way to pay, and it complements merchant’s existing payment solution. Online shoppers appreciate the convenience and security of PayPal, where they can pay with their PayPal balance, bank account, or credit card.

Key Features of Express Checkout

Express Checkout is a fast, easy way for buyers to pay with PayPal. Express Checkout eliminates one of the major causes of checkout abandonment by giving buyers all the transaction details at once, including order details, shipping options, insurance choices, and tax totals.
Studies show that adding the Express Checkout button to your website can increase your sales up to 18 percent.

For more details , refer PayPal Express Checkout Integration Guide

PayPal Plug-in for Websphere Commerce

IBM WebSphere Version 6.0 Plugin
The plug-in supports Express Checkout web flows and APIs. The plug-in has been developed by PayPal in collaboration with IBM's Commerce architects using WebSphere Commerce's payment plug-in API.

It supports:
  • SALE, AUTH, and ORDER transaction types
  • Multiple auth and captures - useful for orders that have multiple shipping addresses or associated back orders
  • Refund transactions
  •  All PayPal supported currencies.
The plug-in can be downloaded from the PayPal Integration Center using the link 

The integration steps can be found inside the downloadable itself.

PayPal Checkout Flow

Typical order flow for WebSphere Commerce

As shown in figure below, a typical order flow for a shopper is:
1. Checks out from the shopping cart page.
2. Provides shipping and billing address information
3. Chooses the Shipping Method
4. Reviews the order, chooses the payment method and pays for it.
5. Receives an order confirmation.

PayPal order flow with WebSphere Commerce

In an Express Checkout flow, a buyer still checks out at the beginning of the flow. However, after the buyer chooses the PayPal payment method, the buyer is re-directed to the PayPal web site for authentication. After that, the buyer is re-directed back to the WebSphere Commerce store to finish the left order flows.

In the Express Checkout flow, the shopper:
1. Checks out from the shopping cart page.
2. Provides shipping and billing address information
3. Chooses the Shipping Method
4. Reviews the order , chooses the PayPal as the payment method
5. Logs into PayPal to authenticate his or her identity.
6. Reviews the transaction on PayPal.
7. Confirms the order and pays from the site.

Figure below shows the Express Checkout flow:




Related Posts:
PayPal Integration with Websphere Commerce 7

Day 5 : 301 Redirections for Search Engine Optimization

301 URL redirection has been included as part of the SEO solution for WebSphere Commerce Feature Pack 3. If a URL is changed either by WebSphere Commerce or a business user, a redirect is automatically generated between the old and new URLs.
URL redirects have been implemented for the following cases:
  • When the URL of a catalog entry, catalog group or static page is updated, a redirect is automatically generated between the old and new URLs.
  • When an extended site specific URL for a catalog entry or catalog group is created, the asset store URL is duplicated to the extended site and then a redirect is created between the extended site duplicate of the asset store URL and the new URL
  • When an extended site specific URL is cleared for a catalog entry or catalog group, a redirect is created between the extended site URL and the asset store URL
In all of the above cases if the URL of a catalog entry or catalog group is updated multiple times then all previous redirects are updated to point to the latest URL for that catalog object. In this way redirection chains are avoided.

Demo Video

URL redirect traffic

Traffic statistics are recorded for individual redirect mappings. These statistics are held in the SEOREDIRECTTRAFFIC table.
This table holds:
  • The last used date of individual redirect mappings
  • The number of times that those redirect mappings are used
While there is no out-of-the-box user interface to view these statistics, these values are useful:
  • A custom user interface can be created in order to monitor when search engines, affiliate links, and customer's personal bookmarks are still referring to old URLs for your catalog entries or catalog groups
  • For determining when to delete old URLs from the database in order to improve system performance.

Performance Consideration

In order to help with performance, redirect traffic data is not sent to the database on each use of a redirect rule. Instead that data is stored in a cache, and is only flushed to the database once a certain number of redirect usages has occurred. This number is configurable by referring to the redirectHitCountBatchUpdateSize parameter in the SEORuntime section of the wc-admin-component.xml infrastructure configuration file.

Removing unused URLs 

When redirect mappings have not been used for some time it is safe to delete both the mapping and the original URL that is being redirected to decrease your database footprint. Unused redirected URLs are cleaned up automatically after 60 days by running a scheduler job. This number is the default out-of-the-box but is configurable by referring to the "numberOfDays" value in the SEORuntime section of the wc-admin-component.xml infrastructure configuration file.

Out of the box Scheduler : CleanSEOURLS

The CleanSEOURLS job command is used to clean up the tables related to search engine optimization (SEO) URL redirects and SEO URL keywords. An SEO URL redirect rule is deemed obsolete if the date the rule was last used by an incoming HTTP request has exceeded 60 days. This number is configurable by modifying the infrastructure component configuration file (wc-admin-component.xml). Once a redirect rule is deemed obsolete the original url keyword that was used in that rule is also deleted. These are the URL keywords that are marked as "inactive" when a redirect rule is created. 

This command will delete entries from the SEOREDIRECT, SEOREDIRECTTRAFFIC, SEOURLKEYWORD and SEOURL tables.

Related Blogpost
Smarter SEO for Smarter Commerce

Smarter Commerce - How it works?

A great video to watch and learn!

Monday, April 16, 2012

Day 4 : Demo - Creating short SEO URLs for new static views

Let us revisit and do some practical based on the concepts learned on Day 1 to Day 3.

In this demo tuturial , we will create a short SEO friendly URL for a custom view that we have created "SuggestionsComplaintsView" using the WCS 7 SEO Pattern mapping files in simple 3 steps.

We will change the long WCS URL
Short Search Engine optimized URL

Pack up your energy drinks and lets sprint into the SEO world. I hope you will find it in useful.

Demo Video:

Help Section:

The JSPs and XMLs used in this demo can be downloaded from this link.

Pattern Definition made in the SEOURLPatterns-ext.xml

SEO/URLPattern wc-seo-url-pattern.xsd">
        SuggestionComplaints URL like this:
http://localhost/webapp/wcs/stores/servlet/en/madisons/suggestion-complaints    -->
    <seourl:seoUrlPatternDef name="SuggestionComplaintsURL">
        <seourl:seoUrlPattern viewName="SuggestionsComplaintsView">/LanguageToken/StoreToken:CatalogToken/SuggestionComplaintsToken</seourl:seoUrlPattern>
            <seourl:mapping name="langId" value="?LanguageToken?" />
            <seourl:mapping name="storeId" value="?StoreToken?" />
            <seourl:mapping name="catalogId" value="?CatalogToken?" />
            <seourl:mapping name="LanguageToken" value="?langId?"
                defaultValue="-1" />
            <seourl:mapping name="StoreToken" value="?storeId?" />
            <seourl:mapping name="CatalogToken" value="?catalogId?" />
            <seourl:mapping name="SuggestionComplaintsToken" value="SuggestionComplaintsToken" />
        <seourl:usageDef CMCPrefix="true">
            <seourl:usage device="browser">

SQL Executed
insert into seotokenusgtype (tokenusgtype_id, tokenusgtype, primarytoken,storeent_id, isstatic) values ((select counter+1 from KEYS where tablename='seotokenusgtype') , 'SuggestionComplaints', 'SuggestionComplaintsToken',<store-id>, 1);
update KEYS set counter=counter+1 where tablename='seotokenusgtype';
insert into seourl (seourl_id, tokenname, tokenvalue) values ((select counter+1 from KEYS where tablename='seourl'), 'SuggestionComplaintsToken', 'SuggestionComplaintsToken');
insert into seourlkeyword (seourlkeyword_id, seourl_id, storeent_id,language_id, urlkeyword, status) values((select counter+1 from KEYS where tablename='seourlkeyword'), (select seourl_id from seourl where tokenname='SuggestionComplaintsToken'), <store-id>, -1, 'suggestion-complaints', 1);
update KEYS set counter=counter+1 where tablename='seourl';
update KEYS set counter=counter+1 where tablename='seourlkeyword';

Related Blogpost
Smarter SEO for Smarter Commerce

Sunday, April 15, 2012

Day 3 : Search engine optimization (SEO) URL pattern files

Pattern files are used in the construction and deconstruction of SEO friendly URLs. A pattern file contains a template or model for a URL type in a store, such as a category, contact us or product page as each page type requires different data to be constructed.

For for details , please refer the Infocenter link.

Pattern files are located in this path :

The below diagram summarizes all the important learnings and explains how the SEO URLs are created based on the pattern definitions in the SEOURLPatterns.xml.

Related Reading

Related Blogpost
Smarter SEO for Smarter Commerce

Day 2 : WebSphere Commerce search engine optimization (SEO) data model

Please refer the below Infocenter link to get your familiarized with the SEO data model :


The use of the tables will get more and more clear in the subsequent blog posts :)

Related Blogpost
Smarter SEO for Smarter Commerce

Day 1 : Introducing "wcf:url" tag

To avoid having to hard code SEO friendly URLs in the storefront pages, the WebSphere Commerce Search Engine Optimization feature provides a wcf:url tag that will construct SEO friendly URLs using the SEO pattern file(s) and tables.

The current wcf:url tag is used by all starter stores to construct SEO friendly URLs. The UrlTag class has been enhanced to support the use of the new URL pattern definition to create SEO friendly URLs.

Incase you open any JSP , for example CachedFooterDisplay.jsp, you will notice that our old friend <c:url> tag which was used to construct the URLs in WCS6 has been replaced by <wcf:url>. So, let us spend some time leaning about the tag. 

About the wcf:url tag
The wcf:url tag builds a URL and applies the appropriate WebSphere Commerce supported rewriting rules.
It contains the following additions compared to the c:url tag:
  • It builds a full path URL, rather than a relative path.
  • It builds SEO compliant URLs if the feature is used in WebSphere Commerce.
  • It adds a prefix to the URL with the appropriate protocol, HTTP or HTTPS, depending on the Struts configuration files.
To know more about the tag and its parameters , please refer Infocenter

Important Note for FEP3 and above

Both the new Feature Pack 3 and previous SEO implementations are supported. You can choose which SEO solution to use by updating wc-server.xml.

<SEOConfiguration enable="true" dynamicUrl="true" defaultUrl="www.madisons.com">
     <context-root-rewrite value="/shop"/>
     <mapper-class-name value="com.ibm.commerce.seo.url.helpers.SEOURLMapperImpl"/>
Either value or patternName is required. If workspace is used, then both value and patternName are required. If the value parameter is provided, then URLs will be constructed based on the mapping found in SEOUrlMapper.xml file using the SEO implementation from WebSphere Commerce Version 7 to Version 7 Feature Pack 2. If patternName is provided and SEO is enabled in wc-server.xml as shown in the following example, then URLs will be constructed based on the Version 7 Feature Pack 3 SEO design, using the pattern template definitions. Preference will be given to the patternName attribute over the value attribute.

If URL construction using patternName
fails (due to an invalid patternName or a missing parameter), dynamic
URL's will be constructed if the dynamicUrl attribute is set to true.
If dynamicUrl is set to false, then wcf:url tag returns defaultUrl
specified in wc-server.xml 
The URL creation order is:
  1. If SEO Enabled and patternName specified, use patternName and construct new SEO URL
    1. If new SEO URL construction fails and dynamicUrl = true, a dynamic URL is constructed
    2. If dynamicUrl = false, a defaultUrl is constructed
  2. Otherwise the value attribute is used an old SEO URL is constructed
The following diagram helps understand the SEO URL differences and the tag parameters :

The following example forms a URL to display the shopping cart using the <wcf:url> tag. It specifies the URL type as an AJAX call.
<wcf:url var="currentShoppingCartLink" value="ShopCartPageView" type="Ajax">
   <wcf:param name="storeId"   value="${WCParam.storeId}"  />
   <wcf:param name="catalogId" value="${WCParam.catalogId}"/>
   <wcf:param name="langId" value="${WCParam.langId}" />
Related Blogpost
Smarter SEO for Smarter Commerce