Open mariuszsienkiewicz opened 2 months ago
Hi @mariuszsienkiewicz, this is a very specific issue with the way custom PostNL contracts are currently handled by our API. You might see this issue disappear if you disable your custom PostNL contract in your MyParcel account. Obviously that's not a real fix, but this is an issue we're aware of and will actually fix in the PDK soon.
I have the exact same problem, but I don't have any custom contracts with PostNL. It seems to be related to the duplicate entries for regular non-custom-contract PostNL.
An exception occurred while executing 'INSERT INTO ps_myparcelnl_carrier_mapping (carrier_id, myparcel_carrier, date_upd, date_add) VALUES (?, ?, ?, ?)' with params [36, "postnl", "2024-07-05 16:42:59", "2024-07-05 16:42:59"]:SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'postnl' for key 'myparcel_carrier'
PrestaShop version: 8.1.7 PHP version: 8.3.8 (also tried with 8.1.28, same result) MyParcel Module version: myparcelnl-prestashop-4.0.0-beta.3.zip (reports as v4.0.0-be)
The plugin also creates duplicate entries for PostNL in the PrestaShop carriers list:
@EdieLemoine: When fetching carriers from the MyParcel API, when PostNL custom contract carrier is enabled, multiple postnl carriers are returned. This causes problems all over the place. We need to correct this manually before saving these carriers in the PDK.
Original myparcelnl/prestashop issue content
Version check
PrestaShop version
8.1.5
PHP version
8.1.28
What went wrong?
I have tried to test the myparcelnl on stock PrestaShop 8.1.5 installation.
It seems that there is an issue when trying to save the API key for the first time (and after deleting the API key and setting it up again the issue occurs too).
Error log is below.
From what I can understand, the issue is that PostNL Carrier is duplicated (I don't know why) and the PostNL (Custom contract) use the same
name
.CarrierCollection
which is used in the process of setting up new carriers contain sevenMyParcelNL\Pdk\Carrier\Model\Carrier
objects and three of them have the same name:There is one more bug (duplicated PostNL) in the configuration page too (screenshot below) that is probably related to this issue.
Reproduction steps
Relevant log output
Additional context