I am working on adding multicurrency support in 6.x, and have made a patch series for core that is needed to implement this fully. The four attached patches are as follows:

1. Backports the UcOrder object and use of drupal_write_record() from 7.x, reducing some code duplication and allowing other modules to work with order objects more easily.

2. Adds a currency code field to the order table/object, defaulting to the store currency. This is needed in core because there is no other way of specifying to a payment method the currency that should be used; the payment methods still need updating to use this new field. Implementing this will close #607708: Allow defining currency code per order.

3. Locks product prices at checkout time. This is a longstanding bug in core where price alterers are invoked on orders after they have left checkout, which should not happen - all order prices stored in the database should be fixed amounts. This will break compatibility with uc_vat, but I will handle fixing that later, and also possibly uc_discount, but that seems pretty broken in a number of ways anyway. It will also require an update function to alter existing prices one final time, before saving them to the database. See #854638: order products price should locked in altered price.

4. Makes full order objects available in the order admin and user order history pages. This is needed so currency formatting can be done correctly. Previously requested in #727404: Various order pane functions need to pass order in uc_price context['subject'] variable.

A number of calls to uc_price() can be simplified and cleaned up further once this patch is committed.

The multicurrency module itself is pretty much just a price alterer and a UI to administer currencies and product prices in different currencies (automatic conversion based on a conversion factor is also supported). This needs some more testing and UI polish before I am ready to upload it. This could be uploaded as contrib but I also see no reason why it shouldn't go into core for 6.x, and then we can work towards implementing it in 7.x as well.

Marking "needs work" for now as some of the items above need further implementation and testing, but discussion on the above is welcomed!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

longwave’s picture

Forgot to add: this work and the forthcoming multicurrency module were sponsored by Opsview.

marvzz’s picture

Glad to know Ubercart will be supporting multicurrency. Do you have the timelines for the production-ready release? Specifically for Drupal 6? Thanks!

svax’s picture

Subscribing.

rikki_iki’s picture

Subscribing

longwave’s picture

Updated version of patch #4 as the original no longer applies.

longwave’s picture

A test version of the uc_multicurrency module and another Ubercart core patch are attached. The patch enables multicurrency display in the cart, checkout and order admin pages, though the order preview pane at checkout is wrong for the time being.

You will need to apply the first three patches from the initial post, patch #4 above, patch #5 attached here, then run update.php before installing the module.

After installing, currency setup is located at /admin/store/settings/store/edit/currency. A new block allows you to switch currency. When editing products you have the option to enter fixed prices in all currencies; leaving a price blank will use the conversion rate specified on the main currency settings page.

Currency switching doesn't work for anonymous users if the page cache is enabled; I hope to work around this with JavaScript eventually, but for now you will have to disable page caching. This only works for product nodes and has not yet been tested with attributes, shipping, or anything like that. Payment gateways will need updating to support multicurrency, this is not yet implemented for the core payment modules.

Any feedback is welcome if anyone would like to try testing this, or help out with debugging or implementing missing features.

@marvzz: There is no set timeline for this, but the more people that show interest and are willing to test patches and the module, the quicker this will be added to Ubercart.

longwave’s picture

Also wondering whether it is feasible to commit this in the 6.x-2.x branch, or whether it would be a good idea to entirely overhaul uc_price() and related functions in a new branch. The price locking is definitely an issue here that is difficult or impossible to solve while keeping backward compatibility with other price altering modules. If successful it could then be forward ported to 7.x (which currently has no price altering functions), with the possible aim of getting both multicurrency and VAT in core.

marvzz’s picture

Hi longwave, I have applied your patches and tried your module!, so far so good. I will test this more in these coming days, and will post here if I encounter issues.

By the way, am I correct to assume that for now we will still be expecting series of patches instead of a downloadable dev branch? (either existing or new branch)

fenstrat’s picture

Subscribing.

This looks very promising, including the much needed fix for locking product prices at checkout time. Should that be split off into the existing issue at #854638: order products price should locked in altered price ?

longwave’s picture

If possible I would like someone to review the initial set of four patches. I am wary of committing the price locking patch but patches 1, 2 and 4 (UcOrder backport, order currency field and full order objects in admin pages) should not break backward compatibility, so perhaps we can get these into -dev and then concentrate on the price locking issue separately.

fenstrat’s picture

Status: Needs work » Reviewed & tested by the community

Patches from #0:

1. Tested, works fine, after all this is just a back port of what is in 7.x-3.x
2. Update runs fine, appears to have no side effects.
3. Abandoned as per #854638-8: order products price should locked in altered price
4. (Updated in #5) Works fine and gets rid of code duplication.

I'd say 1, 2 and 4 are ready to go.

I haven't had a chance to test uc_multicurrency in #6

klaharris’s picture

FileSize
20.47 KB
22.57 KB
25.14 KB
51.53 KB

Hi, longwave

Thank you for your work on this. multi-currency is a real weak point in Ubercart and I for one will be on D6 for a while yet. I spent the last two days hacking the official abandoned multicurrency module and also this one: http://drupal.org/node/931764 . Neither do what I need. Your code is nicely clear and simple, and works :)

I downloaded the dev branch of ubercart, your multi-currency module, applied your patches and tested. The images with my results should hopefully be self explanatory, I paid attention to the consistency of currencies and symbols throughout the process.

I'll keep looking at this as I need product attribute options with different prices too. The currency_api could be used to provide realtime currency updates against the store master as well I suppose. I haven't tested this with a real payment gateway (but plan to) so what happens there? Presumably the total and currency get sent in the request to the payment gateway?

I've not done any real transactions with ubercart yet, still in development.

Thanks.

EDIT: image checkout6.png actually has the wrong total, so my comment in green is wrong. oops.

longwave’s picture

@furzey: Thanks for testing, the payment preview pane is a known issue that I have yet to finish working on but that should be in the next update. I will take a look at the other comments you made then as well.

Regarding payment gateways, whatever gateway you use will need updating to support this - instead of using variable_get('uc_currency_code', 'USD') to find the currency, they should use $order->currency instead. This should be done for the core payment methods in the next update, other gateways will need patches or issues raising if/when this is committed.

klaharris’s picture

Awesome, thanks again. I'll keep testing and posting.

FooZee’s picture

Can this work with i18n ? I mean, change default currency with page language changes ?! also, is this production ready yet or what ?!

Thanks for your efforts :)

vgarvardt’s picture

FileSize
8.84 KB
120.05 KB

Couple more issue that I found with this patches and uc_multicurrency module (EUR is set as current currency on the screen shot):

- Example field in Currency settings always shows current currency formatting.
- My Cart block displays correct amount value for EUR, but formatter applies default currency (SEK) formatting.

vgarvardt’s picture

Fixed first issue - fixes Example field, but may affect some other parts I did not tested.

In uc_multicurrency_price_handler_alter -> case 'amount': add one more condition, so the whole case section will be:

    case 'amount':
      if (isset($context['subject']['order'])) {
        $code = $context['subject']['order']->currency;
      }
      elseif (isset($context['currency'])) {
        $code = $context['currency'];
      }
      else {
        $code = uc_multicurrency_code();
      }
      $options = uc_multicurrency_options($code) + $options;
      break;
vgarvardt’s picture

Status: Reviewed & tested by the community » Needs work

BTW, updating status to "needs work" as there are at least 2 known issues with this patches:

