Checkout Errors

Open to all! Ask other shopowners for help.
Post Reply
User avatar
tessthepup
Certified Developer
Posts: 383
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Checkout Errors

Post by tessthepup »

Good Morning,

I have caught a couple of errors in the checkout process and wondered if anyone else has seen this.

I have set Modules>Customer Data>Country to false as I only ship within the UK and this error is thrown going through the checkout_shipping
PHP Notice: Undefined index: country_id in /home/nuvitamins/public_html/checkout_shipping.php on line 23
Also on checkout_payment_address.php this error occurs when you click on the 'Use this address' button and the page does not return to checkout_payment.php but a blank screen.
[13-Mar-2022 11:31:38 Europe/London] PHP Fatal error: Uncaught TypeError: Argument 1 passed to Text::input() must be of the type string, null given, called in /home/nuvitamins/public_html/includes/modules/customer_data/cd_firstname.php on line 102 and defined in /home/nuvitamins/public_html/includes/system/versioned/1.0.8.2/text.php:34
Stack trace:
#0 /home/nuvitamins/public_html/includes/modules/customer_data/cd_firstname.php(102): Text::input(NULL)
#1 /home/nuvitamins/public_html/includes/system/versioned/1.0.5.6/requirements_manager.php(37): cd_firstname->process(Array)
#2 /home/nuvitamins/public_html/includes/system/versioned/1.0.5.6/requirements_manager.php(65): requirements_manager->act_on(Object(cd_firstname), 'process', Array)
#3 /home/nuvitamins/public_html/checkout_payment_address.php(29): requirements_manager->process(Array)
#4 {main}
thrown in /home/nuvitamins/public_html/includes/system/versioned/1.0.8.2/text.php on line 34
Any thoughts?

Thanks

Mark


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Checkout Errors

Post by ecartz »

tessthepup wrote: Sun Mar 13, 2022 11:42 am I have set Modules>Customer Data>Country to false as I only ship within the UK and this error is thrown going through the checkout_shipping
If you set Country to false, you have to replace it, as country is required. You could replace it with something that hard codes the country as 222. But you can't leave it blank.
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Checkout Errors

Post by heatherbell »

tessthepup wrote: Sun Mar 13, 2022 11:42 amas I only ship within the UK
We use this app.php/addons/supporters_code/s03e08_c ... _selector/
User avatar
tessthepup
Certified Developer
Posts: 383
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Checkout Errors

Post by tessthepup »

ecartz wrote: Sun Mar 13, 2022 12:38 pm
tessthepup wrote: Sun Mar 13, 2022 11:42 am I have set Modules>Customer Data>Country to false as I only ship within the UK and this error is thrown going through the checkout_shipping
If you set Country to false, you have to replace it, as country is required. You could replace it with something that hard codes the country as 222. But you can't leave it blank.
Thank you both.

I have enabled the module but removed the ticks from the 'pages' selection so now no errors and no field shows.

Just this error now
[13-Mar-2022 12:53:27 Europe/London] PHP Notice: Undefined index: firstname in /home/nuvitamins/public_html/includes/modules/customer_data/cd_firstname.php on line 102
[13-Mar-2022 12:53:27 Europe/London] PHP Fatal error: Uncaught TypeError: Argument 1 passed to Text::input() must be of the type string, null given, called in /home/nuvitamins/public_html/includes/modules/customer_data/cd_firstname.php on line 102 and defined in /home/nuvitamins/public_html/includes/system/versioned/1.0.8.2/text.php:34
Stack trace:
#0 /home/nuvitamins/public_html/includes/modules/customer_data/cd_firstname.php(102): Text::input(NULL)
#1 /home/nuvitamins/public_html/includes/system/versioned/1.0.5.6/requirements_manager.php(37): cd_firstname->process(Array)
#2 /home/nuvitamins/public_html/includes/system/versioned/1.0.5.6/requirements_manager.php(65): requirements_manager->act_on(Object(cd_firstname), 'process', Array)
#3 /home/nuvitamins/public_html/checkout_payment_address.php(29): requirements_manager->process(Array)
#4 {main}
thrown in /home/nuvitamins/public_html/includes/system/versioned/1.0.8.2/text.php on line 34
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Checkout Errors

Post by ecartz »

On line 102, change it to

Code: Select all

      $customer_details['firstname'] = Text::input($_POST['firstname'] ?? '');
That may just move the notice to a new line. So you may have to make similar changes multiple times.
User avatar
tessthepup
Certified Developer
Posts: 383
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Checkout Errors

Post by tessthepup »

ecartz wrote: Sun Mar 13, 2022 1:00 pm On line 102, change it to

Code: Select all

      $customer_details['firstname'] = Text::input($_POST['firstname'] ?? '');
That may just move the notice to a new line. So you may have to make similar changes multiple times.
Yes you were correct. I had to change the same line in

cd_firstname
cd_lastname
cd_postcode
cd_street_address


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply