From 113c33134d3ae1f8233d23fec4a8aec1b6ea25bf Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Sun, 15 Feb 2009 18:20:46 +0000 Subject: [PATCH] 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 git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@744714 13f79535-47bb-0310-9956-ffa450edef68 --- .../ofbiz/order/shoppingcart/ShoppingCartItem.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java b/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java index 40f42b7100..213455901c 100644 --- a/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java +++ b/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java @@ -1176,7 +1176,16 @@ public class ShoppingCartItem implements java.io.Serializable { 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