svn commit: r744714 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java

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

svn commit: r744714 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java

jleroux@apache.org
Author: jleroux
Date: Sun Feb 15 18:20:46 2009
New Revision: 744714

URL: http://svn.apache.org/viewvc?rev=744714&view=rev
Log:
A slightly modified patch from Eric De Maulde "Display price with VAT for configurable goods in cart." https://issues.apache.org/jira/browse/OFBIZ-2190 - OFBIZ-2190

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=744714&r1=744713&r2=744714&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Sun Feb 15 18:20:46 2009
@@ -1176,7 +1176,16 @@
                     if (configWrapper != null) {
                         // TODO: for configurable products need to do something to make them VAT aware... for now base and display prices are the same
                         this.setBasePrice(configWrapper.getTotalPrice());
-                        this.setDisplayPrice(configWrapper.getTotalPrice());
+                        // Check if price display with taxes
+                        GenericValue productStore = ProductStoreWorker.getProductStore(cart.getProductStoreId(), delegator);
+                        if (UtilValidate.isNotEmpty(productStore) && productStore.get("showPricesWithVatTax").equals("Y")){
+                            BigDecimal totalPrice = configWrapper.getTotalPrice();
+                            // Get Taxes
+                            Map totalPriceWithTaxMap = dispatcher.runSync("calcTaxForDisplay", UtilMisc.toMap("basePrice", totalPrice, "productId", this.productId, "productStoreId", cart.getProductStoreId()));
+                            this.setDisplayPrice((BigDecimal) totalPriceWithTaxMap.get("priceWithTax"));
+                        }else{
+                            this.setDisplayPrice(configWrapper.getTotalPrice());
+                        }
                     }
                     
                     // no try to do a recurring price calculation; not all products have recurring prices so may be null