Magento2: No option to start with blank option for prefix and suffix in checkout.

Created on 31 Oct 2016  路  9Comments  路  Source: magento/magento2

Fairly straight forward,

If you configure both/either Prefix and Suffix as Optional, and then populate the configuration list, there is no option to allow a blank option (if they choose not to select an option, it defaults to the first option in the list). Even if you precursor the list with a space and ";" it defaults to the first option after the first semi-colon.

Preconditions


  1. Magento 2.1.2 CE
  2. php 7

Steps to reproduce

  1. Go to Admin panel > Stores > Configuration > Customers > Customer Configuration
  2. Change "Show Prefix" and/or "Show Suffix" to "Optional"
  3. Populate "Prefix Dropdown Options" with : " ;Ms;Miss;Mrs;Mr;Dr;Atty;Hon;Prof;Pres;VP;MA"
  4. Populate "Suffix Dropdown Options" with : " ;Jr;Sr;Ph.D.;M.D.;R.N.;Ret."
  5. Click Save.
  6. Switch to the front-end, and add something to your cart.
  7. Go to the checkout page.
  8. You'll notice that Prefix and Suffix load with the lists, however it skips the starting "blank" option, and immediately selects "Ms" for Prefix, and "Jr" for Suffix.

Expected result

  1. If the admin selects Optional, the First options should ALWAYS be a blank (even if the admin doesn't configure a blank in the options). Id actually go as far as saying, the admin shouldn't NEED to configure a blank in the options if "Optional" is selected.

Actual result

  1. Instead of showing the first option if it is a blank, it selects the first actual option in the list, regardless of how you configure it (I understand, that its likely stripping blanks to prevent errors).

prefix-suffix-config1

prefix-suffix-noblankbydefault

Customer Fixed in 2.2.x Fixed in 2.3.x Confirmed Format is valid Ready for Work Reproduced on 2.2.x Reproduced on 2.3.x bug report

Most helpful comment

All 9 comments

Thanks for reporting, internal ticket created MAGETWO-60288

@spyrule, thank you for your report.
We've created internal ticket(s) MAGETWO-60288 to track progress on the issue.

Working on this.

I solved parts of this in #11462. An empty line is added automatically if the field is set to "optional".
Unfortunately, I wasn't able to fix the default option selection in the checkout; it still always selects the first option with a value, it should select the first option at all.

I am pretty sure that the relevant code is in app/code/Magento/Ui/view/base/web/js/form/element/select.js (plus I modified app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/optgroup.js::optionNodeFromArray where I added the line option.setAttribute('data-title', ''); before line 222; this seems like a step in the right direction).

Hi @spyrule. Thank you for your report.
The issue has been fixed in magento/magento2#11462 by @avstudnitz in 2.2-develop branch
Related commit(s):

  • 11e38f68a9956cbdc1d7c48284bc712729f43a90
  • 7800e5dd8aac704da3f2b1799baadf2a01269c61
  • 252529f0819d2792982452ed9d929d5fb526996d
  • 519b805c2853f895d804c49e08bd7a23b108c38c
  • eb79b38beb6b79411fe95d30e324d7d094ab5874
  • fce3afe6390be6c0eb2d5fcdb2f76108d6a44e77
  • 3e38118c1e7f92e77963a6ae4f42e66520e6f58f

The fix will be available with the upcoming patch release.

Hi @spyrule. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1297 by @magento-engcom-team in 2.3-develop branch
Related commit(s):

  • 21cfb6ab689b52d27dfe6816b27542f03ffbd73b
  • d173193c9612135a44d4f0490eef5995cb82c89f
  • b5a4ee42e65fec38b4d088335f44fbfd7e93c64c
  • f6570bd5d8e6b0767ce39f37d0355a5b61620638
  • b32bdc9a34247f33af0d7f2ed80868c55b1e5aae
  • 3c6d9bef7435b10fbf9570332ce27f6ceae9a7ac
  • d4c7ca0d4aeac15b8961e0e8a582fe716a088972
  • 07fa73aa7e698bc212ebeb65efbe558e49ac054a
  • 60426c6cd24c2f7d1881a27459a2a46628a81b3f
  • 14f85e9cd1f6c3349a5ce35c49c14e5772687d86
  • 72b399100b50ec9efaf437e800cd057631e4d9aa
  • 5483dc7045ea37787e3119770b2c737d9992bd06
  • f442a76b9f9225217004654154a57e585b8802e5
  • af9f7cbad96e82f56e093a9bfd70edf4e2296fde
  • 8b4ad902efc299e035ff9a93e58ae96513a686c1
  • 9354bb98941bff3a1675d893a27695ddd3ffe692
  • 9c9ed9153084a0c6acb16a6cea6932c117b2d26e
  • 4a422f65ce1d0a559cf1b4d1c477b32d11f54b6b
  • b6473f6924ca933702d5936628b4e51612ac8c90
  • 0c12a7aa9a5307263426a8b2bb93a97692cdd685

The fix will be available with the upcoming patch release.

What version is this being added in?

I want to make prefix required field, but don't want an option selected by default. e..g show blank or "Select title"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ostmond picture ostmond  路  3Comments

xi-ao picture xi-ao  路  3Comments

denis-g picture denis-g  路  3Comments

salelsol picture salelsol  路  3Comments

andreaskoch picture andreaskoch  路  3Comments