Forums / Developer / Making PayPal Extension to work with Multiple Currencies

Making PayPal Extension to work with Multiple Currencies

Author Message

Stuart Fenton

Friday 01 December 2006 6:38:38 am

I have been trying to get the PayPal extension to work with multiple currencies. I can't find any documentation on the subject so I went through some tests and found that it's getting the currency from the Local environment variable and does not pull the currency set by the user.

So the code in ezpaypalgateway.php file in classes looks like this:

        include_once( 'lib/ezlocale/classes/ezlocale.php' );
        $locale         =& eZLocale::instance();
        $currency       = urlencode( $locale->currencyShortName() );

        $countryCode    = urlencode($locale->countryCode());


So I have changed it to read from the users preferences instead.

        include_once( 'lib/ezlocale/classes/ezlocale.php' );
        $locale         =& eZLocale::instance();
        $currency       = urlencode( $locale->currencyShortName() );
        
//SF START - Added for MultiCurrency Support
        include_once( 'kernel/classes/ezpreferences.php' );
        $currency       = eZPreferences::value( 'user_preferred_currency' );
//SF END

        $countryCode    = urlencode($locale->countryCode());

If your going to use it you should add some checking code as this is rough and ready. But it works.

Regards
Fats

-- Stuart

[email protected]
http://www.grandmore.com