experius / Magento-2-Module-Experius-Postcode-NL

PostcodeNl Api Magento 2 Module. Available At Packagist
https://packagist.org/search/?q=experius
Open Software License 3.0
29 stars 31 forks source link

Make module compatible with OneStepCheckout #47

Open tramov opened 4 years ago

tramov commented 4 years ago

Below are the changes / hacks I needed to make to make the plugin work with the onestepcheckout.com module:

Add a custom field at position #6 in the OneStepCheckout configuration:

image

Modify Block/Checkout/LayoutProcessor.php to add the fields at sortOrder position #6:

image

Small change to the CSS, remove the following from Experius/Postcode/view/frontend/web/css/source/module/_checkout-fields.less

image

Result:

image

speedupmate commented 3 years ago

to get it to work with OneStepCheckout you would need to:

  1. add a field-set component experius_postcode_fieldset to Stores > Configuration > Sales > OneStepCheckout > Shipping address fields and settings and drag before street field

  2. open up https://github.com/experius/Magento-2-Module-Experius-Postcode-NL/blob/48f4487a6f22d5bd7a107c3f8731da10a37b3bc2/Block/Checkout/LayoutProcessor.php#L168 and in method getPostcodeFields comment out all the sortOrder nodes in their uiComponents inside a fieldset

    //'sortOrder' => (string)($this->getStartSortOrder() + 50),

JeroenGerth commented 1 year ago

to get it to work with OneStepCheckout you would need to:

  1. add a field-set component experius_postcode_fieldset to Stores > Configuration > Sales > OneStepCheckout > Shipping address fields and settings and drag before street field
  2. open up https://github.com/experius/Magento-2-Module-Experius-Postcode-NL/blob/48f4487a6f22d5bd7a107c3f8731da10a37b3bc2/Block/Checkout/LayoutProcessor.php#L168 and in method getPostcodeFields comment out all the sortOrder nodes in their uiComponents inside a fieldset //'sortOrder' => (string)($this->getStartSortOrder() + 50),

This is how we implemented this postcode check in OSC. Still i'm facing an issue.

Usually, when navigating to the checkout while the customer is logged in, the user can select an address form his addressbook. The default address is always preselected. But somehow when using this postcode check, the default address gets deselected while loading the checkout. The user tries to order and gets an error about "no address selected" and gets confused, thinking "what you mean.. there is an address right?" (especially when there is only 1 address shown)... and leaving the checkout potentially.

In Luma the module works fine, but in OSC i am facing this problem. Any ideas how to fix it?

How the checkout is loaded. Scherm­afbeelding 2023-03-29 om 13 48 36

How it is suppose to be loaded. With default address selected. This makes it clear that the user can choose an address from the list. Scherm­afbeelding 2023-03-29 om 13 43 53