DPDBeNeLux / magento2-shipping

Let op: er zijn nieuwe DPD plugins (BETA versie) beschikbaar met belangrijke nieuwe functionaliteiten. De oude plugins zullen na Brexit niet meer goed functioneren, download daarom de nieuwe versie op Github/DPDconnect.
GNU General Public License v3.0
12 stars 15 forks source link

fixes issue with addressData in checkout #15

Closed duckchip closed 6 years ago

duckchip commented 6 years ago

Hi guys,

I created a PR for an issue we have in Magento 2.2.2.

The Issue

When a (guest) customer fills in the address form, selects the DPD Pickup shipping method and clicks 'Click here to select your Parcelshop', the map won't get rendered and no notification is shown.

The fix

When trying to get the Parcel shops from the customer's address, the shipping address is fetched from quote, but the fields might be undefined if the customer didn't log-in / go to the billing step.

In this PR, the shipping Address is fetched from the checkoutData, which is being updated when the address fields are changed and is immediately accessible. + when the checkoutData is NULL, the properties of the object won't be set. The last one is important because in the controller the data from the request is checked. When the keys don't exist in the data, the controller will show an error message, which isn't the case right now.

This fixes our problem with the map not being rendered.

Thx in advance!

Tristan