[ofbiz-plugins] branch trunk updated: Improved: Can't enter decimals when ordering on ecommerce (OFBIZ-11899)

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: Improved: Can't enter decimals when ordering on ecommerce (OFBIZ-11899)

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 8822462  Improved: Can't enter decimals when ordering on ecommerce (OFBIZ-11899)
8822462 is described below

commit 882246204e8e28f9ad8589c0a9eaab78c9527e25
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Sun Aug 9 08:41:25 2020 +0200

    Improved: Can't enter decimals when ordering on ecommerce (OFBIZ-11899)
   
    I found the reason of this regression. It's due to
    https://gitbox.apache.org/repos/asf?p=ofbiz-plugins.git;h=a802ae0
   
    This reverts Suraj's workaround and the change in ConfigProductDetail.ftl by
    commit a802ae0. I'll ask James to fix the root of the issue in OFBIZ-11706.
---
 ecommerce/template/catalog/ConfigProductDetail.ftl | 16 +++++-----------
 ecommerce/widget/CatalogScreens.xml                |  2 +-
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/ecommerce/template/catalog/ConfigProductDetail.ftl b/ecommerce/template/catalog/ConfigProductDetail.ftl
index 44427f8..385d837 100644
--- a/ecommerce/template/catalog/ConfigProductDetail.ftl
+++ b/ecommerce/template/catalog/ConfigProductDetail.ftl
@@ -47,15 +47,9 @@ ${virtualJavaScript!}
   }
 
   function addItem() {
-    var addForm = jQuery('#addFormId');
-    var formData = addForm.serializeArray();
-    var quantity = formData.find(function(item){
-        return "quantity" == item.name;
-    })
-    var configForm = jQuery('#configFormId');
-    configForm.attr("action", addForm.attr("action"));
-    configForm.find("[name='quantity']").val(quantity.value);
-    configForm.submit();
+    document.configform.action = document.addform.action;
+    document.configform.quantity.value = document.addform.quantity.value;
+    document.configform.submit();
   }
   function verifyConfig() {
     document.configform.submit();
@@ -310,7 +304,7 @@ ${virtualJavaScript!}
 
         <form method="post"
             action="<@ofbizUrl>additem<#if requestAttributes._CURRENT_VIEW_??>/${requestAttributes._CURRENT_VIEW_}</#if></@ofbizUrl>"
-            name="addform" id="addFormId">
+            name="addform">
         <#assign inStock = true>
         <#-- Variant Selection -->
         <#if product.isVirtual?? && "Y" == product.isVirtual?upper_case>
@@ -372,7 +366,7 @@ ${virtualJavaScript!}
             <div>[${uiLabelMap.EcommerceProductNotConfigured}]&nbsp;
               <input type="text" size="5" name="quantity" value="0" disabled="disabled"/></div>
           <#else>
-            <div class="input-group"><input type="text" size="5" form="addFormId" name="quantity" value="1" class="form-control form-control-sm"/>
+            <div class="input-group"><input type="text" size="5" name="quantity" value="1" class="form-control form-control-sm"/>
             <span class="input-group-button">
             <a href="javascript:addItem()" class="btn btn-outline-secondary btn-sm">
                   ${uiLabelMap.OrderAddToCart}
diff --git a/ecommerce/widget/CatalogScreens.xml b/ecommerce/widget/CatalogScreens.xml
index e162984..a4ddeef 100644
--- a/ecommerce/widget/CatalogScreens.xml
+++ b/ecommerce/widget/CatalogScreens.xml
@@ -325,7 +325,7 @@ under the License.
             </actions>
             <widgets>
                 <include-screen name="breadcrumbs"/>
-                <platform-specific><html><html-template multi-block="true" location="component://ecommerce/template/catalog/ConfigProductDetail.ftl"/></html></platform-specific>
+                <platform-specific><html><html-template location="component://ecommerce/template/catalog/ConfigProductDetail.ftl"/></html></platform-specific>
             </widgets>
         </section>
     </screen>