Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customer Name Prefix shows white space when extra separator is addes.… #18077

Closed
wants to merge 4 commits into from

Conversation

ivanbastos
Copy link

@ivanbastos ivanbastos commented Sep 16, 2018

#17861

Description

When we configure the Customer Name Prefix and leave at the end of the field the separator ";" Magento renders a white field. When we set the option with required is impossible leave the white field so I filter the values and clean the white option to have only the prefix defined

Honestly I believe that is not a bug but only a way to work with Magento. If you simple not ends the options with the separator the problem will not happens but once some users are not familiar with this logic I believe is better filter the options and remove the white spaces

Fixed Issues (if relevant)

  1. Customer Name Prefix shows white space when extra separator is addes. #17861: Customer Name Prefix shows white space when extra separator is addes.
  2. Issue fixed: Customer Name Prefix shows white space when extra separator is addes. #17861

Manual testing scenarios

  1. Enable the customer name prefix on Store>Configuration>Customer>Customer Configuration.
  2. Go to Name and Address Option
  3. Select in Show Prefix the option Required
  4. Insert the prefixes desired in Prefix Dropdown Options using the separator ; and leave the ; at the end like (Mr;Ms;Mrs;)
  5. Go to the frontend page and create a new user to see that the white option will not appear

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Sep 16, 2018

CLA assistant check
All committers have signed the CLA.

@magento-engcom-team
Copy link
Contributor

Hi @ivanbastos. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me $VERSION instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@dmanners
Copy link
Contributor

@ivanbastos thanks for this PR. I remember an older issue and PR with regards to this. I think we need to make sure that we can still add an empty option when we choose prefix as optional. If that is not the case with your code changes then I would suggest it will need to be updated.

Previous Issue: #7241
Previous PR: #11462

@sidolov
Copy link
Contributor

sidolov commented Sep 28, 2018

Hi @ivanbastos , please, take a look at comment from @dmanners
Thanks!

@josefbehr
Copy link
Contributor

@ivanbastos I think this is not a bug, but intended behavior. It should be possible to have an empty option. But you're also right in that this is a problem if the field is set to required. Due to the PR @dmanners mentioned (#11462), an empty option is added in the optional case automatically, so I do not see a problem filtering it out, in general. I'll just have to check that optional prefix/suffix still offers the empty option with your change.

@josefbehr
Copy link
Contributor

@dmanners @ivanbastos I just verified that this change does not break PR #11462
After my requested change is implemented, I see no reason not to accept this PR.

@@ -95,6 +103,7 @@ private function prepareNamePrefixSuffixOptions($options, $isOptional = false)
foreach ($options as $value) {
$value = $this->escaper->escapeHtml(trim($value));
$result[$value] = $value;
$result = array_filter($result);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this outside the loop.

@sidolov
Copy link
Contributor

sidolov commented Oct 29, 2018

Hi @ivanbastos , I am closing this PR now due to inactivity.
Please reopen and update if you wish to continue.
Thank you for the collaboration!

@sidolov sidolov closed this Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Customer Name Prefix shows white space when extra separator is addes.
8 participants