Jump to content

GetOrderForViewingHandler.php Error


SCUK

Recommended Posts

Hi All,

This is my first post so apologies if I miss something.

I have a new install of Prestashop 1.7.7.0

PHP version: 7.2.34

MySQL version: 5.7.20

I am using the bootstrap theme "Classic Version 1.0.0" as i expected this to be the most stable.

I have created a single product for testing.

I have installed the Prestashop Checkout module and setup a paypal account too for processing payments.

I created a new customer. I then bought 1 of the product's that i have created. It is a virtual product (software). I paid using paypal. OBSERVATION: When making the payment, prestashop just seemed to hang with a box in the centre of the screen with multiple dots scrolling across the middle as if to say "Please wait", this did not disappear which concerns me.

I then received an email confirming payment to my customer email account.

In the backoffice the order list shows the order. The status shows a strange purple blob instead of a valid payment processing or Paid status. then if I click on the order it takes for ages then when it does load it displays the error as per the attached image.

I have debug mode enabled which is why i have the image as displayed.

Cheers

M@

SCUK

 

 

fatal error thrown by prestashop redacted.jpg

order list with abnormal status.JPG

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...
On 3/23/2021 at 11:10 AM, nikos83 said:

Hi, I have the same error after upgrade from 1.7.5 to 1.7.7.2 
It looks like we have null on somewhere here 
image.png.7a8e6243ebe8577ceb6f2802fb06654b.png

 

But where that info could be in database anyone know?

Hello did you find answer?

Link to comment
Share on other sites

There's reported issue 

https://github.com/PrestaShop/PrestaShop/issues/22386

you can 
comment 
 

foreach ($history as $item) {
$statuses[] = new OrderStatusForViewing(
(int) $item['id_order_history'],
(int) $item['id_order_state'],
$item['ostate_name'],
$item['color'],
new DateTimeImmutable($item['date_add']),
(bool) $item['send_email'],
$item['employee_firstname'],
$item['employee_lastname']
);
}

in /public_html/src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php

But then you'll lost all the status changes history. I've read about this and in my case some of the orders and status changes are assigned to the user - who was deleted and its name last name are null - I was thinking about to put there some if statement but not done yet.

Link to comment
Share on other sites

17 hours ago, nikos83 said:

There's reported issue 

https://github.com/PrestaShop/PrestaShop/issues/22386

you can 
comment 
 

foreach ($history as $item) {
$statuses[] = new OrderStatusForViewing(
(int) $item['id_order_history'],
(int) $item['id_order_state'],
$item['ostate_name'],
$item['color'],
new DateTimeImmutable($item['date_add']),
(bool) $item['send_email'],
$item['employee_firstname'],
$item['employee_lastname']
);
}

in /public_html/src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php

But then you'll lost all the status changes history. I've read about this and in my case some of the orders and status changes are assigned to the user - who was deleted and its name last name are null - I was thinking about to put there some if statement but not done yet.

Please let me know if you find answer how to fix this in database and I let know for you if I find something

Edited by kaleske (see edit history)
Link to comment
Share on other sites

19 hours ago, nikos83 said:

There's reported issue 

https://github.com/PrestaShop/PrestaShop/issues/22386

you can 
comment 
 

foreach ($history as $item) {
$statuses[] = new OrderStatusForViewing(
(int) $item['id_order_history'],
(int) $item['id_order_state'],
$item['ostate_name'],
$item['color'],
new DateTimeImmutable($item['date_add']),
(bool) $item['send_email'],
$item['employee_firstname'],
$item['employee_lastname']
);
}

in /public_html/src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php

But then you'll lost all the status changes history. I've read about this and in my case some of the orders and status changes are assigned to the user - who was deleted and its name last name are null - I was thinking about to put there some if statement but not done yet.

Here is my sql query:

UPDATE ps_order_history SET id_employee = '1' WHERE id_employee = '0'
UPDATE ps_order_history SET id_order_state = '50' WHERE id_order_state = '31';
UPDATE ps_order_history SET id_order_state = '50' WHERE id_order_state = '32';
UPDATE ps_order_history SET id_order_state = '50' WHERE id_order_state = '33';

 

order state 50 I created my self in prestashop.

Edited by kaleske (see edit history)
Link to comment
Share on other sites

Hi @kaleske 
I think id_employee = 0 is selected to the automatic changes status. For example when you create new order and select bank wire then your status will be awaiting for transfer. And no one from employee should be assigned to this change - it happened after order is placed.

Example: 

image.thumb.png.e2790db40fbccafe3bb1286d2a2f3911.png

 

And in the database: 

image.png.4f3f1425c7325f6b45a3a012bd4dd767.png

Above examples are in fresh Presta installation where I have done some tests - and there is no problem. 
My problem is with other installation where id_employee = 1 and employee with this id been deleted long time ago before. We didn't have this problem on Prestashop 1.7.5 but after upgrade - now we have.

Maybe the solution will be as you mention update database and replace id_employee = 1 (in my case this employee not exist any more) to the one of existing employee. 
 
 

Edited by nikos83 (see edit history)
Link to comment
Share on other sites

12 hours ago, nikos83 said:

Hi @kaleske 
I think id_employee = 0 is selected to the automatic changes status. For example when you create new order and select bank wire then your status will be awaiting for transfer. And no one from employee should be assigned to this change - it happened after order is placed.

Example: 

image.thumb.png.e2790db40fbccafe3bb1286d2a2f3911.png

 

And in the database: 

image.png.4f3f1425c7325f6b45a3a012bd4dd767.png

Above examples are in fresh Presta installation where I have done some tests - and there is no problem. 
My problem is with other installation where id_employee = 1 and employee with this id been deleted long time ago before. We didn't have this problem on Prestashop 1.7.5 but after upgrade - now we have.

Maybe the solution will be as you mention update database and replace id_employee = 1 (in my case this employee not exist any more) to the one of existing employee. 
 
 

You are right 0 might be auto first state. My problem was with deleted employees and deleted id order states that those ID did not exist anymore I had to change them and now everything fine

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...