netresearch / dhl-shipping-m2

DHL multi-division shipping extension for Magento 2
Open Software License 3.0
13 stars 4 forks source link

Undefined index: locationType #14

Closed YiffyToys closed 3 years ago

YiffyToys commented 3 years ago

It seems that a user may be able to select "[x] parcel station" delivery during checkout without actually selecting a parcel station or entering a Postnummer.

When creating the postage a generic error message, no entry in the dhl_paket.log and the following stack trace in exception.log happens.

[2020-11-05 11:11:18] main.CRITICAL: Notice: Undefined index: locationType in .../vendor/dhl/module-carrier-paket/Model/Pipeline/CreateShipments/RequestDataMapper.php on line 229 {"exception":"[object] (Exception(code: 0): Notice: Undefined index: locationType in .../vendor/dhl/module-carrier-paket/Model/Pipeline/CreateShipments/RequestDataMapper.php on line 229 at .../vendor/magento/framework/App/ErrorHandler.php:61)"} []

As a workaround you can manually unselect the "[x] parcel station delivery" in the postage creation dialog.

ngolatka commented 3 years ago

Hello @YiffyToys Where exactly is that checkbox you mentioned? I can only see a button "Find Parcel Station" which leads to the map.

If I close the map without selection anything, the regular shipping address will be used.

If I select something in the map, there's still no checkbox like "Parcel station: yes/no" in the checkout.

mam08ixo commented 3 years ago

In the current version 1.2.0, an inconsistency occurs when the consumer selects a parcel station and then removes it again. This issue may or may not be related to the reporter's observation.

I suggest waiting for the upcoming release to see if it fixes the error.

YiffyToys commented 3 years ago

We do not know exactly how the user has created that order in the checkout process. Just what details the order contained and how we could work around it.

ngolatka commented 3 years ago

@YiffyToys What happens if you create a test-order like @mam08ixo described? Select a parcel station, then remove it, then place the order.

Does that provoke the same error?

YiffyToys commented 3 years ago

Indeed, selecting and then deselecting a Packstation during checkout leads to a glitch in the checkout process

iplnoihmgpddecoi

and to the described issue in the created order

ihnbapidemmhcfje

So this issue can be reproduced.

It originally happend with module 1.2 in Magento 2.3.5-p1 and now has been reproduced in 1.2 with 2.4.1 .

ngolatka commented 3 years ago

Alright, then let's do what @mam08ixo suggested:

In the current version 1.2.0, an inconsistency occurs when the consumer selects a parcel station and then removes it again. This issue may or may not be related to the reporter's observation. I suggest waiting for the upcoming release to see if it fixes the error.

YiffyToys commented 3 years ago

Just for informational purposes. Another user just managed to trigger this. Workaround works flawlessly once you know what to look for.

YiffyToys commented 3 years ago

Looks like the same exception also happens with GENUINE Packstation delivery addresses.

DHL Recipient Street Edit Street Name Packstation Street Number XXX Supplement XXXXXXXXX

The interesting part is that the DHL Postnummer is missing in the postage-creations-dialog (screenshot attached).

Screenshot_2020-11-14 New Shipment Shipments Operations Sales Magento Admin

ngolatka commented 3 years ago

@YiffyToys Do you mean that you cannot create ANY shipments to DHL Packstations?

That would be strange. Also, I cannot confirm that. It works fine on my test-system.

I don't see the error Undefined index: locationType ... in the log either.

EDIT: Now I get what you did. You manually entered "Packstation 123" as street name and house number. I tried that as well, but still don't see the Undefined index: locationType .... Yes, the DHL Postnummer isn't displayed "nicely" in the shipping popup, but that shouldn't be a blocking issue.

Note that if you do it like this, you probably need to uncheck "An eine Packstation liefern" in the admin panel. Why? Because our DHL module will look for the Packstation info and DHL Postnummer in a different place, not in street name, house number and supplement.

YiffyToys commented 3 years ago

We have a successfull Packstation order from 2020-11-11 and the problematic one from 2020-11-13. So it's not all Packstation cases. We could find out that the problematic customer is a returning customer who has the Packstation as his stored delivery address since 2015. So he likely never used the new Packstation-Picker during checkout and thus no additional data from that picker has been added. (It may very well even be a migrated customer from Magento 1.x .)

We also played around with the broken order and it seems the key "customerPostnumber" is also missing in $locationData.

ngolatka commented 3 years ago

@YiffyToys Does that mean you have exactly one customer that is affected by this problem?

IMHO, modifying the module to catch such rare cases seems a bit overkill, don't you think? Wouldn't it be easier to correct the information in the customer's account?

YiffyToys commented 3 years ago

No, that's just the first one where it happened for a Packstation delivery address as opposed to a regular address. I can't find out if the other customers also used stored addresses but it is possible that this may be a cause.

ngolatka commented 3 years ago

@YiffyToys Can you create a few test-customer accounts with the variations you know and check under which exact circumstances the problem occurs? That would probably help us analyzing the problem.

And let's not forget there's a new release coming soon. Might be worth a shot to check if the problems are still present after the update.

YiffyToys commented 3 years ago

Already working on it. Currently testing if a stored delivery address in conjunction with Paypal express checkout may do this. But that's hard to test without making an actual payment that may get us flagged.

YiffyToys commented 3 years ago

Haven't been able to reproduct this for quite a while and there is a workaround. I'll just close the issue.