Jump to content

Error when try to acces order in BO


Pr0wleR

Recommended Posts

Hi.

When I try to access an order from the BO I get this error:

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/z02u12to/evoracks.de/src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php on line 351

It's an order with Paypal payment.

I can access to other orders, except this one.

I ran the code froim this post, but I still get the error.

Can anyoune help?

Thanks in advance!

 

 

Link to comment
Share on other sites

  • 8 months later...
15 minutes ago, AcidLava said:

Same issue, anyone to help ?

Well the TO did not give details so its hard to impossible to help.
 

Quote

When I try to access an order from the BO I get this error:

About a 100 things could have happened, mostlikely it's an update of sorts, php version, shop, module. The server changing from mysql to whatever and so on. 
Php Version a few weeks back? Now? Shop Version? Theme? Theme Changes? You need to remeber and tell us.

Link to comment
Share on other sites

Well, it's a well known issue for what I see.

Most of the time, it's told to execute the following, but it don't works in my case. 
 

# 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;

 

Link to comment
Share on other sites

  • 5 months later...

There are 2 things to know here:

  • Argument 3 of OrderStatusForViewing::__construct() 's function must be an Order state name.
  • This function is called when trying to get Order history on BO Order's page

Knowing that, this error can happen for 2 reasons:

  • Either the name of one of your order states is empty. You can check that on Shop parameters > Orders > Order states page in your BO
  • Or, one of your id_order_states is wrong in your table prefix_order_history in your database. It can be set to null, 0 or any other number which is not related to one of your order states. You have to check and correct that directly in your database.
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...