Jontee Posted January 9, 2022 Share Posted January 9, 2022 Hi, I am as of now using the latest version of Prestashop, 1.7.8.2. I have never updated from version 1.6, it was installed with 1.7 from the beginning, around 2018. Since this summer, if I remember correctly, some orders became "messy" after an upgrade to a newer version of Prestashop. I have noticed two orders since then, which I cannot open due to symfoni error. These orders have been placed AFTER the upgrade this summer. The orders affected was made by previous customers who also ordered way back in 2019, and used their same email address, so two customers have been created with the same email for example. I think that is were the problem is? If I try to click on one of these orders in the Back Office, I receive the following error: DEBUG MODE NOT ACTIVATED: Type error: Argument 1 passed to PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderInvoiceAddressForViewing::__construct() must be of the type int, null given, called in /src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php on line 330 [Symfony\Component\Debug\Exception\FatalThrowableError 0] DEBUG MODE ACTIVATED: Symfony\Component\Debug\Exception\ ContextErrorException in src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php (line 338) $address->company, $address->address1, $address->address2, $stateName, $address->city, ROW 338: $country->name[(int) $order->getAssociatedLanguage()->getId()], $address->postcode, $address->phone, $address->phone_mobile, $address->vat_number, $dni GetOrderForViewingHandler->getOrderInvoiceAddress(object(Order)) in src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php (line 190) GetOrderForViewingHandler->handle(object(GetOrderForViewing)) in vendor/league/tactician/src/Handler/CommandHandlerMiddleware.php (line 71) CommandHandlerMiddleware->execute(object(GetOrderForViewing), object(Closure)) in vendor/league/tactician/src/CommandBus.php (line 62) CommandBus->League\Tactician\{closure}(object(GetOrderForViewing)) in src/Core/CommandBus/Middleware/CommandRegisterMiddleware.php (line 79) CommandRegisterMiddleware->execute(object(GetOrderForViewing), object(Closure)) in vendor/league/tactician/src/CommandBus.php (line 62) CommandBus->League\Tactician\{closure}(object(GetOrderForViewing)) in vendor/league/tactician/src/CommandBus.php (line 42) CommandBus->handle(object(GetOrderForViewing)) in src/Core/CommandBus/TacticianCommandBusAdapter.php (line 54) TacticianCommandBusAdapter->handle(object(GetOrderForViewing)) in src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php (line 420) OrderController->viewAction(1321, object(Request)) in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php (line 151) HttpKernel->handleRaw(object(Request), 1) in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php (line 68) HttpKernel->handle(object(Request), 1, false) in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php (line 200) Kernel->handle(object(Request), 1, false) in "adminroute"/index.php (line 82) Level Channel Message INFO 03:54:04 request Matched route "admin_orders_view". DEBUG 03:54:04 security Read existing security token from the session. DEBUG 03:54:04 security User was reloaded from a user provider. INFO 03:54:04 php User Deprecated: Not specifying the optional ShopConstraint parameter is deprecated since version 1.7.8.0 INFO 03:54:04 php User Deprecated: Not specifying the optional ShopConstraint parameter is deprecated since version 1.7.8.0 INFO 03:54:04 php User Deprecated: Not specifying the optional ShopConstraint parameter is deprecated since version 1.7.8.0 INFO 03:54:04 php User Deprecated: Not specifying the optional ShopConstraint parameter is deprecated since version 1.7.8.0 INFO 03:54:04 php User Deprecated: Not specifying the optional ShopConstraint parameter is deprecated since version 1.7.8.0 INFO 03:54:04 php User Deprecated: Creating Doctrine\ORM\Mapping\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0. INFO 03:54:04 php User Deprecated: Not specifying the optional ShopConstraint parameter is deprecated since version 1.7.8.0 INFO 03:54:05 php User Deprecated: PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderInvoiceAddressForViewing is deprecated since version 1.7.7.5 and will be removed in the next major version. Use PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderForViewing::getInvoiceAddressFormatted() instead. INFO 03:54:06 php User Deprecated: Implementing "Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface" without the "reset()" method is deprecated since Symfony 3.4 and will be unsupported in 4.0 for class "Csa\Bundle\GuzzleBundle\DataCollector\GuzzleCollector". CRITICAL 03:54:06 php Uncaught Notice: Trying to access array offset on value of type null CRITICAL 03:54:06 request Uncaught PHP Exception Symfony\Component\Debug\Exception\ContextErrorException: "Notice: Trying to access array offset on value of type null" at /src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php line 338 Many thanks in advance, I would really appreciate some help here. Best regards, Jonathan Link to comment Share on other sites More sharing options...
Rhobur Posted January 9, 2022 Share Posted January 9, 2022 Try edit the addresses in that order and fill all their fields with something even if the original address doesn't need them, e.g. fill both the phone numbers etc Link to comment Share on other sites More sharing options...
willowtree Posted January 9, 2022 Share Posted January 9, 2022 I have a similar error - I cannot open the order to edit it, Oops... looks like an unexpected error occurred. Type error: Argument 1 passed to PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderShippingAddressForViewing::__construct() must be of the type integer, null given, called in /src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php on line 307 [Symfony\Component\Debug\Exception\FatalThrowableError 0] Link to comment Share on other sites More sharing options...
Jontee Posted January 9, 2022 Author Share Posted January 9, 2022 Hi, I have deleted the address from the customer and added a new address with every field filled in, still the same error. I can also see that the order is being included in the numer of orders on the order page, but it doesn't display there, in the list. I have to visit the customer and then I see the order, but cannot access it. Many thanks in advance. Best regards, Jonathan Link to comment Share on other sites More sharing options...
Fabry Posted January 10, 2022 Share Posted January 10, 2022 Hi Jontee it's similar to this issue https://github.com/PrestaShop/PrestaShop/issues/22215 I had these similar problems with some migrations from 1.6 to 1.7...the problem is the Null value not accepted in new PS version backup your db and run those queries above..maybe you have to add some queries for that particular field, anyway it fix the problem. check your ps_order_invoice table ciao Link to comment Share on other sites More sharing options...
Jontee Posted January 10, 2022 Author Share Posted January 10, 2022 Hi Fabry, Thanks for your reply, much appreciated. I saw that issue-thread at github and thought it might have something to do with it. On the other hand, I have since updated the shop regulary, to the newest version 1.7.8.2 I have today. Do you know if the updates have already run those queries maybe? Do all users have to run them manually otherwise? Someone at the Prestashop developer theme could maybe give me a clue how to resolve this? Thanks in advance. Best regards, Jonathan Link to comment Share on other sites More sharing options...
Jontee Posted January 11, 2022 Author Share Posted January 11, 2022 Hi, Do anyone know about the above? Do I have to run the SQL-query even though I already have the latest version? Or has it been run since the several upgrades performed? Which queries would otherwise be required to run for it to work? Is this the "official" solution to the problem? Many thanks. Have a great day. Best regards, Jonathan Link to comment Share on other sites More sharing options...
Fabry Posted January 11, 2022 Share Posted January 11, 2022 (edited) Hello Jontees, sorry for late reply this issue happen also with migration from 1.7.x to 1.7.7 or 1.7.8.....in the database some data generate this issue and must be correct First download a backup of your Db and than run the queries!!....if you have problem you can upload again the backup..but usually these queries don't cause problems. ciao Edited January 11, 2022 by Fabry errors (see edit history) Link to comment Share on other sites More sharing options...
willowtree Posted January 11, 2022 Share Posted January 11, 2022 Hi, None of the sql queries resolved it for me I'm afraid. Link to comment Share on other sites More sharing options...
Jontee Posted January 12, 2022 Author Share Posted January 12, 2022 Hi, Many thanks for your replies. Does anyone have a complete list of queries to run and instructions of how to run them? Would be much appreciated. I was thinking if it might differ because I have the latest version of Prestashop, compared to the issue described in github. Best regards, Link to comment Share on other sites More sharing options...
Jontee Posted January 13, 2022 Author Share Posted January 13, 2022 Do anyone know? Link to comment Share on other sites More sharing options...
willowtree Posted January 13, 2022 Share Posted January 13, 2022 My error is src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php on line 307 line 307 which is $dni I have checked the dni in the ps_address database table and every entry is blank so cannot see why it is an issue with this address/order? Link to comment Share on other sites More sharing options...
Jontee Posted January 14, 2022 Author Share Posted January 14, 2022 I would really, really appreciate a solution to this. Many thanks in advance. Link to comment Share on other sites More sharing options...
willowtree Posted January 23, 2022 Share Posted January 23, 2022 My debug for the error, Type error: Argument 1 passed to PrestaShop\PrestaShop\Core\Domain\Order\QueryResult\OrderShippingAddressForViewing::__construct() must be of the type integer, null given, called in XXX/src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php on line 307 [Symfony\Component\Debug\Exception\FatalThrowableError 0] Symfony\Component\Debug\Exception\ FatalThrowableError in src/Core/Domain/Order/QueryResult/OrderShippingAddressForViewing.php (line 130) * @param string $phone * @param string $phoneMobile * @param string|null $vatNumber * @param string|null $dni If null the DNI is not required for the country, else string */ public function __construct( int $addressId, string $firstName, string $lastName, string $companyName, string $address1, OrderShippingAddressForViewing->__construct(null, null, null, null, null, null, '', null, null, null, null, null, null, 0) in src/Adapter/Order/QueryHandler/GetOrderForViewingHandler.php (line 307) Link to comment Share on other sites More sharing options...
burty1109 Posted October 14, 2022 Share Posted October 14, 2022 (edited) I think the reason for this error is because the address is no longer available in the ps_address table in the database.. Go to the ps_order table, find the order number - find which address `id_address_delivery` is associated with the order. In the ps_address table create or copy an existing address - then change id_address to the value of `id_address_delivery' in the order table. If it does exist in address table, then look at the country name field and correct that. Good luck Edited October 14, 2022 by burty1109 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now