Product causes error when opening order page
Closed this issue ยท 11 comments
Version check
- My version of the plugin is v2.0.0-beta.0 or above.
PrestaShop version
8.1.2
PHP version
8.1
What went wrong?
Opening order page results in error:
MyParcelNL\PrestaShop\Pdk\Product\Repository\PsPdkProductRepository::MyParcelNL\PrestaShop\Pdk\Product\Repository{closure}(): Argument #1 ($strings) must be of type array, null given, called in /home/u7566p5159/domains/vangeleuken.nl/public_html/staging1/modules/myparcelnl/src/Pdk/Product/Repository/PsPdkProductRepository.php on line 56
Reproduction steps
- install module
- configure module
- open order page
Relevant log output
No response
Additional context
No response
Probably again something with the dimensions of the products. This is/was a problem in the 1.7 module for a long time.
Hi @rockincent, thanks for reporting this, after a quick look it appears this occurs when a product does not have a name, which should be impossible, so it's probably a product that can't be found. I'm curious to see what products are inside the order that triggers this error. I checked if this was caused by having a deleted product inside an order but that didn't cause an error in my environment.
If you could share the logs that would be great. The logs are in <prestashop root>/var/logs/myparcelnl
(or myparcelbe
if you use the BE module).
I'll push an update shortly that should fix this error, but as I don't know exactly what caused it I can't be sure.
Also @venditdevs, that's not possible as every line of code from the old module was replaced. This is basically an entirely new module. Hence the closing of all other bugs :)
I've just opened a PR for this.
If you're willing to try the fix to see if it solves your issue you can download the new version through the "โ๏ธ On pull request" run on the PR. (You'll need to unpack the downloaded archive first as it contains both the NL and the BE version.)
Error is explainable. @EdieLemoine you were spot on. In the staging area I deleted products to test another sync module. But forget to delete the orders. So all orders had none existing products. Deleted the orders and made a new one. No error!
But if I ever remove a product from the catalog which is in an order this error will show.
@rockincent I tried the same thing but this error did not occur, maybe when I delete the product from the database entirely.
If you're willing to install the version from the PR to test if it works that would be great. I've changed the logic so we check if products actually exist before proceeding to use them.
@EdieLemoine Tried to install release-2.0.0-beta.1-229.zip but an error occurs. "Installation of module failed. This file does not seem to be a valid module zip"
Should I FTP it manually?
@rockincent did you unpack it first? It contains both the MyParcelNL and SendMyParcel versions.
@EdieLemoine
Unpacked it, installed it and tested it.
Removed product from the catalog and opened the order with deleted product.
Works like a charm.
Everything ok so far!
Thanks
@rockincent amazing, thanks for testing it. Our tester @CherMyParcel is currently doing a quick test to see if this doesn't break anything. If that goes well the PR will be merged. I've just spammed dozens of issues with a link to beta.1 though, so we'll wait for a few more fixes to release the next beta version. You can safely keep using the version you have installed now. :)
๐ This issue has been resolved in version 2.0.0-beta.2 ๐
The release is available on GitHub release
Your semantic-release bot ๐ฆ๐
๐ This issue has been resolved in version 4.0.0 ๐
The release is available on GitHub release
Your semantic-release bot ๐ฆ๐