Naresh
Naresh

Reputation: 721

Change Base Currency Programmatically

I am using Magento CE 1.9.1.0

I have one Magento website and with INR Base Currency.

And i have 2 stores in that the very first store is for Domestic Customers (India Customers), the second store is for International Customers(All cutomers except Indian Customers). This store switching, i am doing it in index.php based on customer Country(Getting Customer Country by Customer IP).

I just configured PayPal Payment Gateway in my Magento Store.

Before going to my question, i want share few things about Paypal PG, This Payment Gateway is only for International Customers and PayPal will not work for INR Currency.

If i am changing my Base Currency as USD or other than INR, the PayPal payment method is showing inside my Payment Methods, if the Base Currency is INR the PayPal Payment Method is not showing in Checkout Page.

Please check these images

  1. Base Currency : INR

enter image description here

  1. Base Currency : USD

enter image description here

I want to have Base Currency as INR because all of my products are uploading with INR and from my ERP i can't change that.

But i want this PayPal Payment Method as one of my Payment Option in My Store for International Customers.

Still looking for solution...

Any ideas ?

Upvotes: 1

Views: 3866

Answers (2)

Naresh
Naresh

Reputation: 721

Sorry guys,

editing core files is bad practice but for me this changes are taking me forward.

Here i found the solution,

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

If you want you can override this.

Upvotes: -2

SimBeez
SimBeez

Reputation: 175

you can set base currency below code this code put in your index file and your store currency will be change.

Mage::app()->getStore()->setCurrentCurrencyCode(‘USD’);

Upvotes: 1

Related Questions