Jump to content

PS 1.7.8.11 - Argument 4 passed to PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderCustomerForViewing::__construct() must be of the type string, null given [RESOLU]


Recommended Posts

Bonjour,
J'ai un soucis sur une commande, avec un client de longue date qui n'est pas venu depuis un moment, impossible d'accéder à la commande en BO, j'ai cette erreur :

FatalThrowableError
Type error: Argument 4 passed to PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderInvoiceAddressForViewing::__construct() must be of the type string, null given, called in /home/mbcquuge/public_html/src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php on line 330

in OrderInvoiceAddressForViewing.php line 130
at OrderInvoiceAddressForViewing->__construct(212, 'MXXXX', 'XXXX', null, '9 PLACE XXXX XXXX', null, '', 'XXXX', 'France', '14XXX', 'XXXXX', 'XXXXXX', null, null)
in GetOrderForViewingHandler.php line 330

Auriez-vous un moyen de régler ce problème ? Je suis sous PS 1.7.8.11 et PHP 7.4.33

EDIT : j'ai vérifié, avec mes anciens clients, qui ont créés leurs comptes sur une version antérieur à la PS 1.7.8, si je clique sur "éditer l'adresse", j'ai la même erreur qui apparait. 

Dans ma BDD, j'ai remarqué que les anciens clients ont des cases vides cochées dans la table ps-address, par exemple "company", "address2", "other", "vat_number"... Si je décoche ces cases et que j'enregistre les tables, l'erreur disparait (mais j'ai des centaines de clients à modifier manuellement avec cette méthode...)

Merci beaucoup 

 

ps : mon URL est : gounacreations.com

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

  • gouna changed the title to PS 1.7.8.11 - Argument 4 passed to PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderCustomerForViewing::__construct() must be of the type string, null given

Bonjour, oui je pense que le soucis est dû à cela, il faudrait que les colonnes "NULL" donnent pour résultat : ""

A priori je viens de trouver cette solution à appliquer à la base de données :
 

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;

source https://metrodyn.fr/2022/02/09/prestashop-argument-4-passed-to-prestashopprestashopcoredomainorderqueryresultordercustomerforviewing__construct/

Il n'y à pas de risques de supprimer des données en faisant cette requête ?

  • Like 1
Link to comment
Share on other sites

  • gouna changed the title to PS 1.7.8.11 - Argument 4 passed to PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderCustomerForViewing::__construct() must be of the type string, null given [RESOLU]
  • 2 months 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...