Tuesday, November 4, 2014

Using Javascript for Eval | AjaxAddOrderItem | Adding multiple parts to Cart

I ran into this problem in the past and realized, it's hard to remember the eval function and without that you could end up spending a lot of time, trying to figure out passing multiple params with dynamic values. (partNumber_1, quanitty_1...partNumber_2, quantity_2).

eval() evaluates the expression in the argument. If the argument is one or more JavaScript statements, eval() executes the statements.
E.g. service code.

    var renderCtx = wc.render.getContextById("AjaxAddToCartContext");
     //setting context properties  
    renderCtx.properties['partNumber'] = partNumber;
    renderCtx.properties['quantity'] = quantity;

     eval("params.partNumber_" + counter + "='"+partNumber+ "';");
     eval("params.quantity_" + counter + "="+quantity+ ";");
    //invoke the AJAX service for orderitem add (Cart Service)
     wc.service.getServiceById("AjaxAddOrderItem").formId = orderFormId;
     wc.service.invoke("AjaxAddOrderItem", params);

Saturday, November 1, 2014

Setup instructions for outbound order XML | write to file on local toolkit


1) Setup the transport for order message in WC admin console as shown in the screenshots.
2) Place an order using front end flow pages.
3) In WC admin console, set up a broadcast job for the command "RaiseECEvent"
4) The file (filename: orderID) will be generated at the location ( C:\IBM\WCDE_ENT70\wasprofile\ordersxml) in your toolkit.





                                 

Friday, October 31, 2014

Configure commerce transport file/HTTP for to avoid writing order XML to file system.!!

Instructions to configure with HTTP transport instead of File are below. 
Please note you'll have to change the hostname for each environment in this end-point. 
If you'd rather just use the File transport, you could point the files to /dev/null (Unix Env) so the order data isn't written to a physical disk location. I am sure there is a way to do that in windows but you can also alternately use HTTP transport and do the steps below.


This screen in commerce administration console is used to select the out of the box out bound message (Message for external order system) . Click the check box and select change.



This is step is used to setup the transport for the message



On localhost:  http://localhost/webapp/wcs/stores/servlet/Services/OrderTransferResponse.jsp   
 and on Server environment
 http:///Services/OrderTransferResponse.jsp   





Friday, October 24, 2014

Solr debugging links and refefrences.

Find below some good SOLR debugging resources and link:

1.    http://explain.solr.pl/
-     This site allows you to copy and paste the SOLR debug xml and generate the explain report for you.

2.    http://www-01.ibm.com/support/docview.wss?uid=swg27024527&aid=1
-    From IBM, a presentation regarding how to some common SOLR issues, trace to turn on, what to look for in the log… etc

3.    http://wiki.apache.org/solr/SolrRelevancyCookbook#IntraWordDelimiters
-    From Solr Wiki, this chapter explains the WordDelimiterFilter that fix my issue.

4.    http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#WordDelimiterFilter
-    Again from Solr Wiki, this chapter gives the overview of Analyzers, Tokenizers and Token Filters.

5.    http://khaidoan.wikidot.com/solr
-    Khai’s personal wiki page with good SOLR material.

6.  http://www-01.ibm.com/support/docview.wss?uid=swg27038714
-  Debugging Solr Query IBM

Debugging JSON JSP as HTML Comment

If you want to display a JSON of the CatalogNavigationView to be displayed in the JSP to view the details of all the attributes if you are trying to verify something, try this inside HTML comment and add the corresponding object name. It works.

<!-- <wcf:json object="${catalogNavigationView.catalogEntryView[0]}" /> --> 

Wednesday, October 1, 2014

XARecoveryDat W WTRN0005W: The XAResource for a transaction participant could not be recreated and transaction recovery may not be able to complete

Stop server and delete the folder inside
C:\IBM\WCDE_ENT70\wasprofile\tranlog\localhost\localhost\server1\transaction


[4/29/14 22:49:44:191 MST] 00000007 XARecoveryDat A   WTRN0151I: Preparing to call xa recover on XAResource: cells/localhost/nodes/localhost/resources.xml#J2CResourceAdapter_1392244634236
[4/29/14 22:49:44:269 MST] 00000007 XARecoveryDat W   WTRN0005W: The XAResource for a transaction participant could not be recreated and transaction recovery may not be able to complete properly. The resource was com.ibm.ws.tx.jta.ASWrapper@321b321b. The exception stack trace follows: com.ibm.ws.Transaction.XAResourceNotAvailableException: java.lang.Exception: RA.getXAResources() returned wrong number of XAResources: 0
at com.ibm.ws.tx.jta.ASXAResourceFactoryImpl.getXAResource(ASXAResourceFactoryImpl.java:142)
at com.ibm.ws.Transaction.JTA.XARecoveryData.getXARminst(XARecoveryData.java:446)
at com.ibm.ws.Transaction.JTA.XARecoveryData.recover(XARecoveryData.java:573)
at com.ibm.tx.jta.PartnerLogTable.recover(PartnerLogTable.java:389)
at com.ibm.tx.jta.RecoveryManager.resync(RecoveryManager.java:1530)
at com.ibm.tx.jta.RecoveryManager.performResync(RecoveryManager.java:2265)
at com.ibm.ws.tx.jta.RecoveryManager.performResync(RecoveryManager.java:114)
at com.ibm.tx.jta.RecoveryManager.run(RecoveryManager.java:2218)
at java.lang.Thread.run(Thread.java:738)
Caused by: java.lang.Exception: RA.getXAResources() returned wrong number of XAResources: 0
... 9 more



Thursday, September 4, 2014

Ordering Categories By Sequence in Left Navigation

Without adding the logic below in CategoryFacetDisplay.jspf, OOB gets the categories by quantity product under each category by default to change that ordering to by sequence no in CATGRPREL. You need to add the following code to reorder the list. This would fix the left navigation.

This is a good example of ArrayList manipulation in JSP


<wcf:useBean var="sequenceBasedFacetFieldList" classname="java.util.ArrayList"/>
<wcbase:useBean id="currentCategoryDataBean" classname="com.ibm.commerce.catalog.beans.CategoryDataBean">
<c:set target="${currentCategoryDataBean}" property="categoryId" value="${WCParam.categoryId}" />
</wcbase:useBean>
<c:forEach var="catDB" items="${currentCategoryDataBean.subCategories }">
<c:forEach var="item1" items="${facetField.entry }">
<c:if test="${item1.value == catDB.categoryId }">
<wcf:set target="${sequenceBasedFacetFieldList}" value="${item1 }"/>
</c:if>
</c:forEach>
</c:forEach>
<wcf:useBean var="categoryFacetList" classname="java.util.ArrayList"/>


<c:forEach var="item" items="${sequenceBasedFacetFieldList}" varStatus="aStatus">

....................