Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State Selector vs Text Entry #1197

Closed
bhsmither opened this issue Aug 11, 2016 · 14 comments
Closed

State Selector vs Text Entry #1197

bhsmither opened this issue Aug 11, 2016 · 14 comments
Assignees
Labels
Milestone

Comments

@bhsmither
Copy link
Contributor

bhsmither commented Aug 11, 2016

When the browser javascript has been disabled or crashed, all skins are still (mostly) fully functional. allowing the customer to be able to submit a value for State/County that is either empty or spelled incorrectly.

With regards to Issues #1080, #931, #871, and #817, suggest that server-side checking include matching the supplied State to the supplied Country. Do more than simply checking for emptiness. If the supplied State cannot be found as a known abbrev for the country_id given, then bounce with error message.

The value from the function state_json() may useful, but may need enhancing to include the abbrev as well.

With many other CC6 functions and features (module zone limits, taxation, basket contents passed to shipping, etc) relying on having the state's id, aggressively making sure that the id is available and used is important.

https://forums.cubecart.com/topic/51577-customer-able-to-bypass-state-dropdown-box-usa/

@jasehead
Copy link

I'd like the test to apply to existing customer states too, not just new customers. Still getting '0' as a state value on some orders from v3 customers in an upgraded v6 store.

@bhsmither
Copy link
Contributor Author

bhsmither commented Aug 30, 2016

Please take a look at:
http://www.cubecartforums.org/index.php?showtopic=18320

This (if I recall, it is a plugin) was written for CC5, but should also work for CC6. It affects the Addressbook, not existing Orders.

@bhsmither
Copy link
Contributor Author

bhsmither commented Aug 30, 2016

CC6012 does have an upgrade script applied against the addressbook that is run during the upgrading process. This attempts to change abbreviations (such as IL or Wa) and full names (such as Illinois or Washington) to the state ident number.

But it will not find deviations - such as Wash.D.C, or Calif, or Ill. or all caps like IOWA.

@jasehead
Copy link

The upgrade script may not apply for other state abbreviations in other countries eg. Australia

@bhsmither
Copy link
Contributor Author

It will work provided that the exact name or exact abbreviation can be found in CubeCart_geo_zone, such as Australian Capital Territory or ACT (as opposed to any deviation, like AusCapTer).

@jasehead
Copy link

No, it didn't work in more than one upgrade from v3.0.17 to v6.0.12 - I had LOTS of admin edited Australian states with 2-3 letter abbreviations that carried over into v6 OK, but in the order overview for new orders those abbreviated states were shown as a zero and the states in billing and delivery had to be reset manually.

Which is why I suggest that if an existing customer makes a new order, that the state be rechecked at that point and the State ID updated if necessary (or the existing customer asked to check and update their address).

Like you said, aggressively making sure that the ID is available and used is important - so why not error check existing addresses as well as new ones?

@bhsmither
Copy link
Contributor Author

In that customer's address book, what is the Australian state that appeared as a zero in the Order Summary of a new order?

@jasehead
Copy link

It can be any state. I've had VIC and NSW both change to zero (and one WA for Western Australia change to Washington, which shouldn't happen).

The address from v3 gets carried across to v6 and the state remains as an abbreviation - there doesn't seem to be any mapping to state IDs for Australian states that were in v3 as standard abbreviations. The customer can place their order and the state abbreviation still appears (as a custom text value) in the order UNTIL there is an admin change to the order - like deleting credit card details for example. That is when the state gets changed to a zero value.

Sorry to drag this away from the store skin to the admin skin, but it still something that requires an error check and update for state ID - so perhaps any fix should broadly address how state ID is used throughout cubecart, from both customer and admin sides.

BTW - thank you for the CC5 plugin - hopefully that will fix any future issues.

@bhsmither
Copy link
Contributor Author

There are 16 collisions in the CubeCart_geo_zone table, and the upgrade script doesn't scan that deeply to reconcile those collisions. (Hint: @abrookbanks)

@abrookbanks
Copy link
Member

@bhsmither

There are 16 collisions in the CubeCart_geo_zone table, and the upgrade script doesn't scan that deeply to reconcile those collisions.

To save me time can you explain what you mean by a collision?

@abrookbanks
Copy link
Member

Closed by accident! Ha. Whoops.

@abrookbanks
Copy link
Member

I don't see how it is possible to make any changes here without human filtering?

@bhsmither
Copy link
Contributor Author

A collision is where CubeCart_geo_zone.abbrev has the same content for more than one record.

The upgrade script /setup/scripts/upgrade/6.0.12.php deals only with the first record in the result.

The script should:

  • not limit it's first test using strlen(). Doing so misses many hits in non-US countries.
  • JOIN with CubeCart_geo_country ON country_id so that specificity is increased.

@abrookbanks
Copy link
Member

Gotcha. Thanks for the clarification.

@abrookbanks abrookbanks added the bug label Sep 7, 2016
@abrookbanks abrookbanks added this to the 6.1.0 milestone Sep 7, 2016
@abrookbanks abrookbanks self-assigned this Sep 7, 2016
abrookbanks pushed a commit that referenced this issue Sep 7, 2016
abrookbanks pushed a commit that referenced this issue Sep 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants