diff --git a/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js b/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js
index 72751bf4df..e94bd4f571 100644
--- a/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js
+++ b/applications/ecommerce/webapp/ecommerce/images/checkoutProcess.js
@@ -61,7 +61,8 @@ Event.observe(window, 'load', function() {
Event.observe($('editBilling'), 'click', function() {
if (isCartStepValidate && isShipStepValidate) {
if (validateShipOption.validate()) {
- setShippingOption();
+ setShippingOption();
+ getAssociatedBillingStateList();
displayBillingPanel();
isShipOptionStepValidate = true;
}
@@ -92,7 +93,10 @@ Event.observe(window, 'load', function() {
});
// 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(window, 'load', function() {
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 @@ function setDataInShippingOptionCompleted() {
}
// 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 @@ function splitStateNameFromIds() {
}
$('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("");
+ });
+ $('billToStateProvinceGeoId').innerHTML = optionList;
+ }
+ });
}
\ No newline at end of file
diff --git a/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl b/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl
index 353ba780e5..7c39534c12 100644
--- a/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl
+++ b/applications/ecommerce/webapp/ecommerce/order/OnePageCheckoutProcess.ftl
@@ -604,7 +604,6 @@ under the License.
<#else>
#if>
- ${screens.render("component://common/widget/CommonScreens.xml#states")}