State/Zone field is required when Not applicable.

Posts: 8
Joined: 01/02/2008

OK, this could be another bug or something. When a user
selects a country eg. Singapore, it shows the state as
being "Not applicable." Yep, alls good there cept..

When they click Review order, its asking for
"State/Zone field is required."

Not applicable yet required? Eh :|

Posts: 1293
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

You can make State not required. Not the best solution but it works..

admin/store/settings/checkout/edit/fields

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Good point... not really sure what to say here. Do what tP recommends and I'll put it on the todo list of things to fix come beta. Eye-wink

Posts: 8
Joined: 01/02/2008

Yep thanks, unchecked the Required for the State/Zone. It will have to do.

Well, pleasure to lend a hand in finding those small errors.
All the best with the continual development. Ubercart definitely justifies its name.

Posts: 301
Joined: 11/19/2007
Bug FinderGetting busy with the Ubercode.

Is there a reason to make the field disabled whenever there are no zones and Not Applicable shows as the only choice? I removed the code that disables the field and everything seems to move through the system ok with -1 being stored for the zone code. Attached is a diff that does that (along with take out some whitespace in the code), but my test cases are pretty limited so I'm not sure if this would create other problems.

AttachmentSize
store_zone_disabled.diff5.45 KB
Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Disabling it is really just a design decision so that customers don't see the N/A message and still click on it. I decided instead to just trick the forms API during the validation process to make that field not required for validation purposes, and it appears to work great. I added these lines after line 242 and the corresponding bit for the billing pane:

<?php
 
if (isset($_POST['panes']) && count($contents['delivery_zone']['#options']) == 1) {
   
$contents['delivery_zone']['#required'] = FALSE;
  }
?>

Posts: 301
Joined: 11/19/2007
Bug FinderGetting busy with the Ubercode.

That's a nifty trick. Form validation in Drupal still confuses me fairly often, but seeing the placement of that clears a small part of it up for me.

Posts: 57
Joined: 10/07/2007

Ryan wrote:
<?php
 
if (isset($_POST['panes']) && count($contents['delivery_zone']['#options']) == 1) {
   
$contents['delivery_zone']['#required'] = FALSE;
  }
?>

Great stuff.

I just noticed this for New Zealand, and Singapore...

Where would I make these changes please?

Posts: 10
Joined: 01/03/2008

I am not too sure what zone is but I am assuming its like county in the UK. However when I select surrey(in zone) I get SRY rather then Surrey. And its on the same line as the postcode. It might be an option when UK is selected the right settings are made.

BTW Ubercart... I think you guys have got something cool here. I really think it will be big!

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

72dpi wrote:

Where would I make these changes please?

After line 242 in uc_cart_checkout_pane.inc, but these fixes are in the latest releases.

Posts: 163
Joined: 08/07/2007
Uber DonorBug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Not Kulvik

Just to be a pest, I'll put in my bid to have that logic branch assert a textbox so user can type in a Province name of their own. My marketing director wants that feature badly enough to offer a bounty on it's head Smiling

Posts: 10
Joined: 03/19/2008

Sorry to drag up an old topic here but....
Im struggling with a small problem here:

I live in South Africa so our definition of a zone would be province. The .cif is loaded for SA and the 'Zone' has been renamed to 'Province'. When the customer gets to the point where they need to fill in details for delivery address, Province/Zone is greyed out and unselectable. Only once the customer has clicked 'Review Order', they are told 'An illegal choice has been detected.' and the Province combo box is now highlighted in red and selectable.

I thought that perhaps this could be an issue with the South African .cif file so i disabled it and tried out Germany's. Same result. There is another way i discovered to sort of get past this issue and thats load another .cif file but even when I do that (which I dont because I'm not ready to ship to surrounding countries as yet), the user still needs to drop down the combo box and select South Africa (although it is selected by default) to make the Province combo box selectable.

If you wanna have a look yourself: http://www.stormsolutions.co.za/cctv. Guest checkout is enabled.

