You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2008/08/19 14:16:21 UTC

svn commit: r687037 - in /ofbiz/trunk/applications/ecommerce/webapp/ecommerce: images/checkoutProcess.js order/OnePageCheckoutProcess.ftl

Author: ashish
Date: Tue Aug 19 05:16:20 2008
New Revision: 687037

URL: http://svn.apache.org/viewvc?rev=687037&view=rev
Log:
Generalized the method for extracting states for selected country from drop down and improved java script for billingSameAsShipping option in billing panel of one page checkout.

Thanks to Jyotsna Rathore and Sumit Pandit in this contribution.

Modified:
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js?rev=687037&r1=687036&r2=687037&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js Tue Aug 19 05:16:20 2008
@@ -62,7 +62,6 @@
         if (isCartStepValidate && isShipStepValidate) {
             if (validateShipOption.validate()) {
                 setShippingOption();
-                getAssociatedBillingStateList(); 
                 displayBillingPanel();
                 isShipOptionStepValidate = true;
             }
@@ -94,7 +93,6 @@
     
     // For Billing Address Same As Shipping
     Event.observe('useShippingAddressForBilling', 'click', function() {
-        getAssociatedBillingStateList();
         useShippingAddressForBillingToggle();
         validateBill.validate();
     });
@@ -105,7 +103,9 @@
     Event.observe('processOrderButton', 'click', processOrder);
 
     // Get associate states for billing panel
-    Event.observe($('billToCountryGeoId'), 'change', getAssociatedBillingStateList);
+    Event.observe($('billToStateProvinceGeoId'), 'focus', function(){
+      getAssociatedBillingStateList('billingForm', 'billToStateProvinceGeoId');
+    });
 });
 
 // Check server side error
@@ -329,13 +329,13 @@
 
 // Billing
 function useShippingAddressForBillingToggle() {
-    $('billToStateProvinceGeoId').value = $F('shipToStateProvinceGeoId');
     if ($('useShippingAddressForBilling').checked) {
         $('billToAddress1').value = $F('shipToAddress1');
         $('billToAddress2').value = $F('shipToAddress2');
         $('billToCity').value = $F('shipToCity');
         $('billToPostalCode').value = $F('shipToPostalCode');
         $('billToCountryGeoId').value = $F('shipToCountryGeoId');
+        $('billToStateProvinceGeoId').update("<option value = " + $F('shipToStateProvinceGeoId') + " > " + $('shipToStateProvinceGeo').value + " </option>");
         Effect.BlindUp($('billingAddress'), {duration: 0.3});
     } else {
         Effect.BlindDown($('billingAddress'), {duration: 0.3});
@@ -511,11 +511,11 @@
     $('orderSubmitForm').submit();
 }
 
-function getAssociatedBillingStateList() {
+function getAssociatedBillingStateList(formName, divId) {
     var optionList = [];
     new Ajax.Request("getAssociatedStateList", {
         asynchronous: false,
-        parameters: $('billingForm').serialize(),
+        parameters: $(formName).serialize(),
         onSuccess: function(transport) {
             var data = transport.responseText.evalJSON(true);
             stateList = data.stateList;
@@ -523,7 +523,7 @@
                 geoVolues = state.split(': ');
                 optionList.push("<option value = "+geoVolues[1]+" >"+geoVolues[0]+"</option>");
             });
-            $('billToStateProvinceGeoId').update(optionList);
+            $(divId).update(optionList);
         }
     });
 }
\ No newline at end of file

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl?rev=687037&r1=687036&r2=687037&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl Tue Aug 19 05:16:20 2008
@@ -557,9 +557,8 @@
                         </div>
                         <div class="field-widget">
                           <select name="countryGeoId" id="billToCountryGeoId" class="required selectBox">
-                            <#if (parameters.countryGeoId)?exists>
+                            <#if parameters.billToCountryGeoId?exists>
                               <option>${parameters.billToCountryProvinceGeo}</option>
-                              <option value="${parameters.billToCountryGeoId}">---</option>
                             </#if>
                             ${screens.render("component://common/widget/CommonScreens.xml#countries")}
                           </select>
@@ -573,7 +572,6 @@
                           <select id="billToStateProvinceGeoId" name="billToStateProvinceGeoId" class="required selectBox">
                             <#if parameters.billToStateProvinceGeoId?has_content>
                               <option>${parameters.billToStateProvinceGeo}</option>
-                              <option value="${parameters.billToStateProvinceGeoId}">---</option>
                             <#else>
                               <option value="">${uiLabelMap.PartyNoState}</option>
                             </#if>