Tuesday, January 25, 2011

Policy For Stacking Shipping promotions

If you have a client that requires multiple shipping promotions to be applied on an order.
By default there can only be 1 shipping promotion applied on any order.

1). update px_policy set status = 1 where name in ('Shipping: Any order item can only participate in one promotion') and store_id = STORE_ID
2). Get the xmlparam data for this policy: select xmlparam from px_policy where name in ('Shipping: Any order item can only participate in one promotion') and store_id = STORE_ID
3). Update the xmlparam
<PromotionPolicy impl="com.ibm.commerce.marketing.promotion.policy
<PromotionPolicy impl="com.ibm.commerce.marketing.promotion.policy.

4). restart the server

Internal Server Error during Order Process

Internal Server Error or HTTP error 500. Any time you see this error, it generally means web server is not able to fulfill the request.
Scenario: The B2B system that I was working on talks to SAP for order fullfillment and placement. clicking order review, it was throwing exception during invocation of method "flush" on bean "BeanId(WC_LIVE#Enablement-BaseComponentsData.jar#ServerJDBCHelper, null)". Exception data: javax.ejb.EJBException: nested exception is: javax.ejb.EJBException: executeUpdate returned zero rows updated.

All the energies were spent from checking DB locks to implementation of optimistic locking to double click handler on client/server but finally figured out the problem was if the response was not within 40 sec(ServerOTimeout="40") webserver was marking appserver down and it was throwing internal server error.
we Increased the serverIPTimeout to 300 seconds in plugin-cfg.xml
Before: LoadBalanceWeight="20", ServerIOTimeout="40"
After: LoadBalanceWeight="2", ServerIOTimeout="300

Monday, January 24, 2011

How to make application server pickup content from WebServer

Web server Plug-in is smart to route, if a request is to be sent to Application Server or Web Server.

In order for web server to serve the static content for the stores module,
the conf folder of the web server has the configuration file e.g. httpd.conf or httpd-live.conf
All the relevant virtual hosts need to be updated with an alias e.g. /www/public/static can be any path on the web server file system.

Alias /wcsstore "/www/public/static"

Best practice for static content path:
These paths would get resolved to the following physical locations.

It is a good practice to have a folder hierarchy properties such as store name, locale and would greatly help when there are multiple stores and/or languages.

Sunday, January 23, 2011

Dynamic contact pricing for guest shoppers

There are 3 kinds of users in commerce from front end when accessing the site.
1. Guest : Guest user does not have password but has unique id
2. Generic : Generic user id is used -1002 most of the times.
3. Registered. : A guest user is converted into a registered user.

IBM web sphere commerce has a very powerful contract model and I have worked on B2B and B2C projects, where we have used contract model to define price and product filters.
For the B2C model for EPP and EDU, we use the contract price.

FOR EPP/EDU for users
Once a contract is successfully created and a contract can be assigned to a group of users using MBRGRPMBR
PARTICIPNT is used to associate a MBRGRP to a contract.


For EPP: Usually the guest users are not allowed to see the pricing and requires logging in.
for EDU: To allow guest users to see contract pricing, One approach that we used was to add the guest users to add to PARTICIPNT table.

These are the most important contract tables from the data model.

Important queries:

select c.name, a.productset_id, adjustment, xmldefinition from atcmr.psetadjmnt a, termcond b, contract c, d
where a.termcond_id = b.termcond_id and c.name = 'CONTRACTNAME' and b.trading_id = c.contract_id and c.state = 3 and adjustment = -5
and d.productset_id = a.productset_id