netresearch / dhl-shipping-m2

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

Fehler bei Auswahl der Packstation #27

Closed Assambra closed 2 years ago

Assambra commented 3 years ago

Beim Ersten ausfüllen der Daten im Checkout wird der Button Packstation finden nicht angezeigt. Erst nach dem die Seite über den Browser neu geladen wird, wird der Button angezeigt.

Wenn die Checkout Daten vorhanden sind und man die Adresse ändert wird das Popup nicht immer mit der neuen Adresse befüllt sondern nimmt die alten Daten. (Es ist nicht immer reproduzierbar)

Des weiteren kommt es vor das die Versandart vorausgewählt ist und manchmal nicht das hat auch auswirkungen auf das Popup Packstation finden und die enthalten Daten z.B. Land. aber auch andere Daten

Wenn ich ein Custom Theme benutze wird das Land nicht ausgewählt und somit kann kein Auswahl der Packstation getroffen werden.

Ich benutzte Magento Version 2.4.1 und 2.4.2 auch versucht in kombination dhl-shipping-m2 v 1.5.0 und 1.5.0

Wie gesagt es ist schwer zu reproduzieren oder eine klare Aussage zu treffen wann weshalb warum auf jedenfall funktioniert es bei mir nicht wie es soll.

mam08ixo commented 3 years ago

Please retry with version 1.5.1 and check if that solves the issues, thanks. We cannot support custom themes though if they take shortcuts or do things differently than the standard checkout.

Assambra commented 3 years ago

Thank you for your answer. It was a typo with 1.5.0 and 1.5.0, it should be called 1.5.0 and 1.5.1. In short I already tried it. It would be nice if you could give me a tip about what it might be. You know your module better than I do.

Assambra commented 3 years ago

As I have already written, the main problem is that he does not find the country or does not get the correct values.

mam08ixo commented 3 years ago

What do you mean by "does not find the country"? Without specifying country and postal code, the DHL shipping method (with its service box, including Packstation button) should not even be available in checkout. Did you configure something in Sales → Tax → Default Tax Destination Calculation maybe that sets the quote address to invalid defaults?

Assambra commented 3 years ago

Unbenannt-9

ngolatka commented 3 years ago

That looks very broken to me.

Here's what a working popup should look like:

image

Note that you are also missing the stuff I marked in red on my screenshot.

Is your screenshot based on a default Magento checkout, or a customized one? If it's customized, please check again with a vanilla checkout. Also check the browser console for JS errors and other things.

By the way: I just verified that it works perfectly fine in version 1.5.1.

Assambra commented 3 years ago

It works with the default theme but if i switch to the custom theme it looks like the picture i send

ngolatka commented 3 years ago

Sorry, in that case, I can only repeat what my colleagure @mam08ixo already said:

We cannot support custom themes though if they take shortcuts or do things differently than the standard checkout.

mam08ixo commented 3 years ago

The country options are taken from local storage. Please check how this looks in your case.

country_options

You may also debug the JS component: https://github.com/netresearch/dhl-module-ui/blob/1.2.3/view/frontend/web/js/view/input/shopfinder.js#L57

Assambra commented 3 years ago

Unbenannt-1

mam08ixo commented 3 years ago

Looking good to me. Now you only have to find out why the country options are not set accordingly.

A timing issue maybe? Parcel shop component initialized before local storage is populated via checkout-data/get REST call? https://github.com/netresearch/dhl-module-ui/blob/1.2.3/view/frontend/web/js/action/checkout/webapi/get-checkout-data.js#L42

Assambra commented 3 years ago

First of all, thanks for your help. Debugging a website is beyond my ability. I hoped there was something obvious to fix. I will then contact the person who created the theme and hope he can help.

The only thing that struck me is i have several DE Plz Objects is this normal? like DE12345 DE72805 and so on.

mam08ixo commented 3 years ago

