You cannot convert one price currency price to base currency
.
because magento did not calculate base currency rate from other current rate
.
Magento define a price in BASE currency which will convert using rate for other currency
Magento is calculate other price from base Currency
Please got see Mage_Directory_Model_Currency class on function
public function convert($price, $toCurrency=null)
{
if (is_null($toCurrency)) {
return $price;
}
elseif ($rate = $this->getRate($toCurrency)) {
return $price*$rate;
}
throw new Exception(Mage::helper('directory')->__('Undefined rate from "%s-%s".', $this->getCode(), $toCurrency->getCode()));
}
Here show that you can not get base currency from other currency
That means that
you code format is
Mage::helper('directory')->currencyConvert($amt, 'baseCurrecy', 'your currency');
revise it not possible using this function
Mage::helper('directory')->currencyConvert($amt, 'your currency', 'baseCurrecy');
Magento uses webservicex.net to pull the currency conversion rates.
You can check that by visiting
System->Configuration -> Currency setup -> webservicex.
then, take a look at
Mage_Directory_Model_Currency_Import_Webservicex
and
Mage_Directory_Model_Observer
Hope this helps.
Best Answer
I reckon you should use
Magento\Directory\Model\Currency
class instead ofMagento\Framework\Pricing\PriceCurrencyInterface
.On top of that, I suggest you never use the object manager directly and use dependency injection instead.