[ofbiz-plugins] branch trunk updated: Fixed: display/selection of unit of measure is broken/plugins (OFBIZ-11993)

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

[ofbiz-plugins] branch trunk updated: Fixed: display/selection of unit of measure is broken/plugins (OFBIZ-11993)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git


The following commit(s) were added to refs/heads/trunk by this push:
     new bf60a20  Fixed: display/selection of unit of measure is broken/plugins (OFBIZ-11993)
bf60a20 is described below

commit bf60a20d9d712f78fc8de807d0677b0619b7a96d
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Mon Aug 31 10:06:27 2020 +0200

    Fixed: display/selection of unit of measure is broken/plugins (OFBIZ-11993)
   
    Allows selection of uom for multiple products on the same web page
   
    Thanks: Alex
---
 ecommerce/template/catalog/ProductDetail.ftl  | 26 ++++++++++++--------------
 ecommerce/template/catalog/ProductSummary.ftl | 12 +++++++-----
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/ecommerce/template/catalog/ProductDetail.ftl b/ecommerce/template/catalog/ProductDetail.ftl
index 9b66d1b..3a5b5da 100644
--- a/ecommerce/template/catalog/ProductDetail.ftl
+++ b/ecommerce/template/catalog/ProductDetail.ftl
@@ -335,6 +335,8 @@ $(function(){
   </#if>
 </#macro>
 
+${screens.render("component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#productvariantjs")}
+${variantInfoJavaScript!}
 <div id="product-detail" class="card">
   <#assign productAdditionalImage1 = productContentWrapper.get("XTRA_IMG_1_MEDIUM", "url")! />
   <#assign productAdditionalImage2 = productContentWrapper.get("XTRA_IMG_2_MEDIUM", "url")! />
@@ -718,15 +720,13 @@ $(function(){
                   </select>
                 </div>
               </#list>
-              <span id="product_uom"></span>
+              <span id="product_uom"></span><br/>
+              <div class="variant-price" style="display: none;">
+                  <strong><span class="product_id_display"> </span></strong>
+                  <strong><span class="variant_price_display"> </span></strong>
+              </div>
               <input type="hidden" name="product_id" value="${product.productId}"/>
               <input type="hidden" name="add_product_id" value="NULL"/>
-              <div>
-                <strong><span id="product_id_display"> </span></strong>
-                <strong>
-                  <div id="variant_price_display"></div>
-                </strong>
-              </div>
             <#else>
               <input type="hidden" name="add_product_id" value="NULL"/>
               <#assign inStock = false />
@@ -736,17 +736,15 @@ $(function(){
           <input type="hidden" name="add_product_id" value="${product.productId}"/>
           <#if mainProducts?has_content>
             <input type="hidden" name="product_id" value=""/>
-            <select name="productVariantId" class="form-control" onchange="javascript:displayProductVirtualVariantId(this.value);">
-              <option value="">Select Unit Of Measure</option>
+            <select name="productVariantId" class="form-control" onchange="javascript:variantUomSelection(this);">
+              <option value="">${uiLabelMap.CommonSelect} ${uiLabelMap.ProductUnitOfMeasure}</option>
               <#list mainProducts as mainProduct>
                 <option value="${mainProduct.productId}">${mainProduct.uomDesc} : ${mainProduct.piecesIncluded}</option>
               </#list>
             </select><br/>
-            <div>
-              <strong><span id="product_id_display"> </span></strong>
-              <strong>
-                <div id="variant_price_display"></div>
-              </strong>
+            <div class="variant-price" style="display: none;">
+                <strong><span class="product_id_display"> </span></strong>
+                <strong><span class="variant_price_display"> </span></strong>
             </div>
           </#if>
           <#if (availableInventory??) && (availableInventory <= 0) && "N" == product.requireAmount?default("N")>
diff --git a/ecommerce/template/catalog/ProductSummary.ftl b/ecommerce/template/catalog/ProductSummary.ftl
index 1412dc9..0e8b115 100644
--- a/ecommerce/template/catalog/ProductSummary.ftl
+++ b/ecommerce/template/catalog/ProductSummary.ftl
@@ -49,6 +49,8 @@
         }
     }
 </script>
+${screens.render("component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#productvariantjs")}
+${variantInfoJavaScript!}
   <#if product??>
     <#-- variable setup -->
       <#if "Y" == backendPath?default("N")>
@@ -197,15 +199,15 @@
                                         </div>
                                         <#if mainProducts?has_content>
                                           <input type="hidden" name="product_id" value=""/>
-                                          <select name="productVariantId" onchange="javascript:displayProductVirtualId(this.value, '${product.productId}', this.form);">
-                                            <option value="">Select Unit Of Measure</option>
+                                          <select name="productVariantId" onchange="javascript:variantUomSelection(this);" style="width: 100%;">
+                                            <option value="">${uiLabelMap.CommonSelect} ${uiLabelMap.ProductUnitOfMeasure}</option>
                                             <#list mainProducts as mainProduct>
                                               <option value="${mainProduct.productId}">${mainProduct.uomDesc} : ${mainProduct.piecesIncluded}</option>
                                             </#list>
                                           </select>
-                                          <div style="display: inline-block;">
-                                            <strong><span id="product_id_display"> </span></strong>
-                                            <strong><span id="variant_price_display"> </span></strong>
+                                          <div class="variant-price" style="display: none;">
+                                            <strong><span class="product_id_display"> </span></strong>
+                                            <strong><span class="variant_price_display"> </span></strong>
                                           </div>
                                         </#if>
                                       </div>