magento/magento2#32066: Fix duplicate customer prefix/suffix dropdown options - #41053
Open
swnsma wants to merge 1 commit into
Open
magento/magento2#32066: Fix duplicate customer prefix/suffix dropdown options#41053swnsma wants to merge 1 commit into
swnsma wants to merge 1 commit into
Conversation
Name options from Options model are a numerically indexed value list, but getPrefixOptions/getSuffixOptions used isset() on array keys and re-appended the current value, so account edit showed each selected option twice. Check membership with in_array on values and append missing legacy values with list append. Align unit tests with the real list option shape.
|
Hi @swnsma. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
Contributor
Author
|
@magento run all tests |
Contributor
Author
|
@magento run Unit Tests,Integration Tests,Functional Tests CE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description (*)
Fixes duplicate name prefix / suffix options on the customer account edit form after a value is saved and the page is reloaded.
Magento\Customer\Model\Optionsreturns a numerically indexed list of option values.Name::getPrefixOptions()/getSuffixOptions()still usedisset($options[$value])(key lookup) and re-appended the current customer value with a string key. The template iterates values, so the selected option appeared twice.Change: treat options as a list — membership via
in_array(..., true), append missing legacy values with$options[] = .... Same for suffix. Unit tests updated to use list-shaped options and cover the no-duplicate path.Fixed Issues (if relevant)
Manual testing scenarios (*)
Mr;Mrs;MsMr→ Save → reload page.Mris selected (no duplicateMr).Mrs→ Save → reload.Mrsis selected and saved; options still unique.Dr): open edit page →Drappears once and is selected.Jr;Sr.Questions or comments
Contribution checklist (*)