PrestaShop / PrestaShop

PrestaShop is the universal open-source software platform to build your e-commerce solution.
https://www.prestashop-project.org/
Other
8.11k stars 4.79k forks source link

After upgrade to 1.7.7 clicking on any order in BO result in a symfony error - OrderShippingAddressForViewing construct must be of the type string, null given #22386

Closed mvanas closed 3 years ago

mvanas commented 3 years ago

Describe the bug

After update to 1.7.7. When clicking on an order in BO an error is the following error is received: Type error: Argument 6 passed to PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderShippingAddressForViewing::__construct() must be of the type string, null given, called in /home/clients/de1d841a007f7bf58025eade33ee48e1/sites/dv0.zionburg.ch/src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php on line 269

Expected behavior

When clicking on an order in BO I should see all the order details including ordered products, shipping address, payment info.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Logon to BO
  2. Select orders from the left pane
  3. Click on any order

Screenshots image image

If applicable, add screenshots or screen recordings to help explain your problem.

Additional information

matks commented 3 years ago

A bit similar to https://github.com/PrestaShop/PrestaShop/issues/22215

It looks like you have an address with undefined phone so the Order cannot be displayed

hibatallahAouadni commented 3 years ago

Hello @mvanas

Could you please check if your issue is duplicate to this one #22215 And could you please provide your previous PrestaShop verion.

Thanks!

ryan-wo-3t commented 3 years ago

I also have this issue. Upgrade from PS 1.7.6.5 to 1.7.7.0. Some addresses for some customers produce an error like this where a string is expected but null is given.

I have had some success by printing the invoice, then deleting the customer's address and re creating it.

This issue seems to only affect customers who created accounts that are several years old that were created in much earlier versions of ps... likely 1.6.x.x

hibatallahAouadni commented 3 years ago

Hello @mvanas & @ryan-wo-3t

I didn't manage to reproduce your issue with my shop PS1.7.6.5 upgraded to PS1.7.7.0, see the attached screen record below:

https://drive.google.com/file/d/1-llvr7SrkC0mqNnIHLpA0A5qR5HdrMi9/view

I even edit the customer address and I didn't encounter any problem. Please check and feedback.

Thanks!

AldeaG commented 3 years ago

I´m not a developer, just a plain user of Prestashop. I had Prestashop 1.7.6.3 and just updated to 1.7.7 with 1-click module. I´m getting the same problems when clicking in backoffice orders Captura de pantalla 2020-12-31 a las 11 27 12

sergeksl commented 3 years ago

to reproduce the error, it suffices to create a new customer and in the address not to encode anything in "mobile phone". Version 1.7.7.0 does not support a null in this field.

AldeaG commented 3 years ago

so what is the solution, force to add the mobile phone?

sergeksl commented 3 years ago

yes it is a solution or automatically add a " " in this field

hibatallahAouadni commented 3 years ago

Hello @sergeksl

Thanks for helping @AldeaG :slightly_smiling_face:

to reproduce the error, it suffices to create a new customer and in the address not to encode anything in "mobile phone". Version 1.7.7.0 does not support a null in this field.

I tried creating a new customer with an address without "mobile phone" in BO and FO, and in both I didn't manage to reproduce your issue. Could you please list step by step with every tiny detail to help me reproducing the issue.

Thanks in advance.

neich78 commented 3 years ago

Happened the same to me when update to Prestashop 1.7.70. Now I cannot edit some orders, I get this message:

Captura de pantalla 2021-01-03 a las 21 18 05

AldeaG commented 3 years ago

Check if this helps: https://github.com/PrestaShop/PrestaShop/issues/22215

hibatallahAouadni commented 3 years ago

Hello @neich78

If your issue is similar to this #22611 To be informed when it's fixed, please subscribe to the issue mentioned above.

Thanks!

hibatallahAouadni commented 3 years ago

Hello @mvanas

Could you please check if your issue is similar to this one #22611 Please check and feedback.

Thanks!

hibatallahAouadni commented 3 years ago

Hello @mvanas ,

Since we had no news from you for more than 20 days, I'll close this ticket to avoid cluttering up the backlog. Please note that you can always create a new one if further information pops up.

Thanks!

obeba commented 3 years ago

Hello after a fresh 1.7.7.2 install, import all old order, it's impossible to open old orders.

bug ancienne commande prestashop

The problem is solved when I 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

nikos83 commented 3 years ago

I have the same error after update from 1.7.5 to 1.7.7.2 image Is that can be fixed by modify something in db ? From where this $item['employee_lastname'] come from in db? Comment on this @obeba suggested helped but is it right solution for this?

critiks commented 3 years ago

This error happen when you change your configuration in the admin for country, deliveries, zones. This new configuration modify your adress id et country id. So, all adresses and customers bills appears in error. Solution is to : delete wrong adresses in Admin > Customer > adress to regenerate them next time with good one IDs.

nikos83 commented 3 years ago

In my case it looks like is related to the employee - assigned to the status change on order status change history. I have deleted some employee in the past. After dig in database I can see employee -with id 1 was assigned to the status change my order - but there is no employee with ID 1 it was deleted long time ago. Is there any other way to fix that issue?

abcreationIT commented 3 years ago

Already present in PrestaShop 1.7.7.4

Some fix???

jatniel commented 3 years ago

Hi, I have the same problem, in Prestashop 1.7.7.4

Capture d’écran de 2021-06-14 16-13-23

jatniel commented 3 years ago

This error happen when you change your configuration in the admin for country, deliveries, zones. This new configuration modify your adress id et country id. So, all adresses and customers bills appears in error. Solution is to : delete wrong adresses in Admin > Customer > adress to regenerate them next time with good one IDs.

I tested your idea, but it doesn't work!

Achille616 commented 2 years ago

I solved it by going to Customers>Addresses> and select the customer name you are having the problem with from the address list, then select the three dots and "delete" deleting the address. Then go into Customers and enter the customer that was giving you problems, scroll down and click + to add an address. In the form enter all the data, including phone and cell phone (maybe repeat the landline twice) and save it. Now try to see his order and you'll see that he won't give you any more problems :)

Italian lenguage:
Ho risolto, andando in Clienti>Indirizzi> e seleziona il nome cliente con cui si riscontra il problema dall'elenco degli indirizzi, poi seleziona i tre puntini e "elimina" cancellando l'indirizzo. Poi vai in Clienti e entra nel cliente che ti dava problemi, scorri verso il basso e fai clic su + per aggiungere un indirizzo. Nel modulo inserisci tutti i dati, compreso il telefono e il cellulare (magari ripeti due volte il numero fisso) e salva il tutto. Ora prova a vedere il suo ordine e vedrai che non ti darà più problemi :)

Davidorul commented 2 years ago

Yeah. Everyone has his own workarounds or SQL hotfixes to address these issues.

Why does nobody suggest fixing the code ?

Rogerfog commented 2 years ago

In my case it was an automatic order status issue. I found that when migrating from 1.6 to 1.7, within ps_order_history one of the states (id_order_state) had ID 0. I changed the ID for all orders that failed from phpMyAdmin and now they all work.

Gaja-A commented 7 months ago

Hi,

I have the same problem in PS version 8.1.2

image

Any solution ?

Regards, Gaja

procent85 commented 6 months ago

Hello, I have the same problem in 8.1.4 only if I have Memcached (Memcached via PHP::Memcached) turned on and connected to the server.