magento / inventory

Magento Inventory Project (a.k.a MSI)
Open Software License 3.0
337 stars 248 forks source link

Offline Pick in store location postcode lookup not working for dutch postcodes #3224

Open bmelman opened 4 years ago

bmelman commented 4 years ago

Preconditions (*)

  1. Magento 2.4.1
  2. bin/magento inventory-geonames:import nl_NL
  3. use Dutch Address/Postcode in checkout

Steps to reproduce (*)

  1. Enable multiple Sources for a product, add it to cart and proceed to checkout
  2. Select Store Pickup after filling addresss details including postcode

Expected result (*)

  1. Should return closest source location

Actual result (*)

  1. @ pick in store: "We could not preselect pickup location based on available information, please select it manually."
  2. looking up locations using postcode won't work

Actual dutch postcode format is: <code id="pattern_1" active="true" example="1234 AB">^[1-9][0-9]{3}\s?[a-zA-Z]{2}$</code> (from magento/vendor/magento/module-directory/etc/zip_codes.xml) i.e. 1234AB or 1234 AB

but after: bin/magento inventory-geonames:import nl_NL the inventory_geoname table contains only the numeric part (we are a small country so for location the letters aren't important).

country_code postcode city region province latitude longitude
NL 9401 Assen Drenthe 0106 52.9938 6.5623
NL 9402 Assen Drenthe 0106 53.0043 6.5594

Apparently the postcode format is not the same as the inventory_geoname imported postcodes.

So when I alter Model/ResourceModel/GetGeoNamesDataByAddress.php line 57: ->where('postcode = ?', $address->getPostcode()) to ->where('postcode = ?', substr($address->getPostcode(),0,4) It works fine, but this is no solution for other countries/formats

m2-assistant[bot] commented 4 years ago

Hi @bmelman. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


SmokinX commented 3 years ago

Just an extra remark: I just want Pickup as an option. No fancy postal code lookups. So why not add options to skip lookup. Certainly with only ONE source location.