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

[Backport] Empty option Label should always be blank even if attribute is required #18564

Conversation

gelanivishal
Copy link
Contributor

Original Pull Request

#18221

Description

When adding an empty option, Magento checks if the attribute is required or not. If it's not required, it adds an empty option with a space label ( ), but if it's required it adds an empty option without label.

The issue is when an attribute is required, the empty option is not selected by default, it's the first option. It causes some issues because if the admin does not pay attention, he/she will save the product with the first option. That's not what is expected, we want an error message telling this attribute is required.

Manual testing scenarios

Before this PR

  1. Create a dropdown attribute with some options - let's say Option 1, Option 2, Option 3
  2. Set it required
  3. Create a new product without touching this attribute
  4. The product is created with Option 1 as value for this attribute

After this PR

  1. Create a dropdown attribute with some options - let's say Option 1, Option 2, Option 3
  2. Set it required
  3. Create a new product without touching this attribute
  4. The product is not created, an error message tells this attribute is required

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-engcom-team
Copy link
Contributor

Hi @gelanivishal. 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

@gelanivishal gelanivishal changed the title [Forwardport] Label should always be blank even if attribute is required [Forwardport] Empty option Label should always be blank even if attribute is required Oct 12, 2018
@gelanivishal gelanivishal changed the title [Forwardport] Empty option Label should always be blank even if attribute is required [Backport] Empty option Label should always be blank even if attribute is required Oct 12, 2018
@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-3176 has been created to process this Pull Request

@magento-engcom-team magento-engcom-team merged commit ba9a1b2 into magento:2.2-develop Oct 13, 2018
magento-engcom-team pushed a commit that referenced this pull request Oct 13, 2018
@magento-engcom-team
Copy link
Contributor

Hi @gelanivishal. Thank you for your contribution.
We will aim to release these changes as part of 2.2.8.
Please check the release notes for final confirmation.

Please, consider to port this solution to 2.3 release line.
You may use Porting tool to port commits automatically.

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.

4 participants