Closed HenKun closed 3 years ago
The street splitter is able to extract street name and number from valid addresses. Your input is not a valid address format.
Address form validation is a completely different thing and not the responsibility of the shipping module. If you need assistance with address auto-completion and verification, I suggest having a look at the Deutsche Post modules bundled with the extension since v1.3.0.
@HenKun I'd also like to point out that this case is not as simple as it might look. Please see this Github issue for a (very lengthy) discussion on the reasons. Yes, it's about the legacy DHL module, but it's still relevant.
There are in fact street names with numbers in them, like "M1" and many more in Mannheim, Germany or "Abbey Road NW8" in the UK. I hope that illustrates the problem, and why building a 100% perfect solution is very hard.
@ngolatka Thanks for the link, interesting considerations. I see the reasoning. We solved it on our site 'cause we more often have malformatted input than weird addresses from Mannheim. But it cannot be generalized, of course, so making a custom solution for our case is pretty fine.
Although
Dhl\ShippingCore\Model\Util\StreetSplitter
has a massively complex regex, it fails on the simple case where there is no space between street name and house number.E.g.
Musterstraße12
as street name leads to a not detected house number, see the following screenshot.Labels cannot be created due to this issue and the address needs to be corrected manually.
We now solved it on our end with a custom plugin that matches this case, but it would be better if DHL Core module itself solves the issue.