This tag is included in your shopping cart to track customers coming on the cart page. The function to be used is cmCreateShopAction5Tag. This tag will be looped for as many numbers of items in the cart. The following are the parameters to be passed to this tag
productId – This is the productId (either the SKU ID or the catentry ID). Please ensure that the productID should be the same as selected in cmCreateProductViewTag(), otherwise the metrics will be skewed.
Name - this is the name of the product. Again ensure that the name here matches with the one in the cmCreateProductViewTag().
Quantity – specifies the number of item ordered
Price – this is the unit price of the specified item.
Currency – self explanatory.
Category – This is the category Id to which the product belongs to. In some cases where other systems are used for navigation, like endeca, the category id on product detail may not match the wcs category id. In such cases, setting the category id to null will inherit the category from the previous product view tag.
Thursday, February 10, 2011
Monday, February 7, 2011
Coremetrics tags in Websphere Commerce
What you need (For all coremetrics tags) :
1. Coremetrics Client Id – This is the unique id assigned to your company
2. Coremetrics data collection domain – Domains are defined for data collection. For example testdata.coremetrics.com is for collecting test data. Please ask coremetrics about your data domain.
3. Coremetrics Domain – This usually is your Company’s domain name like XXXXXX.com
Creating a coremetrics pageView tag in websphere commerce
The javascript function is cmCreatePageviewTag()
The parameters to be passed to this tag are
1. Pagename: Specify the page name. Uses html page title automatically if not provided. This is optional
2. Category: specifies the category of the page. If not provided then nothing is sent to coremetrics.
3. searchTerms: if it is a search results page, then specifies the search terms. Required parameter for a search results page
4. searchCount: specifies the total number of results returned by the search
5. StoreId: is the wcs store Id. If not specified then it looks for storeId parameter in the URL
Eg:
Include couple of java scripts at the end of the page where pagview tag is to be placed
<script language="JavaScript1.1" type="text/JavaScript" src="//libs.coremetrics.com/eluminate.js"></script>
<script language="JavaScript1.1" type="text/JavaScript" src="/wcsstore/coremetrics/cmcustom.js"></script>
Set the coremetrics required parameters like client id, domain etc.
<script language="JavaScript1.1" type="text/JavaScript">
<!--
cmSetClientID("<%=MyConfig.getConfigValue(COREMETRICS_CLIENTID)%>", "<%=MyConfig.getConfigValue(COREMETRICS_DATA_COLLECTION_DOMAIN)%>", "<%=MyConfig.getConfigValue(COREMETRICS_DOMAIN)%>");
//-->
</script>
<script language="JavaScript1.1" type="text/JavaScript">
<!--
cmCreatePageviewTag("Page Name", null, null, null, "${WCParam.storeId}");
//-->
</script>
Where “Page Name” is the name of the page and if left blank will be populated with HTML page title. Store ID can be fetched from the WCParam parameter.
Creating a coremetrics productView tag in websphere commerce
This tag is included on the product detail page to capture product views in the coremetrics reports
The function used is cmCreateProductviewTag(). This tag is included on the product detail page to capture product views in the coremetrics reports
Parameters that needs to be passed to this tag are:
ProductId: Include either the catentry_Id here or the partnumber (SKU Id) as per the requirements. It generally is partnumber. This is a mandatory field
Name: include the product name. This is a mandatory field
categoryId: include the category Id to which this product belongs to. If you are using endeca for navigation, the category id of endeca might not match with what is in WCS. Hence, you need to include the correct categoryId here depending on what you have in your Coremetrics Data File (CDF) that was supplied to coremetrics initially. The CDF file contains the list of category mappings (hierarchy).
storied – this is the store id of wcs. Use WCParam to get the store Id
More on cart view tags (cmCreateShopAction5) in next blog
1. Coremetrics Client Id – This is the unique id assigned to your company
2. Coremetrics data collection domain – Domains are defined for data collection. For example testdata.coremetrics.com is for collecting test data. Please ask coremetrics about your data domain.
3. Coremetrics Domain – This usually is your Company’s domain name like XXXXXX.com
Creating a coremetrics pageView tag in websphere commerce
The javascript function is cmCreatePageviewTag()
The parameters to be passed to this tag are
1. Pagename: Specify the page name. Uses html page title automatically if not provided. This is optional
2. Category: specifies the category of the page. If not provided then nothing is sent to coremetrics.
3. searchTerms: if it is a search results page, then specifies the search terms. Required parameter for a search results page
4. searchCount: specifies the total number of results returned by the search
5. StoreId: is the wcs store Id. If not specified then it looks for storeId parameter in the URL
Eg:
Include couple of java scripts at the end of the page where pagview tag is to be placed
<script language="JavaScript1.1" type="text/JavaScript" src="//libs.coremetrics.com/eluminate.js"></script>
<script language="JavaScript1.1" type="text/JavaScript" src="/wcsstore/coremetrics/cmcustom.js"></script>
Set the coremetrics required parameters like client id, domain etc.
<script language="JavaScript1.1" type="text/JavaScript">
<!--
cmSetClientID("<%=MyConfig.getConfigValue(COREMETRICS_CLIENTID)%>", "<%=MyConfig.getConfigValue(COREMETRICS_DATA_COLLECTION_DOMAIN)%>", "<%=MyConfig.getConfigValue(COREMETRICS_DOMAIN)%>");
//-->
</script>
<script language="JavaScript1.1" type="text/JavaScript">
<!--
cmCreatePageviewTag("Page Name", null, null, null, "${WCParam.storeId}");
//-->
</script>
Where “Page Name” is the name of the page and if left blank will be populated with HTML page title. Store ID can be fetched from the WCParam parameter.
Creating a coremetrics productView tag in websphere commerce
This tag is included on the product detail page to capture product views in the coremetrics reports
The function used is cmCreateProductviewTag(). This tag is included on the product detail page to capture product views in the coremetrics reports
Parameters that needs to be passed to this tag are:
ProductId: Include either the catentry_Id here or the partnumber (SKU Id) as per the requirements. It generally is partnumber. This is a mandatory field
Name: include the product name. This is a mandatory field
categoryId: include the category Id to which this product belongs to. If you are using endeca for navigation, the category id of endeca might not match with what is in WCS. Hence, you need to include the correct categoryId here depending on what you have in your Coremetrics Data File (CDF) that was supplied to coremetrics initially. The CDF file contains the list of category mappings (hierarchy).
storied – this is the store id of wcs. Use WCParam to get the store Id
More on cart view tags (cmCreateShopAction5) in next blog
Wednesday, February 2, 2011
Creating your own Registry
Create a custom registry to manage the custom configuration properties file in websphere commerce.
Create a custom class called ApplicationRegistry. This class will be responsible for loading and refreshing your custom configuration property file. This class will implement com.ibm.commerce.registry.Registry interface.
public class ApplicationRegistry implements Registry {
/**
* Name of the applicattion configuration file
*/
public final static String PROPERTIES_FILE = "xxx_configuration.properties";
/**
* Name of the Registry used for custom application configuration
*/
public final static String REGISTRY_NAME = "ApplicationRegistry";
Implement Initialize () method of Registry interface and register this custom registry with wcs app as shown below.
/**
* @see com.ibm.commerce.registry.Registry#initialize()
*/
public void initialize() throws Exception {
final String METHOD = "initialize";
Properties prop = new Properties();
try {
prop.load(getInputStream(filename));
} catch (Exception e) {
throw new ECSystemException(ECMessage._ERR_GENERIC,CLASSNAME,e.getMessage());
}//end try
WcsApp.registerObject(REGISTRY_NAME, this);
}
In the initialize method, read the file and populate it to a Properties Object. Also, register this registry with the websphere commerce application using WcsApp.registerObject(“Registry_Name”, this)
Implement the refresh method of the Registry interface. This method should take care of the refresh registry command issued from Websphere Administration Console.
public void refresh() throws Exception {
final String METHOD = "refresh";
ECTrace.entry(ECTraceIdentifiers.COMPONENT_EXTERN, CLASSNAME, METHOD);
readConfiguration();
// intializeProfileProperties();
// initializeRegionCodes();
observable.refresh(this);
ECTrace.exit(ECTraceIdentifiers.COMPONENT_EXTERN, CLASSNAME, METHOD);
}
private class RegObservable extends Observable{
public void refresh(Object object){
setChanged(); //properties changed
notifyObservers(object); //notify observers
}
};
private RegObservable observable = new RegObservable ();
The refresh method uses the observer pattern. In the above code, there is a class RegObservable which extends Observable and implements refresh method.
Once your own ApplicationRegistry is created, you need to register the registry in wc-server.xml.
Once your own ApplicationRegistry is created, you need to register the registry in wc-server.xml.
<Registries>
......
......
.....
<registry
name="ApplicationRegistry" regClassName="com.tgg.commerce.registry.ApplicationRegistry"/>
</Registries>
Thursday, January 20, 2011
Order Payments Process
While integrating with PaymentExpress by way of Hosted payment page, there was a little issue. Once the customer reviews the order items in the shopping cart page and then proceeds for payment, the page is redirected to PaymentExpress payment capture page as shown below.
Once the payment details are entered, the customers then click “Submit”. This takes the customer to the payment approved page on the paymentexpress
On the payment complete page as shown above, it is strange that customers have to click “Next” to come back to the shopping site to get an order confirmation. There should have been automatic redirection of the page to the shopping site. Due to this, some of the customers do not click “Next” thinking that their payment is approved and the order is complete. Not clicking “Next” keeps the order in Websphere commerce in a “Pending” status. Talked to PaymentExpress and they are not able to do an automatic redirection back to the shopping site (not sure why).
Order and Payment Subsystem Overview
Once items are added to cart, an order is created in the ORDERS table with status as pending “P”. Items in the shopping cart are added to ORDERITEMS table which has an ORDER_ID reference to the ORDERS table. Correspondingly, a payment order record is created in the EDPORDER table. Once the customer selects payment method and proceeds for payment, for each payment method in the order, there is a payment instruction record created in the EDPPAYINST.
In the code, EDP Order data is retrieved using the EDPServices as shown below.
EDPOrderData edpOrderData = EDPServices.getServices().getOmfAccessor().getOMF().getEDPOrder(new Long(getOrderId()), Integer.valueOf(storeId));
Long edpOrderId = edpOrderData.getOrderKey();
We get the EDP order payment instructions through the following
SortedSet pis = EDPServices.getServices().getOmfAccessor().getOMF().getPis(edpOrderId);
Using the payment instruction returned, you can get the details like amount, payment method, etc.
Orders data can be accessed using the websphere commerce OrderAccessBean and order details using OrderItemAccessBean
Tuesday, January 11, 2011
Websphere Commerce Product Recommendations
I am trying to configure an activity to display products based on the selected categories. For example if there is an espot E1, then I need to create an activity which associates a category (C1) with this espot and displays random product from this category to the espot.
Any suggestions on how to achieve this ? I am using version 6.0 of websphere commerce where part of the functionality is in Accelerator and part in management centre. Its kind of wiered.
Well.. I found out that websphere commerce doesn't have the capability to recommend products on a merketing spot if I associate a category to an eSpot. This is a basic functionality which I thought should be out of the box. However, I have figured out a way to do it. Just display the categories in the ESpot and based on the category ID, write custom code in the JSP to fetch all the products from the category and display the espot as requried.
I also figured out that the web activity can be defined using both accelerator and management centre. When we define a webactivity in accelerator, the activity goes into INITIATIVE and INTVSCHD tables of WCS. On the other hand, when a web activity is configured using management centre, they are stored in DMACTIVITY table.
Well.. I found out that websphere commerce doesn't have the capability to recommend products on a merketing spot if I associate a category to an eSpot. This is a basic functionality which I thought should be out of the box. However, I have figured out a way to do it. Just display the categories in the ESpot and based on the category ID, write custom code in the JSP to fetch all the products from the category and display the espot as requried.
I also figured out that the web activity can be defined using both accelerator and management centre. When we define a webactivity in accelerator, the activity goes into INITIATIVE and INTVSCHD tables of WCS. On the other hand, when a web activity is configured using management centre, they are stored in DMACTIVITY table.
Subscribe to:
Posts (Atom)