Thanks in advance and a huge thank you to Ubercart developers for what you have done here Smiling.

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Hmm... are you running the latest version of Ubercart? I was pretty sure I squashed this one, though it could always be related to your default store country. Check your store's address settings at /admin/store/settings/store/edit.

Posts: 10
Joined: 03/19/2008

Im actually not running the latest. Im running 5.7. Sorry I didnt mention this earlier.
I thought about updating but I havent come across any reason to until now. I was hoping I was just being stupid and missing something obvious. Ill update tomorrow and let you know.

Thanks Ryan,
Michael

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

No worries... actually, 5.7 is the latest Drupal version. I'm curious about your Ubercart version. We're up to 1.0 beta 7 now. If you're not on beta 7, then you may should look into updating, but just do Ubercart (and not Drupal 6 - Ubercart doesn't support this yet).

Posts: 10
Joined: 03/19/2008

aha! Ok! That makes sense!

Ubercart version is 5.x-1.0-beta4. Will update Ubercart instead then Laughing out loud

Posts: 10
Joined: 03/19/2008

Updated to beta 7. Zone combo box is still not selectable Sad

Posts: 14
Joined: 03/05/2008

Same problem here, with United Kingdom. Zone field says "Not applicable" until I click "Review order".
Ubercart version is 1.0 beta 7

i haven't got this problem in beta 6.
Eye-wink

Posts: 10
Joined: 03/19/2008

egyember wrote:
Same problem here, with United Kingdom. Zone field says "Not applicable" until I click "Review order".
Ubercart version is 1.0 beta 7

i haven't got this problem in beta 6.
Eye-wink

Exactly Smiling Glad its not just me Sticking out tongue

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Interesting... did you double check your store country in the contact settings?

Posts: 10
Joined: 03/19/2008

Ryan wrote:
Interesting... did you double check your store country in the contact settings?

Sure did...Country says South Africa and is selectable but Province/Zone says 'Not applicable' and is greyed out just like it is on the checkout page

Posts: 14
Joined: 03/05/2008

step by step to the problem:

(with Canada + US already installed)
import United Kingdom
remove Canada
remove US

Zone field is blank.

another bug:

above steps+
import US (again)
- Zones are working ok.

BUT if I disable US (not remove)
Country will show "United Kingdom" but Zone has all the US states in the dropdown menu.

update:
this behavior will stop if i go to Store settings and on the Contact settings page press Save.
(obviously the only country is UK)

(beta 7)

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Hmm... yeah, this issue was raised before of finding a better way to establish the default country. I'd like to see what would happen for Dogmatix to go submit that page even if he doesn't change anything. That may solve the problem...

Posts: 10
Joined: 03/19/2008

Haha! Fixed!

I pretty much followed what egyember did and its now working just fine!
I did however go a step further and small things like this irritate me. I removed US from the country list.

I have a suspision that not all of the above steps are required to fixed the problem.
Egyember, did you at any point go to admin/store/settings/store/edit and just press 'Save configuration' without changing anything? I didnt :S Perhaps thats all that was required?

Thanks guys! Your input is greatly appreciated.

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Glad it's working. I actually added a default store country function that I didn't get a chance to commit before leaving work. It'll be in core tomorrow morning.

No one else should have this problem from now on. Smiling

Posts: 14
Joined: 03/05/2008

sorry, those steps were just to show how i got to the bug.
the fix is pretty much just 'Save configuration' at least 1 time after you installed the shop and seleted a different country.
Smiling

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Well, I'm committing a change as I type that should prevent this from happening in the future. If the variable that stores the default store country references a country that's no longer in the database, it will grab the first available country ID or simply return 0.

Posts: 14
Joined: 03/05/2008

thank you Ryan! we all appreciate your help.

Posts: 1
Joined: 03/25/2008

We are running Beta7 and are testing the checkout process. I have tried removing US and Canada, adding other countries but the zone is always disabled. Its like no data is getting loaded for the zone. Something get dropped in beta7?

Update from our log:
2008-03-25 16:25:24 CDT drupal drupal ERROR: syntax error at or near "," at character 65

when attempting to import the country cif file.