Skip to content

Fix #30073 - Store specific text swatch attribute option label with v… #30114

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

Conversation

Bartlomiejsz
Copy link
Contributor

@Bartlomiejsz Bartlomiejsz commented Sep 19, 2020

…alue 0 (zero) can't be saved and automatically replaced with Admin Label value of option

Description (*)

The issue is fixed specifically by https://github.com/magento/magento2/pull/30114/files#diff-e82f73165c79d2422b9b50632a4ff4feL355 - rest of modifications in the class are just cleanup

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes Store specific text swatch attribute option label with value 0 (zero) can't be saved and automatically replaced with Admin Label value of option #30073

Manual testing scenarios (*)

Please check fixed issue for testing scenario

Questions or comments

I believe unit test should be enough for such type of change

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 are green)

… with value 0 (zero) can't be saved and automatically replaced with Admin Label value of option
@m2-assistant
Copy link

m2-assistant bot commented Sep 19, 2020

Hi @Bartlomiejsz. 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 give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@Bartlomiejsz
Copy link
Contributor Author

@magento run all tests

@Bartlomiejsz
Copy link
Contributor Author

@magento run Integration Tests

@rogyar
Copy link
Contributor

rogyar commented Sep 19, 2020

Hi @Bartlomiejsz. Great work, thank you!
I don't see the failing integration tests, only the skipped ones. So, I believe we don't have an issue there.

@rogyar rogyar self-assigned this Sep 19, 2020
rogyar
rogyar previously approved these changes Sep 19, 2020
@rogyar rogyar added Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Progress: pending review labels Sep 19, 2020
@ghost ghost dismissed rogyar’s stale review September 19, 2020 15:10

Pull Request state was updated. Re-review required.

@magento-engcom-team
Copy link
Contributor

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

Copy link
Contributor

@Stepa4man Stepa4man left a comment

Choose a reason for hiding this comment

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

Hi @Bartlomiejsz
Thanks for your contribution

Could you please take a look at my comments?

if (isset($optionsArray['delete']) && isset($optionsArray['delete'][$optionId])
&& $optionsArray['delete'][$optionId] == 1
) {
if (isset($optionsArray['delete'][$optionId]) && $optionsArray['delete'][$optionId] == 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please simplify this nested ifs, handling the negative case first and use a strict comparison operator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @Stepa4man, done

Comment on lines +396 to +397
if (strpos((string)$optionId, self::BASE_OPTION_TITLE) === 0 ||
strpos((string)$optionId, self::API_OPTION_PREFIX) === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not clear what is checked here from the first glance. Can I ask you to move these conditions to another private method and name it so it displays what exactly it checks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest I'm not sure what is purpose of this check, and I'm not author of this part. I only replaced substr with strpos since it made more sense in such comparison in my opinion...

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I think we can live with this=)

@ghost ghost assigned Stepa4man Sep 21, 2020
@Stepa4man Stepa4man removed their assignment Sep 21, 2020
@Stepa4man
Copy link
Contributor

@magento give me test instance

@magento-deployment-service
Copy link

Hi @Stepa4man. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@engcom-Echo engcom-Echo self-assigned this Sep 21, 2020
@sidolov sidolov added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Sep 21, 2020
@magento-engcom-team
Copy link
Contributor

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

@magento-engcom-team
Copy link
Contributor

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

@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

Manual testing scenario:

  1. Create multistore Magento instance;
  2. Admin -> Stores -> Attribute -> Product and Create text swatch attribute;
  3. Insert in non-default store label input field 0;
  4. Save Attribute;

Before: ✖️ Instead of 0 option store specific label is replaced with Admin label value

2020-11-11_14-46

After: ✔️ Store-specific option label saved as inserted

2020-11-11_14-57

@m2-assistant
Copy link

m2-assistant bot commented Nov 13, 2020

Hi @Bartlomiejsz, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@Bartlomiejsz Bartlomiejsz deleted the bugfix/30073_store_specific_text_swatch_values branch November 13, 2020 17:26
@Stepa4man
Copy link
Contributor

@sidolov which version will contain these commits changes?

@sidolov
Copy link
Contributor

sidolov commented Dec 21, 2020

@Stepa4man it's included to 2.4.2 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: bug fix Component: Swatches Partner: Fast White Cat partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Store specific text swatch attribute option label with value 0 (zero) can't be saved and automatically replaced with Admin Label value of option
9 participants