Author: mor
Date: Sat Jul 12 02:31:40 2008 New Revision: 676138 URL: http://svn.apache.org/viewvc?rev=676138&view=rev Log: Implemented Ajax based feature on Country drop-down field on Step 4 Billing of One Page. Now when a user select a Country from the drop-down field it shows only associated states for this country in State field. Done by Rishi Solanki, Brajesh Patel and reviewed by Sumit Pandit. 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=676138&r1=676137&r2=676138&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js Sat Jul 12 02:31:40 2008 @@ -61,7 +61,8 @@ Event.observe($('editBilling'), 'click', function() { if (isCartStepValidate && isShipStepValidate) { if (validateShipOption.validate()) { - setShippingOption(); + setShippingOption(); + getAssociatedBillingStateList(); displayBillingPanel(); isShipOptionStepValidate = true; } @@ -92,7 +93,10 @@ }); // For Billing Address Same As Shipping - Event.observe('useShippingAddressForBilling', 'click', useShippingAddressForBillingToggel); + Event.observe('useShippingAddressForBilling', 'click', function() { + getAssociatedBillingStateList(); + useShippingAddressForBillingToggle(); + }); // Initiate Observing Edit Cart Events initCartProcessObservers(); @@ -105,6 +109,9 @@ Event.observe($('shipToStateProvinceGeo'), 'focus', getAssociatedStateList); Event.observe($('shipToStateProvinceGeo'), 'blur', splitStateNameFromIds); + + // Get associate states for billing panel + Event.observe($('billToCountryGeoId'), 'change', getAssociatedBillingStateList); }); // Cart @@ -280,17 +287,17 @@ } // Billing -function useShippingAddressForBillingToggel() { - if($('useShippingAddressForBilling').checked) { +function useShippingAddressForBillingToggle() { + $('billToStateProvinceGeoId').value = $F('shipToStateProvinceGeoId'); + if ($('useShippingAddressForBilling').checked) { $('billToAddress1').value = $F('shipToAddress1'); $('billToAddress2').value = $F('shipToAddress2'); $('billToCity').value = $F('shipToCity'); - $('billToStateProvinceGeoId').value = $F('shipToStateProvinceGeoId'); $('billToPostalCode').value = $F('shipToPostalCode'); $('billToCountryGeoId').value = $F('shipToCountryGeoId'); - Effect.BlindUp($('billingAddress'), {duration: 0.5}); + Effect.BlindUp($('billingAddress'), {duration: 0.3}); } else { - Effect.BlindDown($('billingAddress'), {duration: 0.5}); + Effect.BlindDown($('billingAddress'), {duration: 0.3}); } } @@ -549,4 +556,21 @@ } $('shipToStateProvinceGeoId').value = geoValues[1]; } +} + +function getAssociatedBillingStateList() { + var optionList = []; + new Ajax.Request("getAssociatedStateList", + { asynchronous: false, + parameters: $('billingForm').serialize(), + onSuccess: function(transport) { + var data = transport.responseText.evalJSON(true); + stateList = data.stateList; + stateList.each(function(state) { + geoVolues = state.split(': '); + optionList.push("<option value = " + geoVolues[1] + " >"+geoVolues[0]+"</option>"); + }); + $('billToStateProvinceGeoId').innerHTML = 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=676138&r1=676137&r2=676138&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl Sat Jul 12 02:31:40 2008 @@ -604,7 +604,6 @@ <#else> <option value="">${uiLabelMap.PartyNoState}</option> </#if> - ${screens.render("component://common/widget/CommonScreens.xml#states")} </select> </div> </div> |
Free forum by Nabble | Edit this page |