From 687bccbe02f1bb55214f9a85e7d94730573fe722 Mon Sep 17 00:00:00 2001 From: eduard13 Date: Wed, 15 May 2019 19:39:24 +0300 Subject: [PATCH 1/2] Defining the zip attributes based on the zip schema --- guides/v2.1/howdoi/checkout/checkout_zip.md | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/guides/v2.1/howdoi/checkout/checkout_zip.md b/guides/v2.1/howdoi/checkout/checkout_zip.md index 6cbe417bc88..c814d945ed6 100644 --- a/guides/v2.1/howdoi/checkout/checkout_zip.md +++ b/guides/v2.1/howdoi/checkout/checkout_zip.md @@ -17,6 +17,28 @@ When a shopper specifies the country and ZIP code in the shipping address during In Magento the input masks for the **ZIP code** field are specified in the `/etc/zip_codes.xml`. Input masks are specified per country, and are entered in the form of regular expressions. The syntax of defined by the [zip_code.xsd]({{ site.mage2bloburl }}/{{ page.guide_version }}/app/code/Magento/Directory/etc/zip_codes.xsd) scheme. +The following table defines the `zip` node attributes: + + Attribute name | Required | Description +--- | --- | --- +`countryCode` | Yes | The country code (Alpha-2 format) for which the zip is defined + +The following table defines the `code` node attributes: + + Attribute name | Required | Description +--- | --- | --- +`id` | Yes | A random unique name within the same list. +`example` | Yes | An example of the allowed pattern. +`active` | No | Defines if this zip pattern is active or not. + +You can define several zip `code` patterns for the same country, by passing a list of `codes`. +```xml + + ^[0-9]{5}$ + ^[a-zA-z]{2}[0-9]{4}$ + +``` + For the sake of compatibility, upgradability, and easy maintenance, do not edit the default Magento code. Add your customizations in a separate, custom module. For your ZIP code input mask customization to be applied correctly, your custom module should depend on the `Magento_Directory` module. Do not use `Ui` for your custom module name, because `%Vendor%_Ui` notation, required when specifying paths, might cause issues. ## Add custom ZIP code input masks {#add} From 9454fb5d73989fbd690590e0f78e64b43575fbaa Mon Sep 17 00:00:00 2001 From: eduard13 Date: Thu, 16 May 2019 08:50:09 +0300 Subject: [PATCH 2/2] Adding an example of zip node --- guides/v2.1/howdoi/checkout/checkout_zip.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/guides/v2.1/howdoi/checkout/checkout_zip.md b/guides/v2.1/howdoi/checkout/checkout_zip.md index c814d945ed6..41266e99e89 100644 --- a/guides/v2.1/howdoi/checkout/checkout_zip.md +++ b/guides/v2.1/howdoi/checkout/checkout_zip.md @@ -23,6 +23,12 @@ The following table defines the `zip` node attributes: --- | --- | --- `countryCode` | Yes | The country code (Alpha-2 format) for which the zip is defined +```xml + + + +``` + The following table defines the `code` node attributes: Attribute name | Required | Description