- wrong order total (reported by furzey in #12, reproduces for me too)
- My Cart block currency formatting

vgarvardt’s picture

FileSize
8.66 KB

And one more partial fix - added new case section to uc_multicurrency_price_handler_alter

    case 'price':
      if ($context['revision'] == 'themed') {
        $code = uc_multicurrency_code();
        $options = uc_multicurrency_options($code) + $options;
      }
      break;

This fixes Total section for My Cart block.

vgarvardt’s picture

Found where the problem with cart items currency was.

My Cart block is handled with the Ajax Driven Cart (uc_ajax_cart) module. It uses the following code to build cart item total cost:

'total'    => uc_price($display_item['#total'], array(
                'revision' => 'themed-original',
                'type' => 'amount',
                )),

And patched uc_price function has the following "Exit early" verification:

  // Exit early if no alterations are needed.
  switch ($context['revision']) {
    case 'formatted-original':
      return $formatter($original, $options);

    case 'themed-original':
      return theme('uc_price', $formatter($original, $options), $context, $options);
  }

So item price is not altered with the uc_multicurrency but themed as is with the default currency (SEK for me).

I'm sure what is the right way to fix this behaviour, so I just patched uc_ajax_cart to use 'revision' => 'themed'

vgarvardt’s picture

And one more issue - Flatrate (uc_flatrate) bundled with Ubercart within shipping group has context set to the following value:

  $context = array(
    'revision' => 'themed',
    'type' => 'amount',
  );

So rates are not converted on settings page admin/store/settings/quotes/methods/flatrate but are formatted with the currently active currency.

vgarvardt’s picture

Another problem are Taxes (uc_taxes). Values are calculated within AJAX requests from checkout page by sending serialized order information. The problem is that sent order prices not altered with any handlers and default currency price is used for calculations.

Order contents can be changed with the hook_uc_cart_alter(&$items) and I tried to use something like this:

function uc_multicurrency_uc_cart_alter(&$items) {
  // Do nothing for the default currency.
  $code = uc_multicurrency_code();
  if ($code == variable_get('uc_currency_code', 'USD')) {
    return;
  }

  $options = uc_multicurrency_options($code);
  foreach ($items as &$item) {
    $node = node_load($item->nid);
    $prices = $node->multicurrency;
    $field = 'sell_price';
    // Use the specific price if set, otherwise use the currency conversion factor.
    if ($prices[$code][$field] > 0.001) {
      $item->price = $prices[$code][$field];
    }
    else {
      $item->price *= $options['factor'];
    }
    // mark price as altered by Multicurrency module to avoid second multiplication by currency factor in price handler
    $item->multicurrency_price_altered = TRUE;
  }
}

But this makes currency conversion factor being applied twice for all cart items - first time after order items are loaded, second time with the price handler. To solve this I added a flag for Order items that is verified in price handler, so modified case now is:

    case 'cart_item':
    case 'product':
      // Do nothing for the default currency.
      $code = uc_multicurrency_code();
      if ($code == variable_get('uc_currency_code', 'USD')) {
        return;
      }

      $options = uc_multicurrency_options($code) + $options;
      $prices = &$context['subject']['node']->multicurrency;
      $field = isset($context['field']) ? $context['field'] : 'sell_price';

      if (empty($context['subject']['cart_item']->multicurrency_price_altered)) {
        // Use the specific price if set, otherwise use the currency conversion factor.
        if ($prices[$code][$field] > 0.001) {
          $price['price'] = $prices[$code][$field];
        }
        else {
          $price['price'] *= $options['factor'];
        }
      }
      break;
vgarvardt’s picture

Final version of the Multicurrency module that I use

vgarvardt’s picture

FileSize
5.61 KB

Sorry, missed file

longwave’s picture

@vgarvardt: Thank you for posting your issues, changes and code. I have made more updates to my copy of the module (including support for product kits, and anonymous page caching in different currencies) and hope to include your changes and post an updated version next week.

stesind’s picture

Hello!

Many thanks for improving the multicurrency module! I tried out the latest file from post #24 and got the error message at the product editing page:

"Fatal error: Call to undefined function dpm() in /home/****************/sites/all/modules/uc_multicurrency/uc_multicurrency.module on line 67"

And on the price editing page:

user warning: Table '*************************.uc_product_multicurrency' doesn't exist query: SELECT currency, list_price, cost, sell_price FROM uc_product_multicurrency WHERE vid = 4 in /home/**************************/sites/all/modules/uc_multicurrency/uc_multicurrency.module on line 127.

I have a multi language site and tried out the older version of multi currency module as well as multi price module.

vgarvardt’s picture

"Fatal error: Call to undefined function dpm() in /home/****************/sites/all/modules/uc_multicurrency/uc_multicurrency.module on line 67"

Sorry, forgot to remove debug call - this function is from devel module. You may simply remove this string.

user warning: Table '*************************.uc_product_multicurrency' doesn't exist query: SELECT currency, list_price, cost, sell_price FROM uc_product_multicurrency WHERE vid = 4 in /home/**************************/sites/all/modules/uc_multicurrency/uc_multicurrency.module on line 127.

uc_product_multicurrency table is installed on uc_multicurrency module install. Did you get any errors while installing the module?

stesind’s picture

Thank you for the fast answer!

The second error message: I installed the module again and got no error message while activating. I also installed it on a second drupal test environment and got the following messages:

user warning: Table '********************.uc_product_multicurrency' doesn't exist query: SELECT currency, list_price, cost, sell_price FROM uc_product_multicurrency WHERE vid = 54 in ********************drupal/sites/all/modules/uc_multicurrency/uc_multicurrency.module on line 126.
user warning: Table '*******************.uc_product_multicurrency' doesn't exist query: SELECT currency, list_price, cost, sell_price FROM uc_product_multicurrency WHERE vid = 96 in *************************/drupal/sites/all/modules/uc_multicurrency/uc_multicurrency.module on line 126.
user warning: Table ***************.uc_product_multicurrency' doesn't exist query: SELECT currency, list_price, cost, sell_price FROM uc_product_multicurrency WHERE vid = 97 in **********************/drupal/sites/all/modules/uc_multicurrency/uc_multicurrency.module on line 126.

I am working in a godaddy shared hosting linux environment.

Thank you for your support!

stesind’s picture

Just checked that the table was not created.

vgarvardt’s picture

Found one more issue. When order was created from cart items prices were altered twice.
Here is patch for the module from #24 that fixes this issue and my current module version.

stesind’s picture

Hello vgarvardt,

Must it not be:

function uc_multicurrency_install() {
drupal_install_schema('uc_product_multicurrency');
}

However even with that it does not install the table. How can I debug this? Do you have a suggestion?

Thank you!

longwave’s picture

@stesind: You say you tried the other multicurrency module previously - this may have confused your installation. Try disabling then uninstalling the Multicurrency module from /admin/build/modules/uninstall (there may be some errors, which you can ignore) before enabling it again.

dschmuck’s picture

subscribed

stesind’s picture

Thank you longwave,

I had to delete the module information in the system table. Then I was able to install. And also thank all the developers for their work!

On a first test it looked great for the product itself. But the shipping quotes seem not to be converted. I mean the quote itself does not have to be converted. It would be enough if the order total is calculated correctly. One more question. Did anybody patch the paypal payment module to accept the other currency?

vgarvardt’s picture

I had to patch several modules to work correctly with multicurrency, e.g. uc_flatrate, uc_discounts, uc_pma, uc_fee etc. Just added drupal_alter() to the modules and implemented alteration hooks in my support module. Did not use Paypal, so can't say anything about this.

skat’s picture

subscribed

jtsnow’s picture

Any updates on this? I'm looking to use this with product kit and the flatrate shipping modules.

hanoii’s picture

subscribe

marvzz’s picture

Hi longwave,

What's the status of this project?

Thanks.

longwave’s picture

This has taken longer than expected to work on due to various things, but I am still working on this and should be submitting an updated module soon.

In the meantime, I committed http://drupal.org/files/issues/0001-Backport-UcOrder-object-from-D7-allo... as it doesn't seem to be causing any problems.

longwave’s picture

Committed the attached patch which is an update to 0002-Add-currency-code-field-to-orders.patch. This needs porting to 7.x, which will be done in #607708: Allow defining currency code per order to keep things separate.

longwave’s picture

Further updated version of patch 0004 from the original is attached.

So, to use multicurrency with current 6.x-2.x-dev, you need to apply the following:

http://drupal.org/files/issues/0003-Lock-product-prices-at-checkout-time...
1097668-full-order-object-admin-listings.patch (attached)
http://drupal.org/files/issues/0005-Multicurrency-cart-and-order-pages.p...

howenine’s picture

subscribed

klaharris’s picture

There has been mention of multi-currency not working properly with full page cache for logged out users, for obvious reasons, and the idea of a JS solution to solve that.

I'll get booed at, but it is possible to make full page cache work by hacking the core in two places.

common.inc page_set_cache()
bootstrap.inc page_get_cache()

you can work out the details but basically just pull out the current currency and append it it to the url which is pased to cache_get() and cache_set() respectively. I guess the cleanest way to do this would be to delegate cache url generation to a hook function so the default url generated is the same as it is now in the core, then add the currency to that url via a hook implementation in your own module.

Not ideal for Pressflow though due to session starting, and if you support many currencies, it'll obviously bloat your cache.

---
However, longwave, you mentioned you'd be posting an updated module soon including a solution for anonymous caching; any news? :)

thijsvdanker’s picture

subscribe

klaharris’s picture

So I was getting double currency calculation happening in the checkout page, in the cart contents page for a product row. Either I missed something or this seems to fix it:

uc_multicurrency.module uc_multicurrency_price_handler_alter()

I added $context['subject'][$subject_item] != 'cart' to the if statement.

// when order is prepared from cart items 'product' contains copied 'cart_item' value
$subject_item = !empty($context['subject']['product']) ? 'product' : 'cart_item';
if ($context['subject'][$subject_item] != 'cart' &&  empty($context['subject'][$subject_item]->multicurrency_price_altered)) {
..
..

I was also looking at getting this working for product options with different prices, on the node product page, this appears to fix alter the currency properly, in uc_multicurrency_price_handler_alter(), just add another case

case 'attribute_option':

under

case 'product':

No joy so far with getting the shopping cart of checkout working though.

klaharris’s picture

Some more places to change, please someone else try and test this too, this is against the latest dev branch of ubercart, and all the patches and multi-currency module listed here applied. This is to make the orders list and view of individual orders correct:

uc_payment_order_pane.inc

function uc_order_pane_payment($op, $arg1) {
  switch ($op) {
    case 'view':
      $output = '';
      if (variable_get('uc_payment_tracking', TRUE)) {
        $context = array(
          'revision' => 'formatted', // CHANGE from formatted-original
..

uc_order.order_pane.inc


function op_products_view_table($order) {
..
.
$data['price'] = array(
        '#value' => uc_price($product->price, $context), // CHANGE added $context
        '#cell_attributes' => array('align' => 'right', 'nowrap' => 'nowrap'),
      );
..

uc_order.admin.inc

And this is a nice extra to show us the currency in the orders list.

function uc_order_admin($sql = NULL, $args = NULL, $search = FALSE) {
  $header = array(
    array('data' => t('Actions')),
    array('data' => t('Order ID'), 'field' => 'o.order_id', 'sort' => 'desc'),
    array('data' => t('Currency')), // CHANGED, this was added
    array('data' => t('Customer')),
    array('data' => t('Total'), 'align' => 'center', 'field' => 'o.order_total'),
    array('data' => t('Purchase date'), 'align' => 'center', 'field' => 'o.created'),
    array('data' => t('Status'), 'field' => 'os.title'),
  );
..
..
// CHANGE added currency
    $sql = 'SELECT o.order_id, os.title, currency FROM {uc_orders} o LEFT JOIN {uc_order_statuses} os ON o.order_status = os.order_status_id ';

..
..
$context = array(
    'revision' => 'themed', // CHANGE was themed-original
    'type' => 'amount',
  );
..
..
$rows[] = array(
      'data' => array(
        array('data' => uc_order_actions($order, TRUE), 'nowrap' => 'nowrap'),
        array('data' => $order->order_id),
        array('data' => $row->currency), // CHANGE added.
..

--
EDIT, there is an issue with the products pane at checkout, price is correct, currency symbol is not, I'll continue tomorrow.

klaharris’s picture

At the end of the day yesterday I had an issue with the cart pane in the checkout page, issue was correct price but wrong currency symbol. This appears to fix it, I'll keep working and testing this, I need multicurrency working:

function theme_uc_discounts_cart_checkout_table($show_subtotal = TRUE) {
..
.. 
// Remove node from context to prevent the price from being altered.
$context['revision'] = 'themed'; // CHANGED was themed-original
$context['type'] = 'amount';
    unset($context['subject']);
    $rows[] = array(
      array('data' => t('@qty×', array('@qty' => $item->qty)), 'class' => 'qty'),
      array('data' => $description
..
xurizaemon’s picture

Great! Just found this after doing a little work on #621494: Provide order data as context for uc_price (for multicurrency support) and noticing that some of the ideas from there had already surfaced in 6.x-2.x-dev.

I suspect that issue will be duped as a result of work here, but there is a patch in that issue which may be pertinent (adds order context to uc_price() for various payment methods, etc).

@furzey: If you do not run DB updates after updating Ubercart (since 2011-07-01), you will be unable to progress beyond checkout screen. Errors in your site log will show Unknown column 'currency' in 'field list' query: INSERT INTO uc_orders ( ... ). Could that be the issue you were having?

longwave’s picture

I uploaded the latest version of uc_multicurrency to http://drupal.org/sandbox/longwave/1231110

Patches welcome here or in the sandbox queue.

abowers’s picture

I can verify that the attributes don't work properly with multicurrency (unless I've applied the patches incorrectly). What I'm seeing is that the base price is showing correctly with the correct amount and currency, however, the attributed prices aren't adjusted, they show as the same price as the base price. I'll poke around a bit, but I'm not sure exactly where to start - I would have expected if the attributes pull the correct price and currency symbol from multicurrency, then they would just auto-magically adjust. I would guess that the attributed prices are just modified, and I can't imagine why it wouldn't just work. But, my imagination and knowledge probably aren't that in sync!

abowers’s picture

Ok, so after poking around, the attributes work correctly only if you use the conversion factor (don't set the amount in the product price), and only show attribute as totals (not adjustment - that only displays in default currency, in my case, USD). However, Ubercart will happily treat the sell price and the attribute adjustment as if they are the same currency. I have not checked the case where the currency uses different thousands and decimal markers - this could cause confusion.

What I finally came to was in line 1176 in uc_attribute.module, where $product->sell_price seem to be the default currency price as set in the product and $option->price is the adjustment factor as set in the attribute, but once the whole thing goes through uc_price(), it all seems to become whatever is set in the currency that is selected:

$display_price = in_array($attribute->aid, $priced_attributes) ? ', '. uc_price($product->sell_price + $option->price, $context) : '';

So, for example, if the product sell price is set to $400 USD (default) and €500, with an adjustment attribute of -25 and another of +50, then when Euros are selected (and attribute is set to show totals), both prices for the attribute options show up as €500. However, if the sell price in Euros is set to blank, but the conversion factor is set to 1 for Euros, the attribute prices show up as €475 and €550.

I'm not sure how to fix it, but I wanted to let folks know the details in case anyone was interested in pursuing it further.

Great module - I have had people begging me for this functionality for some time now!

Maedi’s picture

subscribing

mfb’s picture

was just testing this out and noticed that 0005-Multicurrency-cart-and-order-pages.patch does not apply, I think due to #1014782: Subtotal in bold/strong at checkout page:

patch -p1 < 0005-Multicurrency-cart-and-order-pages.patch 
patching file uc_cart/uc_cart.module
Hunk #1 succeeded at 673 (offset 4 lines).
Hunk #2 succeeded at 713 (offset 4 lines).
Hunk #3 succeeded at 901 (offset 4 lines).
Hunk #4 succeeded at 935 (offset 4 lines).
Hunk #5 FAILED at 1105.
1 out of 5 hunks FAILED -- saving rejects to file uc_cart/uc_cart.module.rej
patching file uc_cart/uc_cart_checkout_pane.inc
Hunk #1 succeeded at 628 (offset -10 lines).
patching file uc_order/uc_order.admin.inc
Hunk #1 succeeded at 1329 (offset 29 lines).
patching file uc_order/uc_order.module
Hunk #1 succeeded at 453 with fuzz 2 (offset 4 lines).
Hunk #2 succeeded at 1490 (offset 16 lines).
patching file uc_order/uc_order.order_pane.inc
Hunk #1 succeeded at 768 (offset 5 lines).
Hunk #2 succeeded at 789 (offset 5 lines).
Hunk #3 succeeded at 875 (offset 5 lines).
Hunk #4 succeeded at 896 (offset 5 lines).
stellar124’s picture

Assigned: Unassigned » stellar124

Hello,

I have a problem, I think it's near by:

// Use the specific price if set, otherwise use the currency conversion factor.

So it doesn't work, the altered price is 0 if i don't fill the multicurrency price,
In the settings, "admin/store/settings/price-handlers" I've checked the "Multicurrency price alterer" but no result.

I try:

  // Use the specific price if set, otherwise use the currency conversion factor.
      if (isset($prices[$code][$field]) && $prices[$code][$field] > 0.001) {
        // $price['price'] = $prices[$code][$field];  
		 $price['price'] *= $options['factor'];
      }
      else {
        $price['price'] *= $options['factor'];
      }

but doesnt work

Any idea?
Thanks!

fghaas’s picture

For those who (like me) are testing this, you may be bitten by #1287948: Cart pane always displays default store currency prefix, regardless of currency setting for products which seems to not be caused by multicurrency -- but instead multicurrency seems to expose the issue, just like the other multiple-currency contrib modules do.

stefan81’s picture

subscribe

marcus178’s picture

Where can I get a copy of this module to test? I have tried cloning from the sandbox but just get 2 uc_coupon files.

fghaas’s picture

Marcus, if it helps, you can do git clone git://git.drupal.org/sandbox/longwave/1231110.git. Note, I don't use this module at this point -- but that repo is what I cloned from when I tested.

Note that there hasn't been any activity in that repo since its initial commit on 7/27/2011, so there may be a more current version somewhere.

Perhaps someone (longwave?) could shed some light on the current status of multicurrency support in Ubercart?

longwave’s picture

There has been no further progress; the client that requested this feature is happily using it, but there was no further time or money available to merge this directly into Ubercart. Further patches or offers of sponsorship to complete this are welcome, however.

fghaas’s picture

Dave, can you explain what the client did to work around or bypass #1287948: Cart pane always displays default store currency prefix, regardless of currency setting for products? Are they using your Ubercart core patch from comment #6?

Also, has anyone put work into the PayPal payment module so it doesn't always submit payments in the default store currency?

longwave’s picture

Yes, they are using the core patches from this issue, which I believe solves that problem.

The client in question didn't use PayPal but it should be fairly straightforward to modify all payment modules to use $order->currency to get the currency code.

fghaas’s picture

Dave, I've just made an attempt to rebase that patch set onto the current ubercart 6.x-2.x branch.

0001 seems to have gone upstream in the meantime.
0002 seems to have gone upstream in the meantime.
0003 applies cleanly.

0004 produces a conflict in uc_order/uc_order.admin.inc:

<<<<<<< HEAD
  $result = pager_query("SELECT o.order_id, o.created, os.title, SUM(op.qty) AS products, o.order_total AS total, o.order_status FROM {uc_orders} AS o LEFT JOIN {uc_order_statuses} AS os ON o.order_status = os.order_status_id LEFT JOIN {uc_order_products} AS op ON o.order_id = op.order_id WHERE o.uid = %d AND o.order_status IN ". uc_order_status_list('general', TRUE) ." GROUP BY o.order_id, o.created, os.title, o.order_total, o.order_status". tablesort_sql($header), 20, 0, "SELECT COUNT(*) FROM {uc_orders} WHERE uid = %d AND order_status NOT IN ". uc_order_status_list('specific', TRUE), $user->uid);
=======
  $result = pager_query("SELECT o.order_id FROM {uc_orders} o WHERE o.uid = %d AND o.order_status IN ". uc_order_status_list('general', TRUE) ." ". tablesort_sql($header), 20, 0, NULL, $user->uid);
>>>>>>> Make full order object available in order listings.

0005 produces a conflict in uc_cart/uc_cart.module:

<<<<<<< HEAD
      '#value' => '<span id="subtotal-title">'. t('Subtotal:') .'</span> '. uc_price($subtotal, $context),
=======
      '#value' => '<strong>'. t('Subtotal:') .'</strong> '. uc_price($subtotal),
>>>>>>> Enable multicurrency display in the cart, checkout and order admin pages

Could you advise how to resolve these conflicts correctly?

lagreen’s picture

I just wanted to say big thank you to longwave for this module and idea of all this. I'm using drupal 7 and i searched all the web to find any appropriate solution for multicurrency but without luck. That's why i took this module as a frame and idea of it and somehow managed to adjust it for my needs (on drupal 7) but with several ubercart core updates. This is temporary-working solution for me and i really hope that some day there will be real multicurrency support in the core of ubercart.

Thank you.

longwave’s picture

@lagreen: Please post your patches and code if you have ported this to Drupal 7, it would be hugely appreciated!

fghaas’s picture

@longwave, I contacted you a while back via your contact form regarding possible sponsorship for getting multicurrency fully supported (for D6, in our case), but never received any reply. Should I presume your swamped at this time, and if so, when would be a good time to revisit this?

longwave’s picture

I don't recall receiving that (sometimes the contact forms on d.o seem flaky, either that or they get treated as spam I'm not sure), but right now I am indeed pretty busy. Depending on how much support/time you need I might be able to help, please try contacting me again.

lagreen’s picture

@longwave Yes, i can do so. But at first i have to try this on the clean instal to verify that this works properly :)

Rafal Lukawiecki’s picture

Hi, I would be interested in using multicurrency with D7 Ubercart. What does it take to sponsor this feature? Many thanks.

fghaas’s picture

@longwave, I just shot you another email via the contact form. Let me know whether you got it, thanks!

timezero’s picture

Is there any solution for paypal and ubercart 2.x?

zerolab’s picture

Here's a patch to enable multicurrency support in uc_paypal.

One thing to note: since uc_paypal provides a list of PayPal currencies, the patch tests the order currency against that list. It will change the submitted PayPal currency only when the order currency is in _uc_paypal_currency_array()

edit: patch created against Ubercart 6.x-2.7

voj’s picture

Status: Needs work » Needs review

comment removed

TR’s picture

meandrew’s picture

Status: Needs review » Needs work

Is there a version working with ubercart 6.x-2.0 ?

This is the link to the patch but it down't work ?

Thank you

voj’s picture

@meandrew you can follow this link uc_multi_currency. follow #32 dukem's modified code, It's not an official release but it works. :)

All you have to do is follow the instruction given.
plus additional notes:

  • use the same ubercart version dukem was using.
  • patch ubercart's code (i'm not giving an idea to hack the core but it's the only choice as of now)
  • create a column 'currency' in uc_orders table. This stores the currency settings for each orders.

hope this saved you some time. :)

meandrew’s picture

This is working up to a point and is proving positive so far :) I am yet to add a new column as I wanted to run the patches first.

Is there a particular way to run patches? Not really sure where code is to be replaced in each respective file?

The currency switches over ie it is converted to the rate howver it is only for each product in the cart and the currency doesn't switch over in the actual shopping cart and checking out process.

Thanks

voj’s picture

I think you might have just missed a few steps. All you have to do is to patch them all up (with the same version of ubercart). Replace the existing files and install the required modules for the multi-currency.

Can you please tell me what versions do you use? drupal version, ubercart version, and other possible conflicting modules that you might have installed.

And can you message Multi-Currency Support for Ubercart instead of here so people will not be confused.

steven-spencer’s picture

Any luck with this for D7?

TR’s picture

Assigned: stellar124 » Unassigned
hanoii’s picture

Summary request, can someone kindly give me a summary of what has happened since on this issue or efforts towards a definite solution for either 6.x or 7.x?

What's the difference between this issue and #931764: Modified code to make it mostly work with Drupal 6 and Ubercart 2?

@longwave, If I were to tackle this for D7, can you outline very quickly what you did and the problems you found and advices into what I should look at?

I read through this issue and a whole and it seems that some momentum was lost toward the end and it seems that reviewing the latest patch should give me a fairly good idea, but words help as well.

Thanks.

longwave’s picture

This issue has basically stalled for 6.x; I haven't had time or inclination to work on it since my last post in this issue. As uc_price() has been removed in 7.x, I am fairly certain a different approach will be required to achieve multicurrency support here.

I guess it would still be good to get the uncommitted 6.x patches in this queue rebased and re-tested, then ported forward to 7.x, at which point we can take stock of what we have and what we need to do to get multicurrency support in both versions.

djg_tram’s picture

And we're not yet any nearer to a D7 version I'm afraid... Any chance of discussing approaches, possibilities and potential sponsoring?

Xano’s picture

I am the maintainer of Currency, which manages currencies and exchange rates, and does locale-based price formatting.

If you're interested, we're doing a BoF about this at DrupalCon Portland today. Room A103, 14:00/2pm.

djg_tram’s picture

Yes, we discussed some input approach questions in Currency a couple of days ago in your issue queue over there. :-)

Right now I'm working on a new Multi-Currency module (out of immediate need), I expect to be able to present it for peer review in a couple of days at most. D7, Ubercart 3, strictly without any currency rate conversion, only separate prices for any installed currency. I'd like to be able to discuss solutions. Right now, also because I needed very strict integration with the module, and only partly due to the import issue we discussed, I wrote my own currency support into the module (actually, currency support is done, product prices are done, attribute/options prices are done, I'm working on some display issues and order handling right now).

But, just because of that, I'm a bit torn between approaches. One one hand, I don't really want to duplicate functionality. On the other hand, my currency approach is different from yours in many places (and not only because of the different installation method). Locale and display settings are handled differently, besides, it's really cross-linked into the multi-currency module completely. Also, I have extra functionality like currency selection providers to decide what currency to actually use, based on a plugin-like architecture.

So, either here or preferably in the new module's issue queue, I'd very much like to discuss these issues and anything related.

Xano’s picture

So what functionality do you need that is not offered by Currency? Also, your approach of linking locales/display and currencies is still unclear to me. From what I understand now, your approach in that regard is wrong, but I'd need some more info to confirm that.

djg_tram’s picture

Yes, I know. To start with, it's really a pain that a large system like Drupal doesn't offer locale information out of the box. Currency handling for me is just a background helper, I concentrate on the Ubercart part now. For now, I made simplifications that will not remain in a finished version for sure. Right now I use a unified formatting string per currency (eg. $#,###.##) that handles both symbol and decimal/grouping characters in one go but that will need changing because of currencies that span several countries with possibly different display requirements.

However, one thing that I did implement is the install mechanism we already discussed. If you would be interested in checking it out and maybe adding to Currency some time, that would handle it. Of course, with the install mechanism comes the need to convert all the .yml files to the new format (I used the same approach as Ubercart Countries, as I already mentioned) but that can be automated.

Having said that, just like my current approach is cutting corners temporarily, I still feel that Currency bundling currency and locale information is still not the right way, either. The locale info should be moved out into a third module, I guess, something that offers general and universal locale information for Drupal...

Xano’s picture

but that will need changing because of currencies that span several countries with possibly different display requirements.

Note that formatting patterns have *NOTHING* to do with the currency of the price that is being formatted, but only with the locale. Say I were to visit a Hungarian webshop that only lists prices in Forints (which is solely used in Hungary), the prices would still have to be formatted using en_NL, which is the locale I use on my laptop.

Having said that, just like my current approach is cutting corners temporarily, I still feel that Currency bundling currency and locale information is still not the right way, either. The locale info should be moved out into a third module, I guess, something that offers general and universal locale information for Drupal...

I share your opinion that this is the way it should be. The reason I never did it has to do with not being familiar enough with other parts of locale management, and a lack of time. I would likely support efforts to centralize this.

djg_tram’s picture

Actually, there are many circumstances to cater for. The webshop I now have to set up will link currency to localization (the currency actually offered will depend on the locale used by the current user to view the site), so I'll be able to get away with the simpler approach temporarily.

Now I'm mostly finished with the Multi-Currency module, orders are saved all right, the only still remaining issues are some display and edit screens in the order management admin parts. I'd be very glad to hear something from the UC crowd about the likelihood to add some (very simple and very straightforward) modifications to the UC core. Basically, all that would be needed is to add an extra argument to theme_uc_price() and theme_uc_product_price(). If I were to move the whole multi-currency handling into the core, that extra argument would obviously be $currency. But a more universal approach and one that caters for any external module (either this one or any other) is to add $order to these theme functions. This single optional argument wouldn't break any existing functionality for sure so it would be rather easy to accept it into the core but it would help tremendously: instead of letting core do single-currency stuff and then repeat some work to change it to multi-currency, it would automagically do the right thing during the first run.

As far as I can see now, the optimal solution would be to have Currency do its currency stuff, hopefully with my installation additions if you consider them worthy, to move Locale out into a separate module and to add these slight changes to UC core to help the work of all the others.

Xano’s picture

Actually, there are many circumstances to cater for. The webshop I now have to set up will link currency to localization (the currency actually offered will depend on the locale used by the current user to view the site), so I'll be able to get away with the simpler approach temporarily.

Ah, I understand. I only meant formatting. What you need is application-specific, and is not provided by currency right now, although Currency does provide the country-related metadata to support delegation like this.

djg_tram’s picture

I've written a plugin-like infrastructure to provide this. There are providers that can decide, using whatever conditions they see fit, which currency to use. The user can configure, enable, disable and re-order these providers, just like with the stock localization selection providers. And the first provider that returns a definitive answer in the chain will be honored.

It's only plugin-like at the moment, not real plugins, meaning that although they do work along these lines, all providers are now implemented in the module itself and there is no provision for external modules to hook into this. But this will be added. Currently, I have four providers: selecting currency based on localization, user role, product content type and taxonomy.

Xano’s picture

I wonder if we cannot add that to Currency itself, as it already contains relationships between countries and their currencies. Using hooks and Rules we can create a flexibly configurable solution.

djg_tram’s picture

In theory, yes, but it only has meaning in the context of multi-currency Ubercart support itself.

Anyway, I'll try to contact Longwave in private message. I'm practically finished with it now but I did modify Ubercart in many places. If I could convince them to accept these changes (nothing else but adding a new argument to uc_currency_format() and a new attribute to the uc_price FAPI element, both are backward compatible so adding them has no influence on earlier modules), the situation would be much-much simpler. Actually, some issues can be solved without these modifications but not all.

In my own practice, I'd live with the added problems of modifying core and recreating it if a security fix arrives for now but this can't be so in a contrib module for sure.

djg_tram’s picture

I did so, hopefully Dave can come here and look around. Here are the main features of the module as it is now:

  • Right now, it has its own currency support, instead of using Currency. In some places it provides less (no conversion, just plain and separate currencies), in other places more (providers, see below). Those parts could probably be merged into Currency or dissected into Currency and a Locale module.
  • All product admin pages (product base, options default, product options) override the original price related textfields to offer a way to enter multi-currency pages. Of all that, the product options page has a somewhat questionable UI, the others are just fine, I guess.
  • The module has a currency selection provider mechanism that allows built-in providers (later, extra modules) to decide which currency to present to the user, based on any condition (Drupal locale, user role, product type, taxonomy, GeoIP, user preference, etc).
  • Pre-order phases use the providers to determine the actual currency. As soon as an order object is started (actually, from the point of hook_uc_order('presave'), the currency is stored with the order. All later phases, including order management and invoicing uses the already stored currency.
  • The module has Views and Tokens support, with Rules in the oven.

There are two ways I could go forward now. As it is now, it can override many but not all currency operations in Ubercart. Both core and some bundled or contrib modules have very hardcoded ways of calling uc_currency_format (not even using theme('uc_price')). Basically, those outputs that stay in render arrays (eg. most of the order management) or use tokens (eg. invoicing) can be modified after the fact, although this means wasted resources as currency display has to be repeated. However, those already rendered cannot (eg. log entries).

A better solution would be if Ubercart could accept some changes to the core. They are quite numerous but actually, only two kinds, only they appear in many places. First, whenever uc_currency_format() is called, a new argument (the currency) should be passed as well. Sites not using multi-currency will not see any difference as either passing the default currency or not passing anything at all will use the default for sure. Second, all uc_price FAPI elements should also receive a new attribute, #currency, with the very same ramifications.

In my opinion, both changes are long overdue and would provide an avenue for this or any similar module to handle prices appropriately, with their units.

kenorb’s picture

arvind.kinja’s picture

Version: 6.x-2.x-dev » 7.x-3.5
Component: Code » Other
Assigned: Unassigned » arvind.kinja
Category: feature » support
Priority: Normal » Major
Status: Needs work » Active

how to solve multi currency problem in ubercart.
I used uc_multicurrency but I didnt got any solution.

anybody can help me

plz :)

Xano’s picture

Assigned: arvind.kinja » Unassigned
Category: Support request » Feature request
Priority: Major » Normal
Issue summary: View changes
kenorb’s picture

Status: Active » Needs review
TR’s picture

Version: 7.x-3.5 » 6.x-2.x-dev

Note that longwave's proposal is for D6. There is no D7 patch to review.

I personally support marking this as "won't fix" in D6 in order to redirect development effort into the current version of Ubercart for D7. The difference between D6 and D7 in this regard is pretty large, and IMO it's a waste of time to put the effort into D6 as D6 is scheduled for obsolescence in the near future.

djg_tram’s picture

I would repeat what I wrote in #94.

I have a fully functioning multi currency setup running on several production sites (D7). A complete module, with practically full support. The only reason I haven't published it as a contrib module yet is that it currently requires simple but numerous modifications to UC core. Modifications that, in my opinion, are long overdue and could be incorporated into the core rather easily. If that was done, either my module or any similar approach would work seamlessly. I'd be more than willing to contribute it, to discuss it, whatever it takes to make sure it's not only myself that benefits of this working solution. :-)

Xano’s picture

Version: 6.x-2.x-dev » 8.x-4.x-dev

Moving this to 8.x-4.x as per the policy that new features must be added to the most recent branch first, so as not to cause regression.

I'd like to mention that Currency has a working version for Drupal 8.

meandrew’s picture

Where is the fully working version available?

amcoms’s picture

Is there any news on this module please @djg_tram ?

Andrew

amcoms’s picture

please guys is there any news on this it is over 1 year ago!

#85
Posted by djg_tram on May 22, 2013 at 11:30am

Yes, we discussed some input approach questions in Currency a couple of days ago in your issue queue over there. :-)

Right now I'm working on a new Multi-Currency module (out of immediate need), I expect to be able to present it for peer review in a couple of days at most. D7, Ubercart 3, strictly without any currency rate conversion, only separate prices for any installed currency. I'd like to be able to discuss solutions. Right now, also because I needed very strict integration with the module, and only partly due to the import issue we discussed, I wrote my own currency support into the module (actually, currency support is done, product prices are done, attribute/options prices are done, I'm working on some display issues and order handling right now).

But, just because of that, I'm a bit torn between approaches. One one hand, I don't really want to duplicate functionality. On the other hand, my currency approach is different from yours in many places (and not only because of the different installation method). Locale and display settings are handled differently, besides, it's really cross-linked into the multi-currency module completely. Also, I have extra functionality like currency selection providers to decide what currency to actually use, based on a plugin-like architecture.

So, either here or preferably in the new module's issue queue, I'd very much like to discuss these issues and anything related.

Xano’s picture

Well, this is for Ubercart 8.x-4.x, and Currency 8.x-3.x already addresses some of your concerns. If you want a solution for Ubercart 7.x-3.x, then you must open a different issue.

amcoms’s picture

where to open? i just want the UC Multi Currency on our D7 U3 it cant be difficult ?

Just a working mod for now please please?

That was two pleases ;)

amcoms’s picture

Is there any news on this please? It seems to have been in develoment for 3 years for a feature that is out of the box on other carts I just don't understand why this awesome community is struggling with a feature that worked before and available.

How are store owners dealing with Ubercart MC ?

Is this purposefully being delayed and excluded for commercial gain by the lead developers?

amcoms’s picture

Please release this

#100
Posted by djg_tram on January 4, 2014 at 11:41am

I would repeat what I wrote in #94.

I have a fully functioning multi currency setup running on several production sites (D7). A complete module, with practically full support. The only reason I haven't published it as a contrib module yet is that it currently requires simple but numerous modifications to UC core. Modifications that, in my opinion, are long overdue and could be incorporated into the core rather easily. If that was done, either my module or any similar approach would work seamlessly. I'd be more than willing to contribute it, to discuss it, whatever it takes to make sure it's not only myself that benefits of this working solution. :-)

amcoms’s picture

This is an urgent issue and no one is replying the developer on the Ubercart Multi Currency replies to nothing, no one on this thread replies

On the Ubercart website and forum there is no one who can provide any answers to what is going on with UC Multi Currency WTF is going on?

Keystone cops meets Mickey Mouse!

Someone get a grip and bring everyone up to speed for the love of Ecommerce!

You are putting the OS community to shame.

Xano’s picture

You are putting the OS community to shame.

You are putting the OS community to shame. The maintainers have absolutely no obligation to you whatsoever. You have no warranty. Instead, you posted six replies in the past five days and now you demand that the maintainers respond.

You get a grip and either release this as a separate module, or stop posting here and just fix this for your own client's projects. You'd better apologize and not use the tone from #109 anymore if you want people to spend their precious time on you. You must understand that most work here is done voluntarily, and that open source means that if you want something and you can't pay or ask someone else do to it for you, you can do it yourself.

xurizaemon’s picture

Status: Needs review » Needs work

Amcoms, Xano is right. "Please" isn't what's needed here - it needs either someone to do the work, or someone to pay for it to be done.

Even those contributing towards this work do not have the right to be rude to other contributors about it. All are welcome to use the products of the Drupal.org community, but the attitude of entitlement voiced here is not constructive.

Here is your opportunity to contribute to a project which gives you so much. Will you step up?

amcoms’s picture

But where to access the module that needs the work done. We will pay for it and do it

Andrew

amcoms’s picture

Xano commented 5 days ago

You are putting the OS community to shame.

You are putting the OS community to shame. The maintainers have absolutely no obligation to you whatsoever. You have no warranty. Instead, you posted six replies in the past five days and now you demand that the maintainers respond.

You get a grip and either release this as a separate module, or stop posting here and just fix this for your own client's projects. You'd better apologize and not use the tone from #109 anymore if you want people to spend their precious time on you. You must understand that most work here is done voluntarily, and that open source means that if you want something and you can't pay or ask someone else do to it for you, you can do it yourself.

You're a joker right? Where is the code to fix? There is nothing to work with. Open Cart download it and within 5 mnutes there is an ecommerce with MC working out of the box. Drupal Commerce!

Is the difference between OS ecommerce communities levels of motivation dictated by cash? Hence not OS but commercial enterprises.

Where is the OS spirit? There is none, it has been replaced with commercial greed. The module in question has not been touched for over a year.

It is a critical part of ecommerce so some bright spark has decided not to develop it, making it a commodity of value.

Provide access to the current working version that was working or up to the point they become bored with it and we'll take it over as an official module for UC

It's not rocket science.

amcoms’s picture

PS

Xano commented 5 days ago

You are putting the OS community to shame.

You are putting the OS community to shame. The maintainers have absolutely no obligation to you whatsoever. You have no warranty. Instead, you posted six replies in the past five days and now you demand that the maintainers respond.

You get a grip and either release this as a separate module, or stop posting here and just fix this for your own client's projects. You'd better apologize and not use the tone from #109 anymore if you want people to spend their precious time on you. You must understand that most work here is done voluntarily, and that open source means that if you want something and you can't pay or ask someone else do to it for you, you can do it yourself.

It took 5 messages to get a reposnse and in typical style you replied and look how you replied! Rather than be very thoughtful and helpful you chose to be self righteous and arrogant.

Congratulate yourself for telling everyone you have several sites working on D7 U3 and very well done, give yourself a pat on the back for sharing this useless information.

if you want to contribute for payment state it and advertise instead of posting time wasting tripe on an OS forum.

longwave’s picture

I have no idea what you are talking about when you refer to "commercial greed". The original development of Ubercart Multicurrency - for Drupal 6 and Ubercart 2.x - was sponsored by a commercial entity and this is the reason this thread even exists. However, there was not enough money or time to fully integrate it into Ubercart core at the time. Even so, the patches to add multicurrency functionality were posted in this thread and in the sandbox at https://drupal.org/sandbox/longwave/1231110 - anyone is welcome to take this work and use it in Drupal 6/Ubercart 2 or port it to Drupal 7/Ubercart 3.

Since then, I personally have not received any sensible offers of sponsorship to port this work to Drupal 7, and having just had a new addition to my family along with a full time job (unrelated to Ubercart), nor do I particularly have the time or inclination to work on this unless a very significant offer is made.

amcoms’s picture

Longwave thank you for replying it is greatly appreciated. Your mobile phone number has been dialeed several times during the last 3 years and messages left but no reply.

Can you let me know how to be involved with the sponsorship we are two developers

Creating a seperate module that isn't part of the core development seemed counter intuitive to working with the module under active development and support

https://drupal.org/project/uc_multi_currency

Ubercart Multi-Currency
Primary tabs

View(active tab)
Version control
Revisions

Posted by djg_tram on May 19, 2013 at 8:04pm

Drupal 7, Ubercart 3.

Coming up soon.
Project Information

Maintenance status: Actively maintained
Development status: Under active development
Module categories: E-commerce
Last modified: May 19, 2013

Downloads

View all releases

Are you saying there is no actively supported module under development that is not coming soon? And the only option is to use the pieces of the jigsaw on the link you have just posted?

And are you also saying there is an opportunity to get the coming soon to be faster should cash be injected into the actively developed and supported module?

I can inject cash and time I just need to know what the situation is.

We did have D6 UC2 working nicely before we decided to port to D7 UC3 and the MC is the only part left. So we are faced with a decision that is up to a certain point out of our control.

Your speedy reply is very much welcomed.

amcoms’s picture

amcoms’s picture

Anyone with a single thread of human decency should delete this module. It should not be associated with the good name of Drupal.

Please change the status of this module to unsupported and not maintained.

https://drupal.org/project/uc_multi_currency

It is time wasting and serves no purpose other than to mislead people into believing there is a solution to multiple currencies for Ubercart. There is no solution and no solution is being worked on.

There is an unhealthy pattern of behaviour within this Drupal module group (Ubercart) that favours putting a commercial value for development rather than advocating the spirit of an Open Source project.

Ask a question and get no reply!

Ask for help and get no reply!

Question the lack of support and get abused!

Question the abuse and get attacked for not contributing!

mlhess’s picture

@amcoms,

Please read over the Drupal Code of Conduct at https://drupal.org/dcoc . Please look at https://drupal.org/node/2278531 .

This seem to be a violation of the code of contact.

Thanks,

Michael

amcoms’s picture

@mlhess another helpful reply!

I have merely asked simple questions that no one has been bothered to answer until I have highlighted the lack of community support to my questions.

Arrogance within this Ubercart Module community is not a good enough justification to overide the inability to communicate to simple questions.

Block this user because he is asking questions no one can be bothered to answer!

The status of that module is out of date, for 13 months it has said coming soon!

Intentionally making the module a commodity by not updating it and promoting it as actively maintained and supported is misleading.

I am not misleading anyone. I just asked questions no one is answering and I have asked them simply.

Socrates was executed because he promoted the notion of asking questions!

Where and how can I contibute to get this module brought up to date? It really is that simple.

The fact that developers are claiming to have several sites working with the module D7 UC3 and then proceeding to promote paying for services has been highlighted and not liked. This is an OS community after all.

The negative tone has been generated from within this sub set of developers and not by me.

Again, if they had channelled their energy and focus on providing me with an answer with the same vigour spent claiming I am a bad person saying nasty things, the module would have been fixed, supported and maintained by now!!! Very sad with the waste of time this has caused.

amcoms’s picture

As well as this there are several references to people asking how to support this module. If Dave Long is commited to other projects maybe someone else can take over without having to contribute with a "very significant offer" ?

djg_tram commented about a year ago

Yes, we discussed some input approach questions in Currency a couple of days ago in your issue queue over there. :-)

Right now I'm working on a new Multi-Currency module (out of immediate need), I expect to be able to present it for peer review in a couple of days at most. D7, Ubercart 3, strictly without any currency rate conversion, only separate prices for any installed currency. I'd like to be able to discuss solutions. Right now, also because I needed very strict integration with the module, and only partly due to the import issue we discussed, I wrote my own currency support into the module (actually, currency support is done, product prices are done, attribute/options prices are done, I'm working on some display issues and order handling right now).

freelylw’s picture

looking forward for this "multi-currency". but I don't know how to code.

djg_tram’s picture

I'm here but, frankly, after some attempts to convince people here to at least look into the possibilities of adding the required changes to UC core (the changes would be simply to add a currency parameter to all calls in UC and modules that deal with price formatting, so I don't expect any regression), I admit, I didn't monitor this thread here. I'll add this description to the module page as well.

The situation is just the same as it was earlier. I wrote the module and I would be more than willing to share it. However, in the present circumstances, using the module requires these numerous albeit small and harmless changes to probably hundreds of places all around the UC modules. I've been using my module on production sites for more than a year now without problems but, with this requirement of core modifications (which means either sticking to a specific version of UC or re-doing the modifications with every upgrade, neither is a nice solution), I felt it rather unwise to publish it as a contrib module.

So, I reiterate and reiterate: if the necessary (very long overdue) changes could be incorporated into UC, I'd be very happy to upload the module. This was my primary intention already a year ago, not to have it as a non-functioning stub.

djg_tram’s picture

Reading it back, also considering Dave's reply, I'd also add: I'm working on Drupal 7 and, currently, I really have no time to install D8 and start applying changes there only to be backported to D7. So, if somebody might pop up and willing to help co-operate with the re-checking of the necessary D7/UC changes against the current D7 dev codebase and help pick up the lost threads, we could move this forward.

xurizaemon’s picture

@djg_tram: If you want to publish this in whatever state, you can do it pretty easily and you don't need to look at D8 to do it -

  • Run Hacked over a copy of your Ubercart module directory.
  • Upload your patch against D7 here as an example ... if you add -D7-do-not-test before the .patch it'll be clear that this isn't proposed for 8.x
  • Link to #1097668: Multicurrency support from https://drupal.org/project/uc_multi_currency
  • Run through your uc_multicurrency module and knock out anything client-specific - just /* TODO magic here */ it
  • git push to uc_multi_currency
  • Mark UC Multi Currency "unsupported" / "not maintained" or whatever you like, with a note that the maintainer is open to commercial engagement on developing it further (if that's what you want).

Outlining this in the hope that it'll help you, not because I want to add pressure to make you do it - after some of the comments here, you're within your rights to just hit the Unfollow button!

If your code is out there, someone else can push it forward. Talk is silver, code is gold. Let's see who steps up to the plate :)

djg_tram’s picture

OK, thanks, I'll try, I wasn't aware of Hacked (or more precisely, the possibility of using it for this purpose). I'll set up a clean site to make the tests there.

As to the project, no, I don't want to resign of maintaining it. Simply that I don't find it correct (and actually, feasible) to maintain something that relies on an UC different from the current development. More specifically, to need to re-hack UC every time there is an upgrade...

longwave’s picture

@djg_tram: Please post your patches against 7.x-3.x. We would like new features to be written for D8, but equally this is an important feature and it would definitely be considered for D7. At this stage of D7 we cannot break backward compatibility, but hopefully the changes work in such a way that we only add optional parameters to existing APIs, and existing contrib will work with the changes applied. I agree with @xurizaemon in that if the code is out there, someone else can take it and move forward with it; you don't have to take any responsibility after uploading anything if you don't want to or don't have the time.

djg_tram’s picture

OK, that I'll do. Now that I started to revisit, there are only three kinds of changes required and none of them is likely to introduce any regression:

1. uc_price FAPI elements get a new entry:

  $form['amount'] = array(
    '#type' => 'uc_price',
    ...
    '#currency' => $order->currency,
  );

initialized with whatever is applicable but it is $order->currency most of the time.

2. References to theme_uc_price() get the same extra value:

array('data' => array('#theme' => 'uc_price', '#price' => $shipment->cost, '#currency' => $order->currency))

3. Direct calls to uc_currency_format() pass a new parameter (that defaults to the site's default currency if not specified). The only caveat is that if it is supplied, the previous optional parameters have to be specified, too:

uc_currency_format($order->order_total, TRUE, TRUE, NULL, $order->currency);

No core functionality or any other contrib module should feel hampered by these additions.

I'll start the re-patching and bringing the module page up-to-date.

xurizaemon’s picture

djg_tram - thanks for that!

I didn't intend to suggest you might resign maintainership, just that you might be able to adjust users expectations via the maintenance and development status fields. Now that I've looked that page up I see that "unsupported" is the wrong option there. I'd better check which projects I've set that on myself!

freelylw’s picture

Are you guys going release something which has multicurrency function for ubercart soon ? I don't know how to code, but I need this asap. if you guys are working on this, I will wait for a bit, if not, I probably will just pay for someone to do this for my site.

xurizaemon’s picture

If you need it ASAP ... and you are willing to pay for someone to do it ... this seems a good place to put two and two together.

(Wow. I'm going to unsub from this thread before my brain implodes.)

Xano’s picture

djg_tram’s picture

@xurizaemon: I've just finished a stage of a large project and now have a bit of time to catch up with this module. I tried Hacked but I can't see any way to force it to check Ubercart, it skips it during the report. I also have Diff installed but that only seems to create on-screen diff tables, not patch files. I have no other choice but to do a proper command line diff, I guess...

djg_tram’s picture

Here are the necessary UC core changes to the Multi-Currency project (https://www.drupal.org/project/uc_multi_currency).

dizmoduck’s picture

Thanks for a good job your are doing :-)

I get this error when I try to patch UC, is there another way?

I copy the patch file to the /sites/all/modules/ubercart/payment/uc_credit

/sites/all/modules/ubercart/payment/uc_credit# patch -p0 --dry-run < uc_multi_currency_ubercart_7.x-3.x-dev.patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git "a/c:\\zzz\\aaa\\ubercart-7.x-3.x-dev/payment/uc_credit/uc_credit.admin.inc" "b/c:\\zzz\\aaa\\ubercart-7.x-3.x-dev-UCMC/payment/uc_credit/uc_credit.admin.inc"
|index 292b59e..eecb7ef 100644
|--- "a/c:\\zzz\\aaa\\ubercart-7.x-3.x-dev/payment/uc_credit/uc_credit.admin.inc"
|+++ "b/c:\\zzz\\aaa\\ubercart-7.x-3.x-dev-UCMC/payment/uc_credit/uc_credit.admin.inc"
--------------------------
File to patch:

TR’s picture

See where it says "Perhaps you used the wrong -p or --strip option?" That's indeed the case.

In Drupal patches should always be -p1, and should be run from the ubercart directory (not the ubercart/payment/uc_credit directory). But in this case the patch was improperly made, so you should use -p2 from the ubercart directory.

jack_saghbazarian’s picture

I installed the module and managed to make it work, applied the latest patch but my problem is:

when i add a product to the cart it is not factoring in the attribute price adjustment, it is showing the original price. Although the chosen attribute is being displayed but not adding or subtracting the price difference from the original price.

ps: i can see the price adjustment on the product page but once i click add to cart...

any help will be appreciated.

thanks

The last submitted patch, 42: 1097668-full-order-object-admin-listings.patch, failed testing.

isntall queued 30: create_order_fix.patch for re-testing.

The last submitted patch, 42: 1097668-full-order-object-admin-listings.patch, failed testing.

The last submitted patch, 30: create_order_fix.patch, failed testing.

The last submitted patch, 41: 607708-currency-per-order.patch, failed testing.

KaiserM’s picture

I'm having exactly the same issue as Jack Saghbazarian, #137.

Anyone fixed this?

"I installed the module and managed to make it work, applied the latest patch but my problem is:

When I add a product to the cart it is not factoring in the attribute price adjustment, it is showing the original price. Although the chosen attribute is being displayed but not adding or subtracting the price difference from the original price.

PS: I can see the price adjustment on the product page but not in the cart..."

mirhamzah’s picture

No support for multi-currency in D8 ?