Database Error On One User Login

Database (error)
Error: Column 'order_id' cannot be null (1048)
Query: REPLACE INTO cscart_user_session_products (`user_id`, `timestamp`, `type`, `user_type`, `item_id`, `item_type`, `product_id`, `amount`, `price`, `session_id`, `ip_address`, `company_id`, `order_id`, `extra`) VALUES (9, 1472735481, 'W', 'R', 86915178, 'P', 30755, 1, '0.00', 'e84bc8e47c02c9e22d4810531d26338d-1-C', '60526d71', 1, NULL, 'a:15:{s:7:\"user_id\";s:1:\"9\";s:9:\"timestamp\";s:10:\"1415816753\";s:4:\"type\";s:1:\"W\";s:9:\"user_type\";s:1:\"R\";s:7:\"item_id\";s:8:\"86915178\";s:9:\"item_type\";s:1:\"P\";s:10:\"product_id\";s:5:\"30755\";s:6:\"amount\";s:1:\"1\";s:5:\"price\";s:4:\"0.00\";s:10:\"session_id\";s:36:\"bda61087088fba9d368c598b3a0c8969_1_C\";s:10:\"ip_address\";s:14:\"65.115.121.182\";s:10:\"company_id\";s:1:\"1\";s:8:\"order_id\";N;s:15:\"product_options\";a:0:{}s:5:\"extra\";a:1:{s:15:\"product_options\";a:0:{}}}

Hello everyone. Please see error above

We have a customer that every time he logs in we get a database error in logs.

He has a we called it shopping list (wish list) setup since he orders a lot of the same product every month. We have removed from our cart some of the items on his list and wonder if that is what is causing the database error.

Thank you

Hello, this error is indicating that order_id is not setting up. So there is the entry of order_id as NuLL. I think this issue is not occurring due to removal of items which are present in his wish list.

Please take a look:

http://forum.cs-cart.com/topic/45641-column-order-id-cannot-be-null-1048/

Thank you guys

Can you tell me what table to change?

Order_Data

or

Order_Details?

Thanks again

Thank you guys
Can you tell me what table to change?
Order_Data
or
Order_Details?
Thanks again

Hello zeero6,



You don’t need to change order_data or order_details table. All you need to check cscart_user_session_products. Check whether order_id has default NULL parameter otherwise correct it.

Thanks but that table does not have order_id. Please see attached

Would I need to add that? And if I need to add is there a sql query I can run?

PS - Added the order_id and still did not work so I removed it.

Thanks

user.jpg

Thanks but that table does not have order_id. Please see attached

Would I need to add that? And if I need to add is there a sql query I can run?

PS - Added the order_id and still did not work so I removed it.

Thanks

Hello,

I think table cscart_user_session_products should have a column with order_id mediumint(8) default NULL .

You can simply alter the table cscart_user_session_products as,

db_query("ALTER TABLE ?:cscart_user_session_products ADD order_id mediumint(8) DEFAULT NULL");

I hope it will solve your problem.

Hello,

I think table cscart_user_session_products should have a column with order_id mediumint( 8) default NULL .

You can simply alter the table cscart_user_session_products as,

db_query("ALTER TABLE ?:cscart_user_session_products ADD order_id mediumint( 8) DEFAULT NULL");

I hope it will solve your problem.

Just small correction. Use

db_query("ALTER TABLE cscart_user_session_products ADD order_id mediumint(8) DEFAULT NULL");

or

db_query("ALTER TABLE ?:user_session_products ADD order_id mediumint(8) DEFAULT NULL");
Database (error)
Error: Column 'order_id' cannot be null (1048)
Query: REPLACE INTO cscart_user_session_products (`user_id`, `timestamp`, `type`, `user_type`, `item_id`, `item_type`, `product_id`, `amount`, `price`, `session_id`, `ip_address`, `company_id`, `order_id`, `extra`) VALUES (9, 1472822221, 'W', 'R', 86915178, 'P', 30755, 1, '0.00', 'da93b46e67f019fd239b3e3daa0b514d-1-C', '60526d71', 1, NULL, 'a:15:{s:7:\"user_id\";s:1:\"9\";s:9:\"timestamp\";s:10:\"1415816753\";s:4:\"type\";s:1:\"W\";s:9:\"user_type\";s:1:\"R\";s:7:\"item_id\";s:8:\"86915178\";s:9:\"item_type\";s:1:\"P\";s:10:\"product_id\";s:5:\"30755\";s:6:\"amount\";s:1:\"1\";s:5:\"price\";s:4:\"0.00\";s:10:\"session_id\";s:36:\"bda61087088fba9d368c598b3a0c8969_1_C\";s:10:\"ip_address\";s:14:\"65.115.121.182\";s:10:\"company_id\";s:1:\"1\";s:8:\"order_id\";N;s:15:\"product_options\";a:0:{}s:5:\"extra\";a:1:{s:15:\"product_options\";a:0:{}}}')

Thank you guys for the help. Still getting the same error

I have added the table

Sorry here is the image

Image1.gif

Thank you all for the help. Had to have CSCart support team fix it.

Their quote:

We were able to reproduce the error with this user and applied the fix in the app/functions/fn.cart.php file to resolve it.

That was all they said.

Thanks again