You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2009/11/27 09:24:35 UTC

svn commit: r884780 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ specialpurpose/ecommerce/webapp/ecommerce/images/ specialpurpose/ecommerce/webapp/ecommerce/order/

Author: ashish
Date: Fri Nov 27 08:24:16 2009
New Revision: 884780

URL: http://svn.apache.org/viewvc?rev=884780&view=rev
Log:
Applied patch from jira issue OFBIZ-3264 -   OFBiz Change cart item price according to the price role.

Working Area: OnePageCheckout >> ShoppingCart.

Change minicart item price according to the price rule that will change according to the item quantity.
A product have different price as following:
A product feature contain different price rule with different condition for action like
1 product ---> Price $10.00
50 product ----> Price $8.00 (productPriceAction.amount = "-20.0" with productPriceActionTypeId="PRICE_POL").
If we change the quantity on shoppincart in OnePageCheckout the item price is not reflecting in the cart.

For this we need to add an out item price from getShoppingCartData service so that we can update value in the OnePageCheckout shoppingcart.

Thanks Brajesh & Rishi for the contribution.

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/checkoutProcess.js
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=884780&r1=884779&r2=884780&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Fri Nov 27 08:24:16 2009
@@ -981,6 +981,8 @@
             while (i.hasNext()) {
                 ShoppingCartItem cartLine = (ShoppingCartItem) i.next();
                 int cartLineIndex = shoppingCart.getItemIndex(cartLine);
+                cartItemData.put("displayItemQty_" + cartLineIndex, cartLine.getQuantity());
+                cartItemData.put("displayItemPrice_" + cartLineIndex, org.ofbiz.base.util.UtilFormatOut.formatCurrency(cartLine.getDisplayPrice(), isoCode, locale));
                 cartItemData.put("displayItemSubTotal_" + cartLineIndex, cartLine.getDisplayItemSubTotal());
                 cartItemData.put("displayItemSubTotalCurrencyFormatted_" + cartLineIndex ,org.ofbiz.base.util.UtilFormatOut.formatCurrency(cartLine.getDisplayItemSubTotal(), isoCode, locale));
                 cartItemData.put("displayItemAdjustment_" + cartLineIndex ,org.ofbiz.base.util.UtilFormatOut.formatCurrency(cartLine.getOtherAdjustments(), isoCode, locale));

Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/checkoutProcess.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/checkoutProcess.js?rev=884780&r1=884779&r2=884780&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/checkoutProcess.js (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/images/checkoutProcess.js Fri Nov 27 08:24:16 2009
@@ -501,6 +501,12 @@
                         $(cartItemDisplayRowId).remove();
                     } else {
                         var itemsHash = $H(data.cartItemData);
+                        $(elementId).value = itemsHash.get("displayItemQty_"+itemIndex);
+                        var lineItemPrice = itemsHash.get("displayItemPrice_"+itemIndex);
+                        var cartItemPrice = elementId.sub('qty_','itemUnitPrice_');
+                        var completedCartItemPrice = elementId.sub('qty_','completedCartItemPrice_');
+                        $(cartItemPrice).update(lineItemPrice);
+                        $(completedCartItemPrice).update(lineItemPrice);
                         var lineTotalId = elementId.sub('qty_','displayItem_');
                         var lineDiscountTotalId = elementId.sub('qty_','addPromoCode_');
                         var lineItemTotal = itemsHash.get("displayItemSubTotalCurrencyFormatted_"+itemIndex);

Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl?rev=884780&r1=884779&r2=884780&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl Fri Nov 27 08:24:16 2009
@@ -79,7 +79,7 @@
                   <tr id="cartItemDisplayRow_${cartLine_index}">
                     <td headers="orderItem"><img src="<@o...@ofbizContentUrl>" alt = "Product Image" /></td>
                     <td headers="description">${cartLine.getName()?if_exists}</td>
-                    <td headers="unitPrice">${cartLine.getDisplayPrice()}</td>
+                    <td headers="unitPrice" id="completedCartItemPrice_${cartLine_index}">${cartLine.getDisplayPrice()}</td>
                     <td headers="quantity"><span id="completedCartItemQty_${cartLine_index}">${cartLine.getQuantity()?string.number}</span></td>
                     <td headers="adjustment"><span id="completedCartItemAdjustment_${cartLine_index}"><@ofbizCurrency amount=cartLine.getOtherAdjustments() isoCode=shoppingCart.getCurrency() /></span></td>
                     <td headers="itemTotal" align="right"><span id="completedCartItemSubTotal_${cartLine_index}"><@ofbizCurrency amount=cartLine.getDisplayItemSubTotal() isoCode=shoppingCart.getCurrency() /></span></td>