I have been seeing the following errors in my Admin error_log:
[14-Sep-2024 21:45:47 America/New_York] PHP Notice: Trying to access array offset on value of type null in /home4/birdonaw/public_html/oscomce/includes/modules/customer_data/cd_traditional_address.php on line 141
[14-Sep-2024 21:45:47 America/New_York] PHP Notice: Trying to access array offset on value of type null in /home4/birdonaw/public_html/oscomce/includes/modules/customer_data/cd_traditional_address.php on line 141
[14-Sep-2024 21:45:47 America/New_York] PHP Notice: Trying to access array offset on value of type null in /home4/birdonaw/public_html/oscomce/includes/modules/customer_data/cd_traditional_address.php on line 141
These errors occur when you display the Order in the admin, and the Country is NULL.
I was hoping Country would not need to be a required field, since I have a small store with only 1 country. I was thinking a better user experience if Country was not required.
I did a little more investigation, and I found if xxx_address_format_id in the Orders table is 0 or NULL, then this error is thrown.
Does anyone know if Country can be optional, or does it have to be a required field? If it can be optional, I would appreciate any thoughts on how to correct this issue.
Error on Admin Orders page if Country is NULL in Customer Data
-
heatherbell
- Senior Contributor
- Posts: 2540
- Joined: Mon Oct 07, 2019 4:39 am
- Phoenix Version:
- Has thanked: 35 times
- Been thanked: 243 times
Re: Error on Admin Orders page if Country is NULL in Customer Data
app.php/addons/supporters_code/s03e08_c ... e_selector
Think this PRO VIP Addon enables 1 Country to be preselected and disables unwanted Countries.
Country is generally required for tax purposes, Payment and Shipping integrations.
- burt
- Core Team
- Posts: 4551
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: Error on Admin Orders page if Country is NULL in Customer Data
You could also simply delete out all the countries you do not need, which would mean leaving just the country/countries you do want to present to customer. EG keep USA/Canada if N.American based. Aus/NZ if Aus based etc.
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.
-
jcarndt
- Member
- Posts: 29
- Joined: Tue Mar 09, 2021 7:12 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 4 times
Re: Error on Admin Orders page if Country is NULL in Customer Data
@burt and @heatherbell Thanks for your thoughts!! They are very helpful.
One other thought, since it appears Country for the store to format the address properly and other store functions, it would be helpful to remove the module option that makes Country optional. It seems like it should be made mandatory to me.
Thanks again!!
One other thought, since it appears Country for the store to format the address properly and other store functions, it would be helpful to remove the module option that makes Country optional. It seems like it should be made mandatory to me.
Thanks again!!
-
heatherbell
- Senior Contributor
- Posts: 2540
- Joined: Mon Oct 07, 2019 4:39 am
- Phoenix Version:
- Has thanked: 35 times
- Been thanked: 243 times
Re: Error on Admin Orders page if Country is NULL in Customer Data
The option to disable or remove might be required by some development.
Users are informed in the User Guide here: https://phoenixcart.org/phoenixcartwiki ... ta_Modules