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

find zone id from state where addressbook is broken #6073

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

zcwilt
Copy link
Member

@zcwilt zcwilt commented Dec 4, 2023

Note from @scottcwilson - please note this is a confirmed bug found during the investigation of #6008.

@zcwilt
Copy link
Member Author

zcwilt commented Dec 4, 2023

Note: this seems to work where there shipping tax is not set to store.
needs more work to cover that

@zcwilt
Copy link
Member Author

zcwilt commented Dec 5, 2023

updated to fix shipping tax where zone id = 0
Still needs a few more tests to cover tax basis = store

@dbltoe
Copy link
Contributor

dbltoe commented Dec 6, 2023

As stated on the forum, we do not use a dropdown for state in the registration form.
Also, there are no entry_zone_id entries that are 0 except where the country has no states. Then, the 0 is as it should be, correct?

@zcwilt
Copy link
Member Author

zcwilt commented Dec 6, 2023

@dbltoe On A clean install of Zencart, if I create a customer account in store then it doesn't set the address book entry_zone_id, regardless of whether zones exist or not.

@zcwilt
Copy link
Member Author

zcwilt commented Dec 6, 2023

@dbltoe as per my post on the thread. Contact me directly at ian@zen-cart.com to see if I can help more directly with your problem

@zcwilt
Copy link
Member Author

zcwilt commented Dec 7, 2023

A bit more context.
V1.5.8a does not honor the ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN setting if the store has zones based on the country id and on submission to create account will produce a ENTRY_STATE_ERROR_SELECT error

This was fixed at e3c022f
in the v158 branch

however the problem then becomes that with a State text entry the address_book entry_zone_id will be set to zero as create account does not try and match the entered state to a zone.

@lat9 does have a PR that might address this . #6020

However this still doesn't address a more basic problem.

While we can fix code to store a correct entry_zone_id in the address book, there is the possibility that zone information may be removed and rebuilt by the store owner. Relying on the entry-zone_id becomes problematic.

In the order class we already try and account for this.

in the query method we do

    $this->customer['zone_id'] = $this->getCountryZoneId((int)$this->customer['country'], $this->customer['state']);
    $this->delivery['zone_id'] = $this->getCountryZoneId((int)$this->delivery['country']['id'], $this->delivery['state']);
    $this->billing['zone_id'] = $this->getCountryZoneId((int)$this->billing['country'], $this->billing['state']);

and don't rely on the entry_zone_id

It therefore makes sense that cart calculations in checkout do the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants