Jump to content

Cannot open new orders after migration from 1.6 to 1.7


tim1983

Recommended Posts

Hello 

Help would be very much appreciated

I migrated from presta 1.6 to 1.7 using the migration module transferring data and orders. I can access old orders but not orders since doing the new website

 

Type error: Argument 3 passed to PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderStatusForViewing::__construct() must be of the type string, null given, called in /home/customer/www/sasautocustoms.co.uk/public_html/src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php on line 366

[Symfony\Component\Debug\Exception\FatalThrowableError 0]

Link to comment
Share on other sites

Run this query and you will be fine 😉

# Crezzur - Fix for: 
# Error: Argument 4 passed to PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderCustomerForViewing::__construct()
# must be of the type string, null given, called in ../src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php on line 236
# -----

UPDATE ps_address SET phone = '' WHERE phone IS NULL;
UPDATE ps_address SET phone_mobile = '' WHERE phone_mobile IS NULL;

UPDATE ps_order_detail SET id_order_invoice = '0' WHERE id_order_invoice IS NULL;
UPDATE ps_order_detail SET product_reference = '' WHERE product_reference IS NULL;
UPDATE ps_order_detail SET product_supplier_reference = '' WHERE product_supplier_reference IS NULL;
UPDATE ps_order_detail SET product_isbn = '' WHERE product_isbn IS NULL;
UPDATE ps_order_detail SET product_upc = '' WHERE product_upc IS NULL;
UPDATE ps_order_detail SET product_mpn = '' WHERE product_mpn IS NULL;
UPDATE ps_order_detail SET download_hash = '' WHERE download_hash IS NULL;
UPDATE ps_orders SET gift_message = '' WHERE gift_message IS NULL;

UPDATE ps_order_payment SET transaction_id = '' WHERE transaction_id IS NULL;
UPDATE ps_order_payment SET card_number = '' WHERE card_number IS NULL;
UPDATE ps_order_payment SET card_brand = '' WHERE card_brand IS NULL;
UPDATE ps_order_payment SET card_expiration = '' WHERE card_expiration IS NULL;
UPDATE ps_order_payment SET card_holder = '' WHERE card_holder IS NULL;

UPDATE ps_order_carrier SET tracking_number = '' WHERE tracking_number IS NULL;
UPDATE ps_order_carrier SET id_order_invoice = '0' WHERE id_order_invoice IS NULL;
UPDATE ps_order_carrier SET weight = '0' WHERE weight IS NULL;

UPDATE ps_product SET isbn = '' WHERE isbn IS NULL;
UPDATE ps_product SET upc = '' WHERE upc IS NULL;
UPDATE ps_product SET mpn = '' WHERE mpn IS NULL;
UPDATE ps_product SET unity = '' WHERE unity IS NULL;
UPDATE ps_product SET supplier_reference = '' WHERE supplier_reference IS NULL;
UPDATE ps_product SET location = '' WHERE location IS NULL;
UPDATE ps_product SET redirect_type = '301-category' WHERE redirect_type = '';
UPDATE ps_product SET available_date = '2020-12-01' WHERE available_date IS NULL;
UPDATE ps_product SET cache_default_attribute = '0' WHERE cache_default_attribute IS NULL;
UPDATE ps_product_shop SET unity = '' WHERE unity IS NULL;
UPDATE ps_product_shop SET redirect_type = '301-product' WHERE redirect_type = '';
UPDATE ps_product_shop SET available_date = '2020-12-01' WHERE available_date IS NULL;
UPDATE ps_product_shop SET cache_default_attribute = '0' WHERE cache_default_attribute IS NULL;

 

  • Like 1
Link to comment
Share on other sites

2 minutes ago, Crezzur said:

Run this query and you will be fine 😉

# Crezzur - Fix for: 
# Error: Argument 4 passed to PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderCustomerForViewing::__construct()
# must be of the type string, null given, called in ../src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php on line 236
# -----

UPDATE ps_address SET phone = '' WHERE phone IS NULL;
UPDATE ps_address SET phone_mobile = '' WHERE phone_mobile IS NULL;

