Jump to content

PrestaShop\PrestaShop\Core\Domain\Product\QueryResult\ProductDetails::__construct(): Argument #1 ($isbn) must be of type string, null given, called in /src/Adapter/Product/QueryHandler/GetProductForEditingHandler.php on line 389 [TypeError 0]


dudecorn

Recommended Posts

After importing products from CMS, can't edit any of them.

Such a problem:

PrestaShop\PrestaShop\Core\Domain\Product\QueryResult\ProductDetails::__construct(): Argument #1 ($isbn) must be of type string, null given, called in /src/Adapter/Product/QueryHandler/GetProductForEditingHandler.php on line 389
[TypeError 0]

Prestashop 8.1.4

Also exported products includes size, it is like 101-dm/41

where 41 is size and "/" is the split sign between the model and variable size.

However Prestashop treats all imported products separately.

When I copy the product, then can edit the copy in back office, but can't add any variables like size and colour.

Any help?

 

Link to comment
Share on other sites

  • 2 weeks later...
2 hours ago, musicmaster said:

My tools Prestools has under Utilities a function "Convert NULLs into empty strings". You can use that to fix your shop.

As with all major changes: make a backup before applying.

 

Hello,

Where to find this tool?
Regards

Link to comment
Share on other sites

After installing a fresh Prestashop 8.1.4, then I imported all the data using ets migration, I had this problem

PrestaShop\PrestaShop\Core\Domain\Product\QueryResult\ProductDetails::__construct(): Argument #2 ($upc) must be of type string, null given, called in /src/Adapter/Product/QueryHandler/GetProductForEditingHandler.php on line 394

PrestaShop\PrestaShop\Core\Domain\Product\QueryResult\ProductDetails::__construct(): Argument #5 ($reference) must be of type string, null given, called in /src/Adapter/Product/QueryHandler/GetProductForEditingHandler.php on line 394

in src/Core/Domain/Product/QueryResult/ProductDetails.php (line 68)

     * @param string $upc

     * @param string $ean13

     * @param string $mpn

     * @param string $reference

     */

    public function __construct(

        string $isbn,

        string $upc,

        string $ean13,

        string $mpn,

        string $reference

Do you know how to solve this? Thank you in advance

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

No need to answer, I fixed it myself. Thank you for your polite answer.

@dudecorn & @SeifF here's the solution below:

UPDATE `ps_product` SET reference = '' WHERE reference IS NULL;
UPDATE `ps_product` SET isbn = '' WHERE isbn IS NULL;
UPDATE `ps_product` SET ean13 = '' WHERE ean13 IS NULL;
UPDATE `ps_product` SET upc = '' WHERE upc IS NULL;
UPDATE `ps_product` SET mpn = '' WHERE mpn IS NULL;

  • Like 2
Link to comment
Share on other sites

ISBN, like many other fields, is in the database defined as "default NULL". However, when those fields are saved in the backoffice they are always saved as empty strings when not set. This has become so common that the software gives warnings when such a value does have NULLs.

ISBN is a field that was introduced in Prestashop 1.7. Most likely the software you were using was built for an older Prestashop version and never upgraded to cover this field. And as it was not defined when the ps_product records were created it got the default value of NULL.

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

  • 1 month later...
On 2/28/2024 at 8:48 PM, musicmaster said:

My tools Prestools has under Utilities a function "Convert NULLs into empty strings". You can use that to fix your shop.

As with all major changes: make a backup before applying.

 

Дякую за чудове рішення, та софт, який багато разів допомогав. Описану вище проблему саме так і вирішив. Дякую!!

Link to comment
Share on other sites

Migration 1.7.8 to 8.1.5. I have this type of errors too.  $isbn fixed like @djo1919 suggest.

But also

/index.php/sell/catalog/products-v2/1164/edit?_token=***

PrestaShop\PrestaShop\Core\Domain\Product\Supplier\QueryResult\ProductSupplierForEditing::__construct(): Argument #5 ($reference) must be of type string, null given, called in /src/Adapter/Product/AbstractProductSupplierHandler.php on line 83

I think this is for supplier reference in table ps_product_supplier  (product_supplier_reference Default=NULL) when I changed to '' or string it works.

Are you agree with this? If yes then it is a problem with ETS migration module?

  • Thanks 1
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...