doukanmang3687 2015-08-26 08:52
浏览 46
已采纳

以编程方式更改基础货币

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 ?

  • 写回答

2条回答 默认 最新

  • dqdfpmmi022763 2015-08-31 08:16
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助