svn commit: r676563 - /ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js

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

svn commit: r676563 - /ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js

mor-2
Author: mor
Date: Mon Jul 14 05:11:54 2008
New Revision: 676563

URL: http://svn.apache.org/viewvc?rev=676563&view=rev
Log:
Fixed a issue of geo Id's for state not passed properly to event and a IE issue in billing panel on One Page. Patch from Rishi Solanki and Santosh Malviya

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

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=676563&r1=676562&r2=676563&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js Mon Jul 14 05:11:54 2008
@@ -105,6 +105,7 @@
 
     // Autocompleter for shipping panel
     Event.observe($('shipToCountryGeo'), 'focus', getCountryList);
+    Event.observe($('shipToCountryGeo'), 'change', isCountryChanged);
     Event.observe($('shipToCountryGeo'), 'blur', splitCountryNameFromIds);
     
     Event.observe($('shipToStateProvinceGeo'), 'focus', getAssociatedStateList);
@@ -501,12 +502,12 @@
     $('orderSubmitForm').submit();
 }
 
-var countryChange = 0;
+var countryChange = true;
 var autoCompleteCountries = null;
 var countryList = [];
 
 function getCountryList() {
-    if (countryChange == 0) {
+    if (countryChange) {
     new Ajax.Request("getCountryList",
         { asynchronous: false,
           onSuccess: function(transport) {
@@ -515,9 +516,8 @@
           autoCompleteCountries = new Autocompleter.Local("shipToCountryGeo", "shipToCountries", countryList, {partialSearch: false});
         }
     });
-    countryChange++;
+    countryChange = false;
     }
-    stateChange = 0;
 }
 
 function splitCountryNameFromIds() {
@@ -525,7 +525,7 @@
     geoValues = $('shipToCountryGeo').value.split(': ');
     if(geoValues) {
         $('shipToCountryGeo').value = geoValues[0];
-        if(geoValues[1] == 'undefined' || geoValues[1] == null) {
+        if(geoValues[1] != 'undefined' || geoValues[1] != null) {
             countryList.each(function(country){
                 geo = country.split(': ');
                 if(geoValues[0] == geo[0]){
@@ -537,12 +537,12 @@
     }
 }
 
-var stateChange = 0;
+var stateChange = true;
 var autoCompleteStates = null;
 var stateList = [];
 
 function getAssociatedStateList() {
-    if(stateChange == 0) {
+    if (stateChange) {
     new Ajax.Request("getAssociatedStateList",
         { asynchronous: false,
           parameters: $('shippingForm').serialize(),
@@ -552,7 +552,7 @@
           autoCompleteStates = new Autocompleter.Local("shipToStateProvinceGeo", "shipToStates", stateList, {partialSearch: false});
         }
     });
-    stateChange++;
+    stateChange = false;
     }
 }
 
@@ -560,15 +560,15 @@
     geoValues = $('shipToStateProvinceGeo').value.split(': ');
     if(geoValues) {
         $('shipToStateProvinceGeo').value = geoValues[0];
-        if(geoValues[1] == 'undefined' || geoValues[1] == null) {
+        if(geoValues[1] != 'undefined' || geoValues[1] != null) {
             stateList.each(function(state){
                 geo = state.split(': ');
                 if(geoValues[0] == geo[0]){
                     geoValues[1] = geo[1];
                 }
             });
+            $('shipToStateProvinceGeoId').value = geoValues[1];
         }
-        $('shipToStateProvinceGeoId').value = geoValues[1];
     }
 }
 
@@ -584,7 +584,11 @@
             geoVolues = state.split(': ');
             optionList.push("<option value = " + geoVolues[1] + " >"+geoVolues[0]+"</option>");
           });
-          $('billToStateProvinceGeoId').innerHTML = optionList;
+          $('billToStateProvinceGeoId').update(optionList);
         }
     });
+}
+// This way associated state list will be fetched only when a user do any changes to country
+function isCountryChanged() {
+    stateChange = true;
 }
\ No newline at end of file