UPDATE ps_order_detail SET id_order_invoice = '0' WHERE id_order_invoice IS NULL;
UPDATE ps_order_detail SET product_reference = '' WHERE product_reference IS NULL;
UPDATE ps_order_detail SET product_supplier_reference = '' WHERE product_supplier_reference IS NULL;
UPDATE ps_order_detail SET product_isbn = '' WHERE product_isbn IS NULL;
UPDATE ps_order_detail SET product_upc = '' WHERE product_upc IS NULL;
UPDATE ps_order_detail SET product_mpn = '' WHERE product_mpn IS NULL;
UPDATE ps_order_detail SET download_hash = '' WHERE download_hash IS NULL;
UPDATE ps_orders SET gift_message = '' WHERE gift_message IS NULL;

UPDATE ps_order_payment SET transaction_id = '' WHERE transaction_id IS NULL;
UPDATE ps_order_payment SET card_number = '' WHERE card_number IS NULL;
UPDATE ps_order_payment SET card_brand = '' WHERE card_brand IS NULL;
UPDATE ps_order_payment SET card_expiration = '' WHERE card_expiration IS NULL;
UPDATE ps_order_payment SET card_holder = '' WHERE card_holder IS NULL;

UPDATE ps_order_carrier SET tracking_number = '' WHERE tracking_number IS NULL;
UPDATE ps_order_carrier SET id_order_invoice = '0' WHERE id_order_invoice IS NULL;
UPDATE ps_order_carrier SET weight = '0' WHERE weight IS NULL;

UPDATE ps_product SET isbn = '' WHERE isbn IS NULL;
UPDATE ps_product SET upc = '' WHERE upc IS NULL;
UPDATE ps_product SET mpn = '' WHERE mpn IS NULL;
UPDATE ps_product SET unity = '' WHERE unity IS NULL;
UPDATE ps_product SET supplier_reference = '' WHERE supplier_reference IS NULL;
UPDATE ps_product SET location = '' WHERE location IS NULL;
UPDATE ps_product SET redirect_type = '301-category' WHERE redirect_type = '';
UPDATE ps_product SET available_date = '2020-12-01' WHERE available_date IS NULL;
UPDATE ps_product SET cache_default_attribute = '0' WHERE cache_default_attribute IS NULL;
UPDATE ps_product_shop SET unity = '' WHERE unity IS NULL;
UPDATE ps_product_shop SET redirect_type = '301-product' WHERE redirect_type = '';
UPDATE ps_product_shop SET available_date = '2020-12-01' WHERE available_date IS NULL;
UPDATE ps_product_shop SET cache_default_attribute = '0' WHERE cache_default_attribute IS NULL;

 

many thanks, how or where do I run the query?

 

Link to comment
Share on other sites

3 minutes ago, Nickz said:

Ok what Server? Windows, Linux, if later which distro, version of the distro? 

PS requirements checked?

Server information Linux #1 SMP PREEMPT Wed Jun 9 16:10:01 EEST 2021 x86_64

Server software version: Apache

PHP version: 7.4.21

Memory limit: 768M

Max execution time: 120

Upload Max File size: 256M

Link to comment
Share on other sites

Sweet

How about those:

Quote

 

SSL certificate if you plan to process payments internally (not using PayPal for instance)

Must have PHP extensions: CURL, DOM, Fileinfo, GD, Intl, Mbstring, Zip, Json, iconv

To improve performances: MemCached, Apcu, OpCache

 

 

Link to comment
Share on other sites

4 minutes ago, Crezzur said:

In your MYSQL databank, after a backup of your database.

SQL query: Copy

# Crezzur - Fix for: # Error: Argument 4 passed to PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderCustomerForViewing::__construct() # must be of the type string, null given, called in ../src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php on line 236 # ----- UPDATE ps_address SET phone = '' WHERE phone IS NULL

MySQL said: 

#1146 - Table 'dbvimqeneofcht.ps_address' doesn't exist

 

Link to comment
Share on other sites

4 minutes ago, tim1983 said:

SQL query: Copy

# Crezzur - Fix for: # Error: Argument 4 passed to PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderCustomerForViewing::__construct() # must be of the type string, null given, called in ../src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php on line 236 # ----- UPDATE ps_address SET phone = '' WHERE phone IS NULL

MySQL said: 

