[ofbiz-plugins] branch release18.12 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 release18.12 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 release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git


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

commit ab61110dc5243eca60b24b8c8cb56386b4e982fe
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 d786e5a..dafa686 100644
--- a/ecommerce/template/catalog/ProductDetail.ftl
+++ b/ecommerce/template/catalog/ProductDetail.ftl
@@ -336,6 +336,8 @@ $(function(){
   </#if>
 </#macro>
 
+${screens.render("component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#productvariantjs")}
+${variantInfoJavaScript!}
 <div id="product-detail" class="card">
   <#assign productAdditionalImage1 = productContentWrapper.get("ADDITIONAL_IMAGE_1", "url")! />
   <#assign productAdditionalImage2 = productContentWrapper.get("ADDITIONAL_IMAGE_2", "url")! />
@@ -719,15 +721,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 />
@@ -737,17 +737,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 36cc0a1..4ba17b5 100644
--- a/ecommerce/template/catalog/ProductSummary.ftl
+++ b/ecommerce/template/catalog/ProductSummary.ftl
@@ -51,6 +51,8 @@
     }
 //-->
 </script>
+${screens.render("component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#productvariantjs")}
+${variantInfoJavaScript!}
   <#if product??>
     <#-- variable setup -->
       <#if "Y" == backendPath?default("N")>
@@ -196,15 +198,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>