2
votes

I have to keep USD as base currency to enable PayPal but I have kept default display currency as INR. Now conversion rate of 45rs per USD give me nasty decimal INR prices, I wana get rid of that, Magento must be using some function to convert price from base currency to INR while showing up INR prices everywhere, What is that function and How can I modify it to always give round off values??

I found :

$price = Mage::helper('directory')->currencyConvert($tax->getPrice($product, $product->getFinalPrice(), false), $fromCur, $toCur);

Is this the function Magento itself uses to convert prices in different currencies, If it is where it is defined?

1
Thanks for telling me , will do that.nishant

1 Answers

5
votes

The currency conversion is performed by Mage_Directory_Model_Currency in the following method.

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()));
}

You could create an app/code/local version of this file, or write your own module and rewrite the core.

Make sure you test this very carefully in your dev server and Paypal sandbox, since Paypal will reject any transactions that have errors!