Error checking out on checkout_confirmation.php

Open to all! Ask other shopowners for help.
Post Reply
gsmiley007
Member
Posts: 82
Joined: Sun Mar 14, 2021 9:28 pm
Phoenix Version:
Has thanked: 9 times
Been thanked: 2 times

Error checking out on checkout_confirmation.php

Post by gsmiley007 »

While in checkout, after I click Finalize and Pay for my order. i get
PHOENIX_FATAL on the checkout_process.php

This what I found in my logs. Actual values replaced with dummy ones.

[31-Jul-2023 00:47:14 America/Toronto] PHP Warning: DB: [1054] Unknown column 'customers_country_id' in 'field list' from <INSERT INTO orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_country_id, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_country_id, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_country_id, billing_address_format_id, payment_method, date_purchased, orders_status, currency, currency_value, discount_codes) VALUES ('1', 'Test Test', '', 'Test', '', 'City', 'Postal Code', 'Province', 'Country', '38', '', 'email', '1', 'Test Test', '', 'Test', '', 'City', 'Postal', 'Province', 'Country', '38', '1', 'Test Test' in /public_html/phoenix/includes/system/versioned/1.0.8.1/database_core.php on line 44


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: Error checking out on checkout_confirmation.php

Post by Kofod95 »

Is that a shop that uses an old database? I think the field 'customers_country_id', as well as 'delivery_country_id' and 'billing_country_id', was added rather recently.

To fix it, you should add those three fields in the database - if you have updated the store, you might have missed an sql to run, but if you use an old database-structure, there might be more things to look out for.

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
gsmiley007
Member
Posts: 82
Joined: Sun Mar 14, 2021 9:28 pm
Phoenix Version:
Has thanked: 9 times
Been thanked: 2 times

Re: Error checking out on checkout_confirmation.php

Post by gsmiley007 »

It was a brand new install into a empty database for 1.8.0.20
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: Error checking out on checkout_confirmation.php

Post by Kofod95 »

https://github.com/CE-PhoenixCart/Phoen ... x.sql#L321

The error say that that column is not in the db. I think it's unlikely, that only one or a few columns are not created when installing - especially columns in the middle of it all, and I don't think you could have gotten to the checkout-procedure if the rest of the columns and tables were missing.
I could, of course, be wrong, and you have an error that should be solved.
If you haven't made any configurations yet, I would run the entire phoenix.sql in phpMyAdmin to make sure nothing is missing. If you have started making configurations, then just copy the orders-part and run that and see if that is everything.

Still, I would recommend you to double-check that the shop and the database are in fact clean and that the shop is pointing to the right database, so you don't accidentally make changes to one that has data you want to keep.
This particular column wasn't in earlier versions, so it is plausible that the database structure is from an earlier version, but that shouldn't be the case with a new install on an empty database. That is why I recommend that you make sure that the database the shop uses is in fact a freshly installed one.

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
User avatar
burt
Core Team
Posts: 4546
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Error checking out on checkout_confirmation.php

Post by burt »

This was changed in March 2021, for version 1.0.8.1
You therefore appear to be using an older database, not updated.

Perhaps your new install of 1.0.8.20 is pointing at a 1.0.8.0 (or older) database.
I am not here to build for you.
I am here to build with you. Let's help each other.
gsmiley007
Member
Posts: 82
Joined: Sun Mar 14, 2021 9:28 pm
Phoenix Version:
Has thanked: 9 times
Been thanked: 2 times

Re: Error checking out on checkout_confirmation.php

Post by gsmiley007 »

I ran the phoenix.sql and it kill everything in my db lol. So i had to start all over.

I think I have figured out the issue. I have all my data from an older version of phoenix an I was using sqldump. I just looked at the orders.sql that I dumped.

DROP TABLE IF EXISTS `orders`;
then it creates the table, so of course its the old version of the table. I guess i'll have to figure out some flags to not have it drop and recreate the database when I backup my orders from my older site.

Thanks for your tips and help.
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: Error checking out on checkout_confirmation.php

Post by Kofod95 »

gsmiley007 wrote: Mon Jul 31, 2023 11:58 pm I ran the phoenix.sql and it kill everything in my db lol. So i had to start all over.
That sucks, but was why we warned about it - the best learning probably comes from making the mistakes ;)
I hope you have your data backed-up!?
gsmiley007 wrote: Mon Jul 31, 2023 11:58 pm I was using sqldump.
That does explain your issue. You probably didn't know, but a truly clean database is one unchanged after install. Had you told that you had installed and then used an sql-dump to add old data, we might have been able to solve it quicker. This is not a pointing finger, just me trying to be helpful, so you can get better help faster in the future. There's a post describing the information that is required for people to help as good as possible - viewtopic.php?f=10&t=27
gsmiley007 wrote: Mon Jul 31, 2023 11:58 pm I guess i'll have to figure out some flags to not have it drop and recreate the database when I backup my orders from my older site.
There are many ways to do this. The easiest might be to find all sql-files in the updates, and just update a copy of the old database. That, of course, depends on how big a jump in versions it is.
When creating an sql-dump you might also be able to just extract the data, and not the structure. Otherwise, you can edit the sql-files with the dump to make sure it fits.

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
gsmiley007
Member
Posts: 82
Joined: Sun Mar 14, 2021 9:28 pm
Phoenix Version:
Has thanked: 9 times
Been thanked: 2 times

Re: Error checking out on checkout_confirmation.php

Post by gsmiley007 »

I would have mentioned sqldump, but i didn't know it dropped and recreated the tables. It clicked in once you guys mentioned about the older database version.

Not sure if this is good, but i basically dumped the old orders table. Restored it in the new version. then ran this:

ALTER TABLE orders
ADD COLUMN customers_country_id int(11) NOT NULL AFTER customers_country,
ADD COLUMN delivery_country_id int(11) NOT NULL AFTER delivery_country;
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: Error checking out on checkout_confirmation.php

Post by Kofod95 »

gsmiley007 wrote: Fri Aug 04, 2023 2:43 pm I would have mentioned sqldump, but i didn't know it dropped and recreated the tables. It clicked in once you guys mentioned about the older database version.
No worries - what really matters is that you found out!
gsmiley007 wrote: Fri Aug 04, 2023 2:43 pm Not sure if this is good, but i basically dumped the old orders table. Restored it in the new version. then ran this:

ALTER TABLE orders
ADD COLUMN customers_country_id int(11) NOT NULL AFTER customers_country,
ADD COLUMN delivery_country_id int(11) NOT NULL AFTER delivery_country;
I think you need to add one more for billing_country_id, otherwise, that seems ok. Review the structure and make sure for safety. I don't know which version you come from, and I don't remember if things have been added to that table before.
Also, have a look at what other of the tables you want to copy from the old database into the new have been altered in structure during updates. The easiest way to do it, is probably to view a comparison of the install sql of the version you come from and the install sql (install/phoenix.sql) of 1.0.8.20.

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
nehakakar
Posts: 3
Joined: Tue Jul 04, 2023 12:40 pm
Phoenix Version:
Has thanked: 1 time

Re: Error checking out on checkout_confirmation.php

Post by nehakakar »

Compare the column names and their order in the INSERT INTO orders query with the actual structure of the orders table in your database. Check the column names and their sequence match.
The column customers_country_id indeed exists in the orders table. If it doesn't exist, you need to determine whether the column is supposed to be there. If it should be there, you might need to modify the table structure. See the detail here.


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