4

I am trying to show item price with symbol in override email template on order create, and my site have euro and $ both currency.

Is there any way to get current currency symbol, Please share if have.

  • 1
    protected $this->storeManage; \Magento\Store\Model\StoreManagerInterface $storeManage $this->storeManage = $storeManage $this->storeManager->getStore()->getCurrentCurrencyCode(); – Jackson Dec 28 '16 at 6:20
  • 1
    protected causes error – Ram Pratap Singh Gour Dec 28 '16 at 7:13
  • what you mean by current currency symbol – Amit Bera Dec 28 '16 at 7:59
  • current currency symbol means when I am going to create a order by backend. There is dropdown to select currency for order, – Ram Pratap Singh Gour Dec 28 '16 at 8:59
2

Try to use

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$priceHelper = $objectManager->get('Magento\Framework\Pricing\Helper\Data');
$priceHelper->currency($YOURPRICE, true, false);

Maybe it will help you.

| improve this answer | |
  • It is working fine for euro....But when switching to $ price is coming in round figure – Ram Pratap Singh Gour Dec 28 '16 at 6:50
1

I donot know,what extract you want.

In magento, whenever a system have multiple currencies means system have a base currency and have multiple currencies. And multiple currencies manage via rate,

Then whensoever an order placed at system and then base currency and order place time currency both codes are save at order table sales_order.

You can find

base currency code from base_currency_code field

order time currency code from order_currency_code

| improve this answer | |
  • Actully amit, I override a email template where I need to show item price, priceFormatter($_item->getPrice()) by this price is coming but in round, like 0.73 will be 8 – Ram Pratap Singh Gour Dec 28 '16 at 8:45
1

To get the Currency Symbol :

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();

$priceHelper = $objectManager->create('Magento\Framework\Pricing\Helper\Data');

$price =  1000; //Your Price

$formattedPrice = $priceHelper->currency($price, true, false);
| improve this answer | |
1

Currency code and symbol:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$currencysymbol= $objectManager
->get('Magento\Store\Model\StoreManagerInterface');
$currencyCode = $currencysymbol->getStore()->getCurrentCurrencyCode();
$currency  = $objectManager
->create('Magento\Directory\Model\CurrencyFactory')
->create()->load($currencyCode);
$currencySymbol= $currency->getCurrencySymbol();

Simple way to get price with currency

$this->helper('Magento\Framework\Pricing\Helper\Data')->currency($price,true,false); //$price is final amount
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.