Skip to content

Commit b7b5fa2

Browse files
committed
ACP2E-3276: Order reports showing the wrong currency symbol
1 parent f507704 commit b7b5fa2

File tree

3 files changed

+29
-25
lines changed

3 files changed

+29
-25
lines changed

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Directory\Model\Currency;
77

8+
use Magento\Store\Model\Store;
9+
810
class DefaultLocator
911
{
1012
/**
@@ -15,7 +17,7 @@ class DefaultLocator
1517
protected $_configuration;
1618

1719
/**
18-
* Store manager
20+
* Store manager model
1921
*
2022
* @var \Magento\Store\Model\StoreManagerInterface
2123
*/
@@ -35,7 +37,9 @@ public function __construct(
3537

3638
/**
3739
* Retrieve default currency for selected store, website or website group
40+
*
3841
* @todo: Refactor to ScopeDefiner
42+
*
3943
* @param \Magento\Framework\App\RequestInterface $request
4044
* @return string
4145
*/
@@ -66,6 +70,7 @@ public function getDefaultCurrency(\Magento\Framework\App\RequestInterface $requ
6670

6771
/**
6872
* Retrieve display currency for selected store, website or website group
73+
*
6974
* @param \Magento\Framework\App\RequestInterface $request
7075
* @return string
7176
*/
@@ -77,7 +82,7 @@ public function getDisplayCurrency(\Magento\Framework\App\RequestInterface $requ
7782
} else {
7883
if ($request->getParam('website')) {
7984
$website = $request->getParam('website');
80-
$currencyCode = $this->_storeManager->getWebsite($website)->getDefaultCurrencyCode();
85+
$currencyCode = $this->getDefaultCurrencyCode($website);
8186
} else {
8287
if ($request->getParam('group')) {
8388
$group = $request->getParam('group');
@@ -93,4 +98,26 @@ public function getDisplayCurrency(\Magento\Framework\App\RequestInterface $requ
9398

9499
return $currencyCode;
95100
}
101+
102+
/**
103+
* Retrieve website default currency code
104+
*
105+
* @param string $website
106+
* @return string
107+
*/
108+
private function getDefaultCurrencyCode($website): string
109+
{
110+
$website = $this->_storeManager->getWebsite($website);
111+
$priceScope = $website->getConfig(Store::XML_PATH_PRICE_SCOPE);
112+
if ($priceScope == Store::PRICE_SCOPE_GLOBAL) {
113+
$currencyCode = $this->_configuration->getValue(
114+
\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT,
115+
'default'
116+
);
117+
} else {
118+
$currencyCode = $website->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT);
119+
}
120+
121+
return $currencyCode;
122+
}
96123
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
/**
2424
* Adminhtml grid item renderer currency
2525
*
26-
* @author Magento Core Team <[email protected]>
2726
* @api
2827
* @since 100.0.2
2928
*

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -656,28 +656,6 @@ 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-
681659
/**
682660
* Retrieve website base currency
683661
*

0 commit comments

Comments
 (0)