In IBM WCS both cart and orders are managed in the same table for a user, a cart transitions through various states and this is used to identify the cart state.
For example a pending order would have orders.state as "P", while a submitted order will have ORDERS.state as "M"
Review following link for more information on Order state transition
http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.developer.doc/refs/rosordstattran.htm
In general checkout flow supports both AJAX and non AJAX version of server side processing, review AJAX URL's defined in following OOB Struts configuration files for supported AJAX actions
/Stores.war/WEB-INF/struts-config-order-services.xml has all the AJAX versions of the command defined in it.
1. Add to Cart: User is browsing the site as anonymous, guest or authenticated user and adds an item from browse pages to cart
You can call the OOB non AJAX version "/OrderChangeServiceItemAdd" which is mapped as follows in struts-config
<action parameter="com.ibm.commerce.orderitems.commands.OrderItemAddCmd" path="/OrderChangeServiceItemAdd" type="com.ibm.commerce.struts.BaseAction">
</action>
If you want to use AJAX version use "/AjaxOrderChangeServiceItemAdd" command
<action parameter="order.addOrderItem" path="/AjaxOrderChangeServiceItemAdd" type="com.ibm.commerce.struts.AjaxComponentServiceAction">
</action>
Refer following link for various AJAX actions supported by this Fascade
http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.madisons-starterstore.doc/refs/rsmmadisonorderservices.htm
Both AJAX and non AJAX finally make use of following implementation This uses following OOB controller command
com.ibm.commerce.orderitems.commands.OrderItemAddCmdImpl
- Extends com.ibm.commerce.orderitems.commands.OrderItemBaseCmdImpl
Any customization would require extension of OOB OrderItemAddCmdImpl
2. View Cart: User clicks on View Cart Page
At this step you want to display guest the cart content with list of order items with pending order status
You can use following OOB Struts action url "/OrderItemDisplay"
<action
parameter="com.ibm.commerce.orderitems.commands.OrderItemDisplayCmd"
path="/OrderItemDisplay" type="com.ibm.commerce.struts.BaseAction">
<set-property property="https" value="0:1"/>
<set-property property="authenticate" value="0:0"/>
</action>
Review following link for more details on optional and mandatory input parameters for this URL
http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.developer.doc/refs/rosorderitemdisplay.htm
This action internally makes use of following OOB controller command
com.ibm.commerce.orderitems.commands.OrderItemDisplayCmdImpl
Control the various calculations that needs to be performed before you display the Cart Page
E.g by passing following in URL calculationUsageId=-1&calculationUsageId=-2&calculationUsageId=-7 you are triggering calculation of Tax, discount, Shipping
Any customization would require extension of OOB OrderItemDisplayCmdImpl
3. Shipping Page: User clicks on checkout and is navigated to shipping page
<action
parameter="com.ibm.commerce.orderitems.commands.OrderItemUpdateCmd"
path="/OrderItemUpdate" type="com.ibm.commerce.struts.BaseAction">
<set-property property="https" value="0:1"/>
<set-property property="authenticate" value="0:0"/>
</action>
http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.developer.doc/refs/rosorderitemupdate.htm
This action used following OOB command com.ibm.commerce.orderitems.commands.OrderItemUpdateCmdImpl
4. Payments Page: User navigates to payments page
This flow typically includes adding single/multiple payment information to an order, once the payment information is submitted
we can use following command for processing before forwarding user to review order screen
The OOB /OrderProcess should be used for this purpose,
it is implemented by following OOB command com.ibm.commerce.order.commands.OrderPrepareCmdImpl
Pass appropriate payment parameters to add the payment information entered to an Order.
http://publib.boulder.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.developer.doc/refs/rosorderprocess.htm
5. Review Order User navigates to review order page and submits order
The OOB /OrderProcess should be used for final Order submission, as mentioned in previous step this URL
implements OOB com.ibm.commerce.order.commands.OrderProcessCmdImpl command.
6. Submit Order: Order Submission and post processing
Once an Order is submitted OrderProcessCmdImpl Calls RaiseOrderEventCmd to raise ORDER_SUBMISSION_EVENT
com.ibm.commerce.order.event.RaiseOrderSubmitEventCmd
any customization to this command would require extension of
com.ibm.commerce.order.event.RaiseOrderSubmitEventCmdImpl command which is the default implementation.
com.ibm.commerce.order.event.ProcessOrderSubmitEventCmdImpl which is default implementation of OOB
com.ibm.commerce.order.event.ProcessOrderSubmitEventCmd listens to ORDER_SUBMISSION_EVENT and takes care
of transferring the order to the external system.
This is the appropriate command for customization If you need any customization in Order XML which is posted to external system
This was really very informative. Thanks for the post.
ReplyDeleteCan I transfer the order without changing the inventory status to -4 or -5?
ReplyDeleteCan you let me know how the orderXML is generated on click of submit order in OOB.
ReplyDeleteI want to know how to find the Command to be extended for a particular functionality. I tried to find the request flow, but not successful. Unable to have source code in my RAD. Help me to know this.
ReplyDeletewhere can I find the order xml generated ? is it stored any where in tables so that i can check it later ?
ReplyDelete