Skip to content

Commit 9bb9407

Browse files
committed
ACP2E-3276: Order reports showing the wrong currency symbol
1 parent b2b7b45 commit 9bb9407

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

app/code/Magento/Directory/Model/Currency/DefaultLocator.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,34 @@ public function getDefaultCurrency(\Magento\Framework\App\RequestInterface $requ
6363

6464
return $currencyCode;
6565
}
66+
67+
/**
68+
* Retrieve display currency for selected store, website or website group
69+
* @param \Magento\Framework\App\RequestInterface $request
70+
* @return string
71+
*/
72+
public function getDisplayCurrency(\Magento\Framework\App\RequestInterface $request): string
73+
{
74+
if ($request->getParam('store')) {
75+
$store = $request->getParam('store');
76+
$currencyCode = $this->_storeManager->getStore($store)->getDefaultCurrencyCode();
77+
} else {
78+
if ($request->getParam('website')) {
79+
$website = $request->getParam('website');
80+
$currencyCode = $this->_storeManager->getWebsite($website)->getDefaultCurrencyCode();
81+
} else {
82+
if ($request->getParam('group')) {
83+
$group = $request->getParam('group');
84+
$currencyCode = $this->_storeManager->getGroup($group)->getWebsite()->getDefaultCurrencyCode();
85+
} else {
86+
$currencyCode = $this->_configuration->getValue(
87+
\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT,
88+
'default'
89+
);
90+
}
91+
}
92+
}
93+
94+
return $currencyCode;
95+
}
6696
}

app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Currency.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ private function getStoreCurrencyCode(DataObject $row): string
115115
$catalogPriceScope = $this->getCatalogPriceScope();
116116
$storeId = $this->_request->getParam('store_ids');
117117
if ($catalogPriceScope != 0 && !empty($storeId)) {
118-
$currencyCode = $this->_storeManager->getStore($storeId)->getBaseCurrencyCode();
118+
$currencyCode = $this->_storeManager->getStore($storeId)->getDefaultCurrencyCode();
119119
} elseif ($catalogPriceScope != 0) {
120-
$currencyCode = $this->_currencyLocator->getDefaultCurrency($this->_request);
120+
$currencyCode = $this->_currencyLocator->getDisplayCurrency($this->_request);
121121
} else {
122122
$currencyCode = $this->_getCurrencyCode($row);
123123
}

app/code/Magento/Store/Model/Website.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,28 @@ public function getBaseCurrencyCode()
656656
return $currencyCode;
657657
}
658658

659+
/**
660+
* Retrieve website default currency code
661+
*
662+
* @return string
663+
*/
664+
public function getDefaultCurrencyCode()
665+
{
666+
if ($this->getConfig(
667+
\Magento\Store\Model\Store::XML_PATH_PRICE_SCOPE
668+
) == \Magento\Store\Model\Store::PRICE_SCOPE_GLOBAL
669+
) {
670+
$currencyCode = $this->_coreConfig->getValue(
671+
\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT,
672+
'default'
673+
);
674+
} else {
675+
$currencyCode = $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT);
676+
}
677+
678+
return $currencyCode;
679+
}
680+
659681
/**
660682
* Retrieve website base currency
661683
*

0 commit comments

Comments
 (0)