开发者

Magento Round off currency conversions

I have to keep USD as base currency to enable PayPal but I have kept default disp开发者_StackOverflow中文版lay 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?


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