This will allow multi currency modules to set the order's currency. I'll soon post here a link to a new multi currency field that uses CCK for it's currency and price logic.

Patch will probably need to grow and cover all payment methods, with a function that returns the currency code

uc_order_get_currency_code($order) {
  return !empty($order->currency_code) ? !empty($order->currency_code) : variable_get('uc_paypal_wps_currency', 'USD');
}

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amitaibu’s picture

And here's the module as a use case:
http://drupal.org/project/uc_cck_currency

amitaibu’s picture

Oops, fix typo that sent the wrong currency code.

amitaibu’s picture

Re-roll to include WPP as-well.

nicolasb_cdip’s picture

FileSize
3.69 KB

Hello,

I'm using Paypal with uc_cck_currency module and I have managed to use your patches and provide one which allowed me to perform a successfull Paypal payment with two different currencies.
So in the file you patched there are other places where I made kind of the same modif.
Anyway here is a patch for the uc_paypal.module file.

I would be pleased to have any feedback.

amitaibu’s picture

@nicolasb_cdip,
your patch isn't good for Ubercart core, as it deals with contrib module. The patch in #3 is still valid -- As part of uc_cck_currency overhaul I forgot to re-populte $order->currency_code, except a fix for that in the coming few days.

nicolasb_cdip’s picture

I missunderstood what you meant. So the function "uc_order_get_currency_code($order)" would return the currency code which is $order->data["uc_cck_currency"]["code"] if the user is using uc_cck_currency module isn't it ?
Where would you define such a function ?
I'd like to know why aren't there other lines where you should change "'CURRENCYCODE' => " as I did with my patch ? Is your patch actually working and allows you to perform a successfull Paypal payment with two different currencies ?

sokrplare’s picture

Since I haven't seen the fix for repopulating $order->currency_code I had to switch to reference $order->data['uc_cck_currency']['code'] to get this working on a client's site. Would be happy to know when the fix is in place so I can roll this back!

In the meantime, posting the patch to save someone time until you get a few free moments, Amitaibu. Thanks for a great module!

amitaibu’s picture

I have committed a fix to uc_cck_currenycy -- http://drupal.org/cvs?commit=346032

So the patch in #3 is still the correct one.

abubin’s picture

i already applied path #3 but is having problem when checkout with paypal.

The currency still follows the one I set inside Currency Code in "PayPal Website Payments Standard".

I had my default currency as SGD and added field_mc_usd. Display of the prices work correctly in checkout cart but when in paypal site, it shows same currency I set in PayPal Website Payments Standard and doesn't change. Amount will be changed but currency does not.

Please help...

kaata’s picture

I have same problem

longwave’s picture

Please see #1097668: Multicurrency support which will implement this and help support multicurrency across all payment methods.

longwave’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Needs review » Patch (to be ported)
FileSize
1.42 KB

The attached patch has been committed to 6.x and now needs porting to 7.x (including dealing with upgrades from 6.x with this column in place)

longwave’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.