svn commit: r610800 - in /ofbiz/trunk/applications: ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ ecommerce/webapp/ecommerce/catalog/ ecommerce/widget/ order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ order/webapp/ordermgr/entry/catalog/

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

svn commit: r610800 - in /ofbiz/trunk/applications: ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/ ecommerce/webapp/ecommerce/catalog/ ecommerce/widget/ order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ order/webapp/ordermgr/entry/catalog/

jleroux@apache.org
Author: jleroux
Date: Thu Jan 10 06:14:05 2008
New Revision: 610800

URL: http://svn.apache.org/viewvc?rev=610800&view=rev
Log:
Based on patch from Bilgin Ibryam "Aggregate items base price is displayed yet unattainable" (https://issues.apache.org/jira/browse/OFBIZ-1495) - OFBIZ-1495
I added support to  Quick Add, Last Products and Quick Reorder and fixed some potential issues in order.


Modified:
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/miniproductsummary.bsh
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/catalog/miniproductsummary.ftl
    ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productsummary.bsh
    ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/configproductdetail.ftl
    ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl
    ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/quickaddsummary.ftl

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/miniproductsummary.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/miniproductsummary.bsh?rev=610800&r1=610799&r2=610800&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/miniproductsummary.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/miniproductsummary.bsh Thu Jan 10 06:14:05 2008
@@ -21,6 +21,7 @@
 import org.ofbiz.entity.*;
 import org.ofbiz.service.*;
 import org.ofbiz.product.product.ProductContentWrapper;
+import org.ofbiz.product.config.ProductConfigWorker;
 import org.ofbiz.product.catalog.*;
 import org.ofbiz.product.store.*;
 import org.ofbiz.order.shoppingcart.*;
@@ -32,6 +33,8 @@
 prodCatalogId = CatalogWorker.getCurrentCatalogId(request);
 productStoreId = ProductStoreWorker.getProductStoreId(request);
 cart = ShoppingCartEvents.getCartObject(request);
+context.remove("totalPrice");
+
 
 if (optProductId != null) {    
     miniProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", optProductId));
@@ -53,6 +56,15 @@
 
     context.put("priceResult", priceResult);
 
+    // get aggregated product totalPrice
+    if ("AGGREGATED".equals(miniProduct.getString("productTypeId"))) {
+        configWrapper = ProductConfigWorker.getProductConfigWrapper(optProductId, cart.getCurrency(), request);
+        if (configWrapper != null) {
+            configWrapper.setDefaultConfig();
+            context.put("totalPrice",configWrapper.getTotalPrice());
+        }
+    }    
+    
     context.put("miniProduct", miniProduct);
     context.put("nowTimeLong", UtilDateTime.nowTimestamp().getTime());
 
@@ -62,5 +74,6 @@
     // make the miniProductContentWrapper
     ProductContentWrapper miniProductContentWrapper = new ProductContentWrapper(miniProduct, request);
     context.put("miniProductContentWrapper", miniProductContentWrapper);
+    
 }
 

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/catalog/miniproductsummary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/catalog/miniproductsummary.ftl?rev=610800&r1=610799&r2=610800&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/catalog/miniproductsummary.ftl (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/catalog/miniproductsummary.ftl Thu Jan 10 06:14:05 2008
@@ -20,7 +20,13 @@
     <a href="<@ofbizUrl>product/~product_id=${miniProduct.productId}</@ofbizUrl>" class="linktext">${miniProductContentWrapper.get("PRODUCT_NAME")?default("No Name Available")}</a>
     <div class="tabletext"><b>${miniProduct.productId}</b>
       <#if (priceResult.price?default(0) > 0 && miniProduct.requireAmount?default("N") == "N")>
-        <#if "Y" = miniProduct.isVirtual?if_exists> ${uiLabelMap.CommonFrom} </#if><b><span class="<#if priceResult.isSale>salePrice<#else>normalPrice</#if>"><@ofbizCurrency amount=priceResult.price isoCode=priceResult.currencyUsed/></span></b>
+        <#if "Y" = miniProduct.isVirtual?if_exists> ${uiLabelMap.CommonFrom} </#if>
+        <#if totalPrice?exists>
+          <div class="tabletext">${uiLabelMap.ProductAggregatedPrice}: <span class='basePrice'><@ofbizCurrency amount=totalPrice isoCode=totalPrice.currencyUsed/></span></div>
+        <#else>        
+          <b><span class="<#if priceResult.isSale>salePrice<#else>normalPrice</#if>">
+          <@ofbizCurrency amount=priceResult.price isoCode=priceResult.currencyUsed/></span></b>
+        </#if>
       </#if>
     </div>
 

Modified: ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml?rev=610800&r1=610799&r2=610800&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml (original)
+++ ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml Thu Jan 10 06:14:05 2008
@@ -94,6 +94,7 @@
         <section>
             <actions>
                 <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
+                <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/miniproductsummary.bsh"/>
             </actions>
             <widgets>
                 <platform-specific><html><html-template location="component://ecommerce/webapp/ecommerce/catalog/minilastviewedproducts.ftl"/></html></platform-specific>

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productsummary.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productsummary.bsh?rev=610800&r1=610799&r2=610800&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productsummary.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productsummary.bsh Thu Jan 10 06:14:05 2008
@@ -27,6 +27,7 @@
 import org.ofbiz.entity.util.*;
 import org.ofbiz.service.*;
 import org.ofbiz.product.product.ProductContentWrapper;
+import org.ofbiz.product.config.ProductConfigWorker;
 import org.ofbiz.product.catalog.*;
 import org.ofbiz.product.store.*;
 import org.ofbiz.order.shoppingcart.*;
@@ -50,6 +51,7 @@
 context.remove("daysToShip");
 context.remove("averageRating");
 context.remove("numRatings");
+context.remove("totalPrice");
 
 if (product != null) {
     productId = product.get("productId");
@@ -114,6 +116,16 @@
 
         context.put("price", priceMap);
     }
+
+    // get aggregated product totalPrice
+    if ("AGGREGATED".equals(product.getString("productTypeId"))) {
+        configWrapper = ProductConfigWorker.getProductConfigWrapper(productId, cart.getCurrency(), request);
+        if (configWrapper != null) {
+            configWrapper.setDefaultConfig();
+            context.put("totalPrice",configWrapper.getTotalPrice());
+        }
+    }
+
     // get the product review(s)
     reviews = product.getRelatedCache("ProductReview", null, UtilMisc.toList("-postedDateTime"));
 }

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/configproductdetail.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/configproductdetail.ftl?rev=610800&r1=610799&r2=610800&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/configproductdetail.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/configproductdetail.ftl Thu Jan 10 06:14:05 2008
@@ -195,7 +195,7 @@
               - if isSale show price with salePrice style and print "On Sale!"
       -->
       <#if totalPrice?exists>
-        <div class="tabletext">${uiLabelMap.ProductAggregatedPrice}: <span class='basePrice'><@ofbizCurrency amount=totalPrice isoCode=price.currencyUsed/></span></div>
+        <div class="tabletext">${uiLabelMap.ProductAggregatedPrice}: <span class='basePrice'><@ofbizCurrency amount=totalPrice isoCode=totalPrice.currencyUsed/></span></div>
       <#else>
       <#if price.competitivePrice?exists && price.price?exists && price.price?double < price.competitivePrice?double>
         <div class="tabletext">${uiLabelMap.ProductCompareAtPrice}: <span class='basePrice'><@ofbizCurrency amount=price.competitivePrice isoCode=price.currencyUsed/></span></div>

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl?rev=610800&r1=610799&r2=610800&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/productsummary.ftl Thu Jan 10 06:14:05 2008
@@ -108,6 +108,9 @@
           </#if>
           <div class="tabletext">
               <b>${product.productId?if_exists}</b>
+                <#if totalPrice?exists>
+                  <div class="tabletext">${uiLabelMap.ProductAggregatedPrice}: <span class='basePrice'><@ofbizCurrency amount=totalPrice isoCode=totalPrice.currencyUsed/></span></div>
+                <#else>
                 <#if price.competitivePrice?exists && price.price?exists && price.price?double < price.competitivePrice?double>
                   ${uiLabelMap.ProductCompareAtPrice}: <span class='basePrice'><@ofbizCurrency amount=price.competitivePrice isoCode=price.currencyUsed/></span>
                 </#if>
@@ -130,6 +133,7 @@
                   <#assign priceSaved = price.listPrice?double - price.price?double>
                   <#assign percentSaved = (priceSaved?double / price.listPrice?double) * 100>
                     ${uiLabelMap.EcommerceSave}: <span class="basePrice"><@ofbizCurrency amount=priceSaved isoCode=price.currencyUsed/> (${percentSaved?int}%)</span>
+                </#if>
                 </#if>
                 <#-- show price details ("showPriceDetails" field can be set in the screen definition) -->
                 <#if (showPriceDetails?exists && showPriceDetails?default("N") == "Y")>

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/quickaddsummary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/quickaddsummary.ftl?rev=610800&r1=610799&r2=610800&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/quickaddsummary.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/quickaddsummary.ftl Thu Jan 10 06:14:05 2008
@@ -36,9 +36,13 @@
     </div>
   </td>
   <td align="right" valign="middle" width="5%">
-    <div class="<#if price.isSale?exists && price.isSale>salePrice<#else>normalPrice</#if>">
-      <b><@ofbizCurrency amount=price.price isoCode=price.currencyUsed/></b>
-    </div>
+      <#if totalPrice?exists>
+        <div class="tabletext">${uiLabelMap.ProductAggregatedPrice}: <span class='basePrice'><@ofbizCurrency amount=totalPrice isoCode=totalPrice.currencyUsed/></span></div>
+      <#else>
+        <div class="<#if price.isSale?exists && price.isSale>salePrice<#else>normalPrice</#if>">
+          <b><@ofbizCurrency amount=price.price isoCode=price.currencyUsed/></b>
+        </div>
+      </#if>
   </td>                                
   <td align="right" valign="middle">
     <#-- check to see if introductionDate hasn't passed yet -->
@@ -57,4 +61,5 @@
 <#else>
   <h1>${uiLabelMap.ProductErrorProductNotFound}.</h1>
 </#if>
+