BlueMix URL Rating widget on WebSphere Commerce for product ratings

bluemix-ratings-wc

Ok, this is really just a teaser post as I will divulge the process used to get my Blue Mix URL rating widget into the WebSphere Commerce Composer framework a bit later.

I will say, now that the widget is in a real application I was able to test out some more use cases and fix a few bugs to make sure the widget is re-usable across a site. In this use case I am using it to rate products. I made a few changes to the NodeRED flow including adding more data saved for some future ideas I have. Here is the current block of data saved in the MongoDB for each rating received:

{
 "url": "http://mytestserver.com/webapp/wcs/stores/servlet/en/aurora1/electronics/tablets-10229--1/budget-tablet",
 "rating": 4,
 "host": "mytestserver.com",
 "cookie": "1406562990550",
 "date": "Wed, 30 Jul 2014 18:31:35 GMT",
 "_id": {
 "$oid": "53d93a07cb353621005aaadf"
 }
}

Notice I added “date“, “host” and “cookie” to the output. The date is actually filled in by the server for consistency and the cookie is a time stamp saved in the shopper browser for the page using HTML5 storage. I figure I will be able to use this data for reporting later and possibly as a WebSphere Commerce precision marketing action to get me a list of “top products” for a given domain.

The other change I had to make was to allow my service to respond with cross domain calls. I just put a little JavaScript between the post request and response nodes and added “Access-Control-Allow-Origin” to the call. I could probably isolate this to the specific domain eventually.

Cross Domain Setting

The next addition I made was if the browser already rated a product (cookie + URL) is already stored into the database send back a piece of data in the response of the “getRating” call to notify the browser to not let that person vote again. I really like how I can just connect nodes together conditionally and essentially introduce some complex decision making flows into the mix. Here you can see my decision “Check for cookie” and then ultimately append the flag in the “Check for already voted” function:

already voted logicHere is the Check for already voted function:

already voted code

BlueMixBeta

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s