File tree Expand file tree Collapse file tree 3 files changed +54
-2
lines changed
Reports/Block/Adminhtml/Grid/Column/Renderer Expand file tree Collapse file tree 3 files changed +54
-2
lines changed Original file line number Diff line number Diff line change @@ -63,4 +63,34 @@ public function getDefaultCurrency(\Magento\Framework\App\RequestInterface $requ
63
63
64
64
return $ currencyCode ;
65
65
}
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
+ }
66
96
}
Original file line number Diff line number Diff line change @@ -115,9 +115,9 @@ private function getStoreCurrencyCode(DataObject $row): string
115
115
$ catalogPriceScope = $ this ->getCatalogPriceScope ();
116
116
$ storeId = $ this ->_request ->getParam ('store_ids ' );
117
117
if ($ catalogPriceScope != 0 && !empty ($ storeId )) {
118
- $ currencyCode = $ this ->_storeManager ->getStore ($ storeId )->getBaseCurrencyCode ();
118
+ $ currencyCode = $ this ->_storeManager ->getStore ($ storeId )->getDefaultCurrencyCode ();
119
119
} elseif ($ catalogPriceScope != 0 ) {
120
- $ currencyCode = $ this ->_currencyLocator ->getDefaultCurrency ($ this ->_request );
120
+ $ currencyCode = $ this ->_currencyLocator ->getDisplayCurrency ($ this ->_request );
121
121
} else {
122
122
$ currencyCode = $ this ->_getCurrencyCode ($ row );
123
123
}
Original file line number Diff line number Diff line change @@ -656,6 +656,28 @@ public function getBaseCurrencyCode()
656
656
return $ currencyCode ;
657
657
}
658
658
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
+
659
681
/**
660
682
* Retrieve website base currency
661
683
*
You can’t perform that action at this time.
0 commit comments