#1146 - Table 'dbvimqeneofcht.ps_address' doesn't exist

 

Do you use ps_ prefix? or did you change it so something els?

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

I've found the issue, but not sure how to solve it

new orders create a 

id_order_state of 33

 

if i changed to 4 , the order opens fine in back office.

 

Now , how do I make new orders never have that number?

any number over 30 makes the error appear

solved.png

Link to comment
Share on other sites

SOLVED

The statuses seemed to have replicated when doing the migration

Basically it entered several duplicate statuses on the end of the `soft_order_state_lang`

30 onwards were set to the wrong language

Language changed i.e from 2 to 1

Everything works perfect now

 

Thanks for all your help, Ive learnt a lot about sql etc today haha

Edited by tim1983 (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...
Zitat

UPDATE ps_address SET phone = '' WHERE phone IS NULL;
UPDATE ps_address SET phone_mobile = '' WHERE phone_mobile IS NULL;

UPDATE ps_order_detail SET id_order_invoice = '0' WHERE id_order_invoice IS NULL;
UPDATE ps_order_detail SET product_reference = '' WHERE product_reference IS NULL;
UPDATE ps_order_detail SET product_supplier_reference = '' WHERE product_supplier_reference IS NULL;
UPDATE ps_order_detail SET product_isbn = '' WHERE product_isbn IS NULL;
UPDATE ps_order_detail SET product_upc = '' WHERE product_upc IS NULL;
UPDATE ps_order_detail SET product_mpn = '' WHERE product_mpn IS NULL;
UPDATE ps_order_detail SET download_hash = '' WHERE download_hash IS NULL;
UPDATE ps_orders SET gift_message = '' WHERE gift_message IS NULL;

UPDATE ps_order_payment SET transaction_id = '' WHERE transaction_id IS NULL;
UPDATE ps_order_payment SET card_number = '' WHERE card_number IS NULL;
UPDATE ps_order_payment SET card_brand = '' WHERE card_brand IS NULL;
UPDATE ps_order_payment SET card_expiration = '' WHERE card_expiration IS NULL;
UPDATE ps_order_payment SET card_holder = '' WHERE card_holder IS NULL;

UPDATE ps_order_carrier SET tracking_number = '' WHERE tracking_number IS NULL;
UPDATE ps_order_carrier SET id_order_invoice = '0' WHERE id_order_invoice IS NULL;
UPDATE ps_order_carrier SET weight = '0' WHERE weight IS NULL;

UPDATE ps_product SET isbn = '' WHERE isbn IS NULL;
UPDATE ps_product SET upc = '' WHERE upc IS NULL;
UPDATE ps_product SET mpn = '' WHERE mpn IS NULL;
UPDATE ps_product SET unity = '' WHERE unity IS NULL;
UPDATE ps_product SET supplier_reference = '' WHERE supplier_reference IS NULL;
UPDATE ps_product SET location = '' WHERE location IS NULL;
UPDATE ps_product SET redirect_type = '301-category' WHERE redirect_type = '';
UPDATE ps_product SET available_date = '2020-12-01' WHERE available_date IS NULL;
UPDATE ps_product SET cache_default_attribute = '0' WHERE cache_default_attribute IS NULL;
UPDATE ps_product_shop SET unity = '' WHERE unity IS NULL;
UPDATE ps_product_shop SET redirect_type = '301-product' WHERE redirect_type = '';
UPDATE ps_product_shop SET available_date = '2020-12-01' WHERE available_date IS NULL;
UPDATE ps_product_shop SET cache_default_attribute = '0' WHERE cache_default_attribute IS NULL;
UPDATE ps_address SET dni = '' WHERE dni IS NULL;
UPDATE ps_address SET other = '' WHERE other IS NULL;
UPDATE ps_address SET address2 = '' WHERE address2 IS NULL;
UPDATE ps_address SET company = '' WHERE company IS NULL;
UPDATE ps_address SET vat_number = '' WHERE vat_number IS NULL;

UPDATE ps_product_attribute SET location = '' WHERE location is NULL

Wer diese Probleme hat, kann meine überarbeitete Abfrage versuchen. Bei mir hat es das Problem gelöst und auch noch einen beim manuellen erstellen von Bestellungen.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

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...