Yes that is expected behavior. For every postal code you enter in checkout, an entry in the local storage will be made. That is because the available services and service options can differ, for instance next possible delivery date in rural or metropolitan areas.

Assambra commented 3 years ago

I would like to give you a short feedback. It works as it should now. But unfortunately I can't say 100% what it was. But for others who may have a similar problem. I accelerated the site and for this I installed the Apache mod_http2. I can't say how it all goes together, but I'm happy that it works now. Thanks to everyone who supported me.

Assambra commented 3 years ago

Afterwards I tried it again and noticed that it didn't work again today. It stays weird. If I know more I will give you a feedback.

ngolatka commented 3 years ago

internal Ref: DHLGW-1091

Assambra commented 3 years ago

I would now like to give a small update. I am now using a new theme. The same error here. Both themes have an AJAX shopping cart solution, only if I deactivate it does work. Maybe you should take a closer look at the problem with your Extension and AJAX Shopping Cart. I hope you can find the Problem and fix it so that others and me can use it together.

madonzy commented 2 years ago

I have the same problem on M2.4.2 and I also checked the dev console. There's a CSP issue when loading the map.

Screen Shot 2021-08-03 at 14 19 41
mam08ixo commented 2 years ago

@madonzy We are still struggling to understand how the map can be initialized with empty country dropdown. Any findings or details may help (module version, guest/registered checkout, checkout customizations, steps to reproduce, etc.)

If you have a publicly available instance where the issue can be reproduced, you may also add the details here or send them to the extension support.

Is the CSP issue related? Is it actually map content that is not being loaded?

Assambra commented 2 years ago

@madonzy do you have a AJAX Shopping Cart solution? If yes try to disable it, clear the shopping cart, clear cookies site cache and so on and try again. This is the problem in my case if i disable this cart solution it works on my page. The Problem still exist on my site and the error is the same. It cames from the empty country.

Assambra commented 2 years ago

Packstation

mam08ixo commented 2 years ago

Thank you, I can confirm that we need to add a CSP whitelist policy for mapbox but this is not the cause of the issue.

Assambra commented 2 years ago

Packstation-working

Here some image that it can work with disabled AJAX Shopping Cart solution!

@madonzy please try to reproduce any AJAX Shopping Cart solution(try some free one from the Magento Marktplace maybe there will be the same Error). I have two Themes with a different AJAX Shopping cart solution included and on both Themes the only way was to disable it and the Packstation/no country problem are gone. If you want invastigate you can try it on my page give me a shout.

mam08ixo commented 2 years ago

@Assambra In your shop, missing directory-data in local storage causes the problem.

local_storage__directory_data vs. local_storage__no_directory_data

No idea why directory-data is not present or why it is not loaded when being accessed but we will come up with a workaround.

Assambra commented 2 years ago

I updated the post before and the solution is disabled try again and all will work

mam08ixo commented 2 years ago

@Assambra By the way, the missing directory data in your store also causes the country name not being displayed in the checkout payment step (billing and shipping address).

Assambra commented 2 years ago

Sorry for the late reply and thanks for the hint. I would not have noticed because I only send within Germany and have excluded all other countries. So I didn't even look for something like that.

mam08ixo commented 2 years ago

We now try to load the directory data explicitly if it is not already available. Please check if DHL Shipping v2.1.0 solves the issue for you.

Assambra commented 2 years ago

Unfortunately, it doesn't work as expected. It only works if the website is reloaded once.

mam08ixo commented 2 years ago

Okay we could not test this because we were not able to replicate the issue. I suggest you fix the root cause and make sure that directory data is loaded when the customer enters checkout. Maybe our (re)loading of directory data is too late for rendering the component. This is our change that was supposed to fix the issue: https://github.com/netresearch/module-shipping-ui/blob/2.0.3/view/frontend/web/js/model/checkout/country-options.js#L18

ngolatka commented 2 years ago

No further activity -> issue closed.