-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 #21725 - Render price on category list with correct precision for current locale #31661
base: 2.5-develop
Are you sure you want to change the base?
Fix #21725 - Render price on category list with correct precision for current locale #31661
Conversation
…ion for current locale
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 |
@@ -387,7 +394,8 @@ public function __construct( | |||
OrderItemRepositoryInterface $itemRepository = null, | |||
SearchCriteriaBuilder $searchCriteriaBuilder = null, | |||
ScopeConfigInterface $scopeConfig = null, | |||
RegionFactory $regionFactory = null | |||
RegionFactory $regionFactory = null, | |||
?PricePrecisionInterface $pricePrecision = null |
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.
I don't think it makes sense to allow to pass null
as argument explicitly
?PricePrecisionInterface $pricePrecision = null | |
PricePrecisionInterface $pricePrecision = null |
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.
Sure @sivaschenko, I thought that should be done according to Adding a constructor parameter point from https://devdocs.magento.com/contributor-guide/backward-compatible-development/, I can change that
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.
Hm, this change was introduced in magento/devdocs#6033
I don't think that is correct.
@sidolov @gabrieldagama what do you think guys?
* @deprecated precision should be retrieved from current locale | ||
* @see \Magento\Framework\Pricing\Price\PricePrecisionInterface::getPrecision | ||
*/ | ||
const DEFAULT_PRECISION = null; |
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.
I'd keep the constant value unchanged, it's enough to deprecate the constant.
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.
@sivaschenko making this fix without changing this constant value would require many more code changes. This constant is used in many places in whole codebase (i.e.
magento2/app/code/Magento/Catalog/Model/ProductRender/FormattedPriceInfoBuilder.php
Line 64 in fbfac3e
PriceCurrencyInterface::DEFAULT_PRECISION, |
format
method.
And I changed this parameter to be null
as default, so my idea was to:
- change const value to also
null
- so every place that uses it, just to pass it as default value to the methods I changed, will also work as expected - deprecate const - so make a note across codebase that every it occurrence should be replaced with simply
null
, but maybe in some next PR, to not make it over complicated.
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.
I think eliminating this constant from the calls is a safer and more backward compatible change than changing the constant value, considering that we don't know how this constant might be currently used in extensions and customizations.
@Bartlomiejsz thanks for the updates! I've moved the pull request to To Approve column and launched a formal approval process for this change. Internal ticket: https://jira.corp.magento.com/browse/MC-40452 |
# Conflicts: # app/code/Magento/Sales/Model/Order.php
…move usage of it on method calls
@magento run all tests |
@magento run Unit Tests |
@sivaschenko that seems to be ready for review :) |
@magento run Functional Tests B2B |
This change was not approved for the 2.4 release line. Internal approval request MC-40452. There is no active delivery of pull request to 2.5 release line currently, so the PR processing might be delayed. |
Added this PR to 2.5 milestone |
Description (*)
I recreated #21829 here, which got accidentally closed, when I tried to re-create changes on top of 2.5-develop. I adjusted changes to latest comment from @sivaschenko - while I will work on fixing test that might still fail, would be great if you could verify if such approach is what you meant.
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)