-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Tierprice can t save float percentage value 18651 #19584
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
Tierprice can t save float percentage value 18651 #19584
Conversation
Hi @novikor. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
@magento-engcom-team give me test instance |
Hi @novikor. Thank you for your request. I'm working on Magento instance for you |
Hi @novikor, here is your new Magento instance. |
4c0bce9
to
48f77bd
Compare
*/ | ||
private function getPercentage(array $priceRow): ?int | ||
private function getPercentage(array $priceRow): ?float |
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.
As mentioned in previous incarnation of this PR - type hinting needs to be removed so that any of int/float is preserved. Type casting within function should be done with + 0
or * 1
.
Also, please squash all changes into a single commit.
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.
@orlangur , okay, but is there a real reason to avoid float type hint?
As I saw, there were errors in tests because of removed isset statement
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.
Please 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.
a real reason to avoid float type hint?
Just that there is no reason to convert int.
03028de
to
9f71ffd
Compare
Hi @orlangur, 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.
QA report
Problem: Incorrect percentage value of discount on product page.
Manual testing scenario:
Add new product
Add new tierprice with "discount" value "12.5"
Save the product
Go to Product Detail Page
Message "Buy 500 for $87.50 each and save 13%" is shown instead of "Buy 500 for $87.50 each and save 12.5%"
@orlangur , please check my fix for displaying correct percentage on frontend. |
@novikor as I see it's still |
Merged with MAGETWO-96016. @orlangur, can you please make review? It will be nice to have it released with MAGETWO-96016 to do not broke backward compatibility. |
@swnsma nice idea of refactoring but need some time to checkout code locally and review, hope to find some spare time this weekend. Please stay tuned! |
Hi @orlangur |
Hi @novikor can you please adjust the fix to keep existing classes/hierarchy for backward compatibility reasons. |
Display percentage on PDP in case it is set explicitly.
84cd8cc
to
4f318e5
Compare
@sivaschenko - done. Please recheck. |
Fixed invalid zeros trimming.
Fixed. |
@novikor unfortunately, only members of the maintainers team are allowed to assign developers to the pull request |
Hi @novikor, thank you for your contribution! |
Description (*)
See #18651
Fixed Issues (if relevant)
Manual testing scenarios (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
Contribution checklist (*)