Monday, 16 March 2015

Magento Paypal issues with base currency INR

Magento Paypal issues with base currency INR



Go to app/code/core/Mage/Paypal/Model/Config.php
Change this array:
protected $_supportedCurrencyCodes = array('AUD', 'CAD', 'CZK', 'DKK', 'EUR', 'HKD', 'HUF', 'ILS', 'JPY', 'MXN','NOK', 'NZD', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'USD', 'TWD', 'THB');
To
protected $_supportedCurrencyCodes = array('AUD', 'CAD', 'CZK', 'DKK', 'EUR', 'HKD', 'HUF', 'ILS', 'JPY', 'MXN','NOK', 'NZD', 'PLN', 'GBP', 'SGD', 'SEK', 'CHF', 'USD', 'TWD', 'THB','INR');
Another trick :
Go to app/code/core/Mage/Paypal/Model/Standard.php
Then change this function:
   public function canUseForCurrency($currencyCode) { return $this->getConfig()->isCurrencyCodeSupported($currencyCode); }
To
   public function canUseForCurrency($currencyCode) { if($currencyCode == 'INR') { $currencyCode = 'USD'; } return $this->getConfig()->isCurrencyCodeSupported($currencyCode); }

INR currency convert issue with paypal payment method in magento




Go to app/code/core/Mage/Paypal/Block/Standard/Redirect.php

You can see below foreach loop in this file

foreach ($standard->getStandardCheckoutFormFields() as $field=>$value) {

$form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));

}


Just replace above foreach loop with this

foreach ($standard->getStandardCheckoutFormFields() as $field=>$value) {
if($field == 'amount_1'):
$from = 'INR';
$to = 'USD';
$price = $value;
$newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to),2);
$form->addField($field, 'hidden', array('name'=>$field, 'value'=>$newPrice));
elseif($field == 'amount_2'):
$from = 'INR';
$to = 'USD';
$price = $value;
$newPrice = number_format(Mage::helper('directory')->currencyConvert($price, $from, $to),2);
$form->addField($field, 'hidden', array('name'=>$field, 'value'=>$newPrice));
else:
           $form->addField($field, 'hidden', array('name'=>$field, 'value'=>$value));
endif;
       }

No comments:

Post a Comment