-
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
MC-23915: Wrong currency symbol in creditmemo_grid & sales_order_view > creditmemo grid for subtotal & Shipping and Handling fee #31553
MC-23915: Wrong currency symbol in creditmemo_grid & sales_order_view > creditmemo grid for subtotal & Shipping and Handling fee #31553
Conversation
… > creditmemo grid for subtotal & Shipping and Handling fee
Hi @engcom-Echo. 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 |
/** | ||
* @var OrderRepositoryInterface | ||
*/ | ||
private $order; |
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.
private $order; | |
private $orderRepository; |
$currencyCode = isset($item['order_currency_code']) | ||
? $item['order_currency_code'] | ||
: $this->order->get($item['order_id'])->getOrderCurrencyCode(); |
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.
- Looks like here we can use
??
here
$currencyCode = isset($item['order_currency_code']) | |
? $item['order_currency_code'] | |
: $this->order->get($item['order_id'])->getOrderCurrencyCode(); | |
$currencyCode = $item['order_currency_code'] ?? $this->order->get($item['order_id'])->getOrderCurrencyCode(); |
- Loading objects in the loop is a really heavy operation and not recommended. Can we load all needed orders at once? Or maybe we can do that when preparing dataSource?
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.
- Thanks.
- Will do
) { | ||
$this->priceFormatter = $priceFormatter; | ||
$this->currency = $currency ?: \Magento\Framework\App\ObjectManager::getInstance() | ||
->create(Currency::class); | ||
$this->order = $order ?: \Magento\Framework\App\ObjectManager::getInstance() |
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.
$this->order = $order ?: \Magento\Framework\App\ObjectManager::getInstance() | |
$this->orderRepository = $orderRepository ?? \Magento\Framework\App\ObjectManager::getInstance() |
/** | ||
* @var OrderRepositoryInterface|MockObject | ||
*/ | ||
protected $orderMock; |
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.
protected $orderMock; | |
private $orderRepositoryMock; |
… > creditmemo grid for subtotal & Shipping and Handling fee
@magento run all tests |
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 still believe we can iterate all the orders and get all needed info with a single request instead of loading each order in the loop. Please update the solution
/** | ||
* @var OrderRepositoryInterface|MockObject | ||
*/ | ||
private $orderRepository; |
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.
private $orderRepository; | |
private $orderRepositoryMock; |
[ | ||
'currency' => $this->currencyMock, | ||
'context' => $contextMock, | ||
'order' => $this->orderRepository, |
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.
'order' => $this->orderRepository, | |
'orderRepository' => $this->orderRepositoryMock, |
public function testPrepareDataSource( | ||
$itemName, | ||
$oldItemValue, | ||
$newItemValue, | ||
$orderCurrencyCode | ||
): void { |
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.
public function testPrepareDataSource( | |
$itemName, | |
$oldItemValue, | |
$newItemValue, | |
$orderCurrencyCode | |
): void { | |
public function testPrepareDataSource( | |
string $itemName, | |
string $oldItemValue, | |
string $newItemValue, | |
?string $orderCurrencyCode | |
): void { |
… > creditmemo grid for subtotal & Shipping and Handling fee
@magento i am working on it |
@magento import code to https://github.com/magento-tsg/magento2ce |
@zakdma, an error occurred during the Pull Request import. |
@zakdma the branch with code successfully imported into |
Hi @engcom-Echo, thank you for your contribution! |
Description (*)
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
See : #22662
Questions or comments
Contribution checklist (*)