Jump to content

Solved - Product cannot be edited (after migration) due to ($reference) must be of type string, null given, called in (8.1)


Zoltán Vasvári

Recommended Posts

Hi,

After migrating 7.7.1 products to brand new 8.1 store 90% of products work well, but few is not editable with following php error.

These products are set with same supplier and no different in database file compared to other products that work well.
Why is there this string problem? 

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

Uncaught PHP Exception TypeError: "PrestaShop\PrestaShop\Core\Domain\Product\Supplier\QueryResult\ProductSupplierForEditing::__construct(): Argument #5 ($reference) must be of type string, null given, called in /home/internaturel/internaturel.eu/src/Adapter/Product/AbstractProductSupplierHandler.php on line 83" at /home/internaturel/internaturel.eu/src/Core/Domain/Product/Supplier/QueryResult/ProductSupplierForEditing.php line 85

Screenshot 2024-01-24 174221_supplier string issue.png

Link to comment
Share on other sites

Hello,

It seems like the issue is related to the product supplier reference being set as null in certain cases. 
This can occur when there is a mismatch or inconsistency in the database, particularly when the supplier is assigned to one table but not to another.

Here are a few steps you can take to address this:

1) Check Supplier Existence:
Ensure that the suppliers mentioned for these products exist in your new 8.1 store. If there's any mismatch, you might need to create or update the supplier entries.

2) Check Database Consistency:
Verify the consistency of the database entries for these products. Cross check the tables related to product suppliers to make sure the information is coherent.

3) Update Supplier Information:
If necessary, update the supplier information for the affected products. This can be done either through the back office or directly in the database.

4) Review Migration Process:
Double check the migration process to ensure that all supplier-related information is accurately transferred from the 7.7.1 store to the new 8.1 store.

After making these checks, you should be able to resolve the issue. If the problem persists or you need further assistance, feel free to provide more details, and we'll be happy to help.

Good day

  • Like 1
Link to comment
Share on other sites

On 1/25/2024 at 3:03 PM, PrestaServicePro said:

Hello,

It seems like the issue is related to the product supplier reference being set as null in certain cases. 
This can occur when there is a mismatch or inconsistency in the database, particularly when the supplier is assigned to one table but not to another.

Here are a few steps you can take to address this:

1) Check Supplier Existence:
Ensure that the suppliers mentioned for these products exist in your new 8.1 store. If there's any mismatch, you might need to create or update the supplier entries.

2) Check Database Consistency:
Verify the consistency of the database entries for these products. Cross check the tables related to product suppliers to make sure the information is coherent.

3) Update Supplier Information:
If necessary, update the supplier information for the affected products. This can be done either through the back office or directly in the database.

4) Review Migration Process:
Double check the migration process to ensure that all supplier-related information is accurately transferred from the 7.7.1 store to the new 8.1 store.

After making these checks, you should be able to resolve the issue. If the problem persists or you need further assistance, feel free to provide more details, and we'll be happy to help.

Good day

Thank for the comments, your help is very welcome. I will reach out to the developer of migrator module to check this as it could be a malfunction of that module and can help others as well

 

Link to comment
Share on other sites

On 1/25/2024 at 3:03 PM, PrestaServicePro said:

Hello,

It seems like the issue is related to the product supplier reference being set as null in certain cases. 
This can occur when there is a mismatch or inconsistency in the database, particularly when the supplier is assigned to one table but not to another.

Here are a few steps you can take to address this:

1) Check Supplier Existence:
Ensure that the suppliers mentioned for these products exist in your new 8.1 store. If there's any mismatch, you might need to create or update the supplier entries.

2) Check Database Consistency:
Verify the consistency of the database entries for these products. Cross check the tables related to product suppliers to make sure the information is coherent.

3) Update Supplier Information:
If necessary, update the supplier information for the affected products. This can be done either through the back office or directly in the database.

4) Review Migration Process:
Double check the migration process to ensure that all supplier-related information is accurately transferred from the 7.7.1 store to the new 8.1 store.

After making these checks, you should be able to resolve the issue. If the problem persists or you need further assistance, feel free to provide more details, and we'll be happy to help.

Good day

Thank you for the advice. In PHP_Myadmin the dimension ps_product_supplier is different. While it is empty in 1.7.7.0 it is 'NULL' in 8.1.2 after migration.
While deleting NULL value the product is editable.

  • Like 2
Link to comment
Share on other sites

We’re delighted to hear that the issue has been resolved by deleting the NULL value in the ps_product_supplier dimension.

It's great that you were able to identify and implement the solution.

If you could update the post title to "solved," it would be immensely helpful for others facing a similar challenge.

This way, they can quickly find the solution and apply it to their situations.

Happy sales!

  • Like 1
Link to comment
Share on other sites

  • Zoltán Vasvári changed the title to Solved - Product cannot be edited (after migration) due to ($reference) must be of type string, null given, called in (8.1)

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