svn commit: r811716 - in /ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce: WEB-INF/actions/catalog/MiniProductSummary.groovy catalog/miniproductsummary.ftl

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

svn commit: r811716 - in /ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce: WEB-INF/actions/catalog/MiniProductSummary.groovy catalog/miniproductsummary.ftl

jleroux@apache.org
Author: jleroux
Date: Sat Sep  5 21:19:08 2009
New Revision: 811716

URL: http://svn.apache.org/viewvc?rev=811716&view=rev
Log:
A patch from Eric DE MAULDE "MiniProductSummary : showPricesWithVatTax and Currency " (https://issues.apache.org/jira/browse/OFBIZ-2613) - OFBIZ-2613


Modified:
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/miniproductsummary.ftl

Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy?rev=811716&r1=811715&r2=811716&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy Sat Sep  5 21:19:08 2009
@@ -17,6 +17,9 @@
  * under the License.
  */
 
+import java.math.BigDecimal;
+import java.util.Map;
+
 import org.ofbiz.base.util.*;
 import org.ofbiz.entity.*;
 import org.ofbiz.service.*;
@@ -49,15 +52,28 @@
     if (userLogin) priceParams.partyId = userLogin.partyId;
     priceResult = dispatcher.runSync("calculateProductPrice", priceParams);
     // returns: isSale, price, orderItemPriceInfos
-
     context.priceResult = priceResult;
+    // Check if Price has to be displayed with tax
+    if (productStore.get("showPricesWithVatTax").equals("Y")) {
+        Map priceMap = dispatcher.runSync("calcTaxForDisplay", UtilMisc.toMap("basePrice", priceResult.get("price"), "locale", locale, "productId", optProductId, "productStoreId", productStoreId));
+        context.price = priceMap.get("priceWithTax");
+    } else {
+        context.price = priceResult.get("price");
+    }
 
     // get aggregated product totalPrice
     if ("AGGREGATED".equals(miniProduct.productTypeId)) {
         configWrapper = ProductConfigWorker.getProductConfigWrapper(optProductId, cart.getCurrency(), request);
         if (configWrapper) {
             configWrapper.setDefaultConfig();
-            context.totalPrice = configWrapper.getTotalPrice();
+            // Check if Config Price has to be displayed with tax
+            if (productStore.get("showPricesWithVatTax").equals("Y")) {
+                BigDecimal totalPriceNoTax = configWrapper.getTotalPrice();
+                Map totalPriceMap = dispatcher.runSync("calcTaxForDisplay", UtilMisc.toMap("basePrice", totalPriceNoTax, "locale", locale, "productId", optProductId, "productStoreId", productStoreId));
+                context.totalPrice = totalPriceMap.get("priceWithTax");
+            } else {
+                context.totalPrice = configWrapper.getTotalPrice();
+            }
         }
     }
 

Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/miniproductsummary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/miniproductsummary.ftl?rev=811716&r1=811715&r2=811716&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/miniproductsummary.ftl (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/miniproductsummary.ftl Sat Sep  5 21:19:08 2009
@@ -23,7 +23,7 @@
           <#if (priceResult.price?default(0) > 0 && miniProduct.requireAmount?default("N") == "N")>
             <#if "Y" = miniProduct.isVirtual?if_exists> ${uiLabelMap.CommonFrom} </#if>
             <#if totalPrice?exists>
-              <li>${uiLabelMap.ProductAggregatedPrice}: <span class='basePrice'><@ofbizCurrency amount=totalPrice isoCode=totalPrice.currencyUsed/></span></li>
+              <li>${uiLabelMap.ProductAggregatedPrice}: <span class='basePrice'><@ofbizCurrency amount=totalPrice isoCode=priceResult.currencyUsed/></span></li>
             <#else>
               <span class="<#if priceResult.isSale>salePrice<#else>normalPrice</#if>">
               <@ofbizCurrency amount=priceResult.price isoCode=priceResult.currencyUsed/></span>