-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Fix #30073 - Store specific text swatch attribute option label with v… #30114
Conversation
… with value 0 (zero) can't be saved and automatically replaced with Admin Label value of option
Hi @Bartlomiejsz. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
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. 🕙 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 |
@magento run all tests |
@magento run Integration Tests |
Hi @Bartlomiejsz. Great work, thank you! |
Pull Request state was updated. Re-review required.
Hi @rogyar, thank you for the review. |
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Stepa4man, done
if (strpos((string)$optionId, self::BASE_OPTION_TITLE) === 0 || | ||
strpos((string)$optionId, self::API_OPTION_PREFIX) === 0) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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=)
@magento give me test instance |
Hi @Stepa4man. Thank you for your request. I'm working on Magento instance for you. |
Hi @Stepa4man, here is your Magento Instance: https://d20d7c5c6b2ce0957aacf88809bb4839.instances.magento-community.engineering |
Hi @gabrieldagama, thank you for the review. |
Hi @Stepa4man, thank you for the review. |
✔️ QA Passed Manual testing scenario:
Before: ✖️ Instead of 0 option store specific label is replaced with Admin label value After: ✔️ Store-specific option label saved as inserted |
… label with v… #30114
Hi @Bartlomiejsz, thank you for your contribution! |
@sidolov which version will contain these commits changes? |
@Stepa4man it's included to 2.4.2 release. |
…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)
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 (*)