myparcelnl / prestashop

PrestaShop module to integrate with MyParcel NL and BE
https://developer.myparcel.nl/nl/documentatie/11.prestashop.html
10 stars 5 forks source link

Product causes error when opening order page #228

Closed rockincent closed 9 months ago

rockincent commented 9 months ago

Version check

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

  1. install module
  2. configure module
  3. open order page

Relevant log output

No response

Additional context

No response

venditdevs commented 9 months ago

Probably again something with the dimensions of the products. This is/was a problem in the 1.7 module for a long time.

EdieLemoine commented 9 months ago

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 :)

EdieLemoine commented 9 months ago

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

rockincent commented 9 months ago

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.

EdieLemoine commented 9 months ago

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

rockincent commented 9 months ago

@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?

EdieLemoine commented 9 months ago

@rockincent did you unpack it first? It contains both the MyParcelNL and SendMyParcel versions.

rockincent commented 9 months ago

@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

EdieLemoine commented 9 months ago

@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. :)

myparcel-bot[bot] commented 5 months ago

:tada: This issue has been resolved in version 2.0.0-beta.2 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: