Active
Project:
e-Commerce
Version:
5.x-3.x-dev
Component:
address
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Nov 2008 at 01:05 UTC
Updated:
24 Jan 2009 at 22:04 UTC
Having set my default store location (admin/ecsettings/location) to Canada, when shoppers add an address (user/37/address/add?destination=cart/checkout) and choose their Country as "United States" -> the State drop down select has no values - only "Please choose..." is available.
When I set my default store location to USA, shoppers can choose Canada as an address book Country (and the Province/State resets nicely), or they can choose USA as the destination... and (super dupes) they get to select a State.
Comments
Comment #1
mariuss commentedSame here. I know where the problem is, and a possible workaround, but can't figure what the proper, long term, solution is.
The
address_form_fieldsfunction creates two form elements, one calledstate(type select) and one calledprovince(type textfield). There is JavaScript code inaddress.jsthat shows one or the other based on what country you selected. It seems thatstateshows only for US andprovincefor everything else.Note: the above JavaScript implies that only US can have a dropdown with states, even though in theory you can add states/provinces for any country by creating
store/store_custom.incsimilar tostore/store_locations.inc. Seestore_build_statesinstore.module.Now, the problem is that the state dropdown is built statically when the form is generated by using the default country (aka default store location). When the country is changed from the countries dropdown the list of states is not affected.
The workaround: since the state dropdown is used for US only, I think it is pretty safe to hard code the US country code (that is "us") when the state dropdown is built.
In
address.module, around line 397, change this:to this: