svn commit: r565935 - in /ofbiz/trunk/applications/order: servicedef/services_cart.xml src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r565935 - in /ofbiz/trunk/applications/order: servicedef/services_cart.xml src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

apatel-2
Author: apatel
Date: Tue Aug 14 14:53:59 2007
New Revision: 565935

URL: http://svn.apache.org/viewvc?view=rev&rev=565935
Log:
added currency formatted out values to getShoppingCartData. Lets thing to worry on client side.

Modified:
    ofbiz/trunk/applications/order/servicedef/services_cart.xml
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Modified: ofbiz/trunk/applications/order/servicedef/services_cart.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_cart.xml?view=diff&rev=565935&r1=565934&r2=565935
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services_cart.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services_cart.xml Tue Aug 14 14:53:59 2007
@@ -124,9 +124,13 @@
         <attribute name="totalQuantity" type="Double" mode="OUT" optional="true"/>
         <attribute name="currencyIsoCode" type="String" mode="OUT" optional="true"/>
         <attribute name="subTotal" type="Double" mode="OUT" optional="true"/>
+        <attribute name="subTotalCurrencyFormatted" type="String" mode="OUT" optional="true"/>
         <attribute name="totalShipping" type="Double" mode="OUT" optional="true"/>
+        <attribute name="totalShippingCurrencyFormatted" type="String" mode="OUT" optional="true"/>
         <attribute name="totalSalesTax" type="Double" mode="OUT" optional="true"/>
+        <attribute name="totalSalesTaxCurrencyFormatted" type="String" mode="OUT" optional="true"/>
         <attribute name="displayGrandTotal" type="Double" mode="OUT" optional="true"/>
+        <attribute name="displayGrandTotalCurrencyFormatted" type="String" mode="OUT" optional="true"/>
         <attribute name="cartItemData" type="Map" mode="OUT"/>
     </service>
 </services>

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?view=diff&rev=565935&r1=565934&r2=565935
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Tue Aug 14 14:53:59 2007
@@ -758,14 +758,20 @@
     
     public static Map getShoppingCartData(DispatchContext dctx, Map context){
         Map result = ServiceUtil.returnSuccess();
+        Locale locale = (Locale) context.get("locale");
         ShoppingCart shoppingCart = (ShoppingCart) context.get("shoppingCart");
         if(shoppingCart != null){
+            String isoCode = shoppingCart.getCurrency();
             result.put("totalQuantity",new Double(shoppingCart.getTotalQuantity()));
-            result.put("currencyIsoCode",shoppingCart.getCurrency());
+            result.put("currencyIsoCode",isoCode);
             result.put("subTotal",new Double(shoppingCart.getSubTotal()));
+            result.put("subTotalCurrencyFormatted",org.ofbiz.base.util.UtilFormatOut.formatCurrency(shoppingCart.getSubTotal(),isoCode,locale));
             result.put("totalShipping",new Double(shoppingCart.getTotalShipping()));
+            result.put("totalShippingCurrencyFormatted",org.ofbiz.base.util.UtilFormatOut.formatCurrency(shoppingCart.getTotalShipping(),isoCode,locale));
             result.put("totalSalesTax",new Double(shoppingCart.getTotalSalesTax()));
+            result.put("totalSalesTaxCurrencyFormatted",org.ofbiz.base.util.UtilFormatOut.formatCurrency(shoppingCart.getTotalSalesTax(),isoCode,locale));
             result.put("displayGrandTotal",new Double(shoppingCart.getDisplayGrandTotal()));
+            result.put("displayGrandTotalCurrencyFormatted",org.ofbiz.base.util.UtilFormatOut.formatCurrency(shoppingCart.getDisplayGrandTotal(),isoCode,locale));
 
             Iterator i = shoppingCart.iterator();
             Map cartItemData = FastMap.newInstance();
@@ -773,6 +779,7 @@
                 ShoppingCartItem cartLine = (ShoppingCartItem) i.next();
                 int cartLineIndex = shoppingCart.getItemIndex(cartLine);
                 cartItemData.put("displayItemSubTotal_" + cartLineIndex ,new Double(cartLine.getDisplayItemSubTotal()));
+                cartItemData.put("displayItemSubTotalCurrencyFormatted_" + cartLineIndex ,org.ofbiz.base.util.UtilFormatOut.formatCurrency(cartLine.getDisplayItemSubTotal(),isoCode,locale));
             }
             result.put("cartItemData",cartItemData);
         }