My Cart portlet JSP sample

The My Cart portlet displays the shopping cart details to the user and allows the shopper to check out the order and specify shipping and payment information.

From this portlet customers can do the following tasks:

  • Update the quantity of items
  • Delete an item
  • Select the recipient of each item
  • Select the shipping method of each item
  • Enter a payment method
  • Click the item name to display the product item information in the Product portlet
  • Click Order Now to process the order

The offer price for each of the items in the cart is shown. When this portlet appears the first time, MVCPortlet_installdir/jsp/html/default/MyCart.jsp is used.

My Cart portlet screen capture

Interactions

Customer action Portlet response Called WebSphere Commerce Services
Customer clicks the item name. The product item details are displayed in the Product portlet. GetCatalogEntryDetailsByIDs - Gets detailed information of a given set of catalog entries.
Customer updates the quantity of an item. The quantity of an item is updated. updateOrderItem (OrderItemUpdate) - Update quantity for some items in the shopping cart.
Customer clicks the remove icon. OrderItemDelete is called and the item is removed from the shopping cart. deleteOrderItem (OrderItemDelete) - Remove an item from a shopping cart.
Customer clicks the checkout icon. Address Book view appears in the My Account portlet on the same portal page. Customer can look at their address book and make any changes to entries while completing the order. In addition, another event is issued to the My Cashier portlet to display the checkout page. No Web service is called directly for checkout. Instead, the portlet remains, displaying contents of the shopping cart.
When the portlet first starts up or a refresh is performed on this portlet. Displays the MVCPortlet_installdir/jsp/html/default/MyCart.jsp page which shows the shopping cart contents of the current customer. findCurrentShoppingCart - Returns detailed information of an order in pending state, such as quantity and prices under each order item of the shopping cart.
Customer updates order information. The Cashier portlet, MVCPortlet_installdir/jsp/html/order/OrderCheckoutDisplay.jsp, refreshes and displays updated information.
  • findCurrentShoppingCart - Returns detailed information of an order in pending state, such as quantity and prices under each order item of the shopping cart.
  • findByOrderId under WC_UsableShippingInfoProfile - Returns available shipping information that can be used with the current shopping cart.
  • findByOrderId under WC_UsablePaymentInfoProfile - Returns available payment methods that can be used with the current shopping cart.
  • getCatalogEntrySummaryByID - Shows more product information under each order item.
  • updateOrderItem (OrderCheckoutDisplay) -Updates the shipping address and shipping method for an item in a shopping cart. The OrderCheckoutDisplay JSP file uses updateOrderItem to refresh the Order Checkout page, and show new shipping charges based on the new shipping method.
  • updateOrderShippingInfo (OrderCheckout) - Updates shipping information such as shipping address and shipping methods.
  • prepareOrder (OrderCheckout) - Prepares the shopping cart for adding payment information and submission.
  • submitOrder (OrderCheckout) - Submits an order when all information in an order is defined and updated (prices, shipping information and payment information).
Customer clicks Order Now. The Order Confirmation page, MVCPortlet_installdir/jsp/html/order/OrderConfirmation.jsp, appears.
  • findByOrderId under WC_OrderDetailsProfile - Gets detailed information of a submitted order.
  • getCatalogEntrySummaryByID - Shows more information about a product under each order item.