Having upgraded to ubercart 6.x-2.6 recently, I've discovered that uc_multiprice module is no longer able to alter the displayed currency in the uc_cart block, on the /cart page or on the cart checkout pane, the reason being that the uc_price() context "themed-original" is being used instead of "themed". Now, I know there may be reason why you want to display the original unaltered version, I just can't think of any! Attached patch fixes this - at least until such a time as uc_multiprice module adds in the new currency features recently added to ubercart.

#15 uc_cart.module-sign-bug-1304884.patch2.87 KBkenorb
PASSED: [[SimpleTest]]: [MySQL] 2,186 pass(es). View
#15 Screen Shot 2013-10-02 at 22.33.35.jpg52.6 KBkenorb
#15 Screen Shot 2013-10-02 at 22.33.54.jpg53.43 KBkenorb
#15 Screen Shot 2013-10-02 at 21.40.01.png26.62 KBkenorb
#15 Screen Shot 2013-10-02 at 22.24.12.png24.46 KBkenorb
#13 Screen Shot 2013-10-02 at 09.51.21.png49.32 KBkenorb
#9 uc_cart.module-sign-bug-1304884.patch997 byteskenorb
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch uc_cart.module-sign-bug-1304884.patch. Unable to apply patch. See the log in the details link for more information. View
cart_multiprice.patch1.77 KBstella
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch cart_multiprice.patch. See the log in the details link for more information. View
Members fund testing for the Drupal project. Drupal Association Learn more


Status: Needs review » Needs work

The last submitted patch, cart_multiprice.patch, failed testing.

longwave’s picture

Status: Needs work » Postponed (maintainer needs more info)

The code you reference in the patch hasn't changed in two years, so I'm not sure why this is only affecting uc_multiprice now?


longwave’s picture

Also I think the reason for using themed-original here is that the prices have already been altered, so we don't want them to be altered again (e.g. by a VAT or discount module)

stella’s picture

Status: Postponed (maintainer needs more info) » Needs work

I'm not sure why it happens now either. I just upgraded from ubercart 6.x-2.4 to 6.x-2.6 and things suddenly no longer work as expected. Looking back at 6.x-2.4 I can see those lines haven't changed alright, but something must have changed elsewhere though that is affecting this?

Basically I have a setup where I have 2 prices for each product configured, one in the site default currency (EUR) and one for the UK (so in GBP). I can switch between the two currencies fine and the price displayed updates, but the currency displayed in the cart block, cart page, cart checkout pane is always in EUR. However, the currency displayed above the credit card block and on the order review page are both correct. It's just those coming from the cart module that are problematic.

Perhaps the api changed somewhere and uc_multiprice needs to be updated? but I can't see where or what would do it.

workinhard’s picture


I would like this module in D7 - am willing to sponsor for this - possibly we could club together to get a fix for the above problems and a conversion - anyone interested?

neokoenig’s picture

I've got a client interested in multicurrency for 3.x on D7 too.. subscribing.

longwave’s picture

Status: Needs work » Closed (won't fix)

As 6.x is coming to end of life and uc_multiprice has less than 100 users, not sure it is worth fixing this now. If anyone is still interested please reopen, preferably with a patch!

kenorb’s picture

Version: 6.x-2.12 » 6.x-2.6
Status: Needs review » Closed (won't fix)

The same problem here.
When $context['revision'] is 'themed-original', no alternation can be done.
This was working fine in earlier versions of Ubercart.
I can confirm that the patch fix the problem straight away.

Steps to reproduce the problem:
1. Add item to the cart.
2. Go to: /cart
3. Change currency to different one.
URL has other currency in the URL such as /cart?currency=GBP but the sign in the cart shows the default currency (USD).
The price is converted correctly, so the problem is only with the currency sign.

kenorb’s picture

997 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch uc_cart.module-sign-bug-1304884.patch. Unable to apply patch. See the log in the details link for more information. View

Patch against UC 2.12

It's actually upgrade to 6.x-2.6 broke this functionality.

These are the changes between 2.5 and 2.6 which broke this:

--- a/sites/all/modules/ubercart/uc_cart/uc_cart.module
+++ b/sites/all/modules/ubercart/uc_cart/uc_cart.module
@@ -669,12 +669,21 @@ function theme_uc_cart_block_items($items) {
     $output = '<table class="cart-block-items"><tbody>';
     $row_class = 'odd';
+    $context = array(
+      'revision' => 'themed',
+      'type' => 'price',
+    );
     // Loop through each item.
@@ -709,11 +718,15 @@ function theme_uc_cart_block_items($items) {
  * @ingroup themeable
 function theme_uc_cart_block_summary($item_count, $item_text, $total, $summary_links) {
+  $context = array(
+    'revision' => 'themed-original',
+    'type' => 'amount',
+  );
   // Build the basic table with the number of items in the cart and total.
@@ -897,12 +910,16 @@ function uc_cart_view_form($form_state, $items = NULL) {
     '#tree' => TRUE,
+  $context = array(
+    'revision' => 'themed-original',
+    'type' => 'amount',
+  );
   $i = 0;
   foreach ($items as $item) {
@@ -1105,12 +1122,15 @@ function uc_cart_view_table($table) {
     $table[$i]['#attributes'] = array('valign' => 'top');
+  $context = array(
+    'revision' => 'themed-original',
+    'type' => 'amount',
+  );
   $table[] = array(
     'total' => array(
@@ -638,17 +650,25 @@ function theme_cart_review_table($show_subtotal = TRUE) {
     $description = check_plain($item->title) . uc_product_get_description($item);
+    // Remove node from context to prevent the price from being altered.
+    $context['revision'] = 'themed-original';
+    $context['type'] = 'amount';
+    unset($context['subject']);
     $rows[] = array(
       array('data' => t('@qty&times;', array('@qty' => $item->qty)), 'class' => 'qty'),
       array('data' => $description, 'class' => 'products'),
-      array('data' => uc_price($total), 'class' => 'price'),
+      array('data' => uc_price($total, $context), 'class' => 'price'),
   // Add the subtotal as the final row.
   if ($show_subtotal) {
+    $context = array(
+      'revision' => 'themed-original',
+      'type' => 'amount',
+    );
     $rows[] = array(
-      'data' => array(array('data' => '<span id="subtotal-title">' . t('Subtotal:') . '</span> ' . uc_price($subtotal), 'colspan' => 3, 'class' => 'subtotal')),
+      'data' => array(array('data' => '<span id="subtotal-title">' . t('Subtotal:') . '</span> ' . uc_price($subtotal, $context), 'colspan' => 3, 'class' => 'subtotal')),
       'class' => 'subtotal',
kenorb’s picture

Status: Closed (won't fix) » Needs review

Version: 6.x-2.6 » 6.x-2.12
Status: Closed (won't fix) » Needs work

The last submitted patch, uc_cart.module-sign-bug-1304884.patch, failed testing.

kenorb’s picture

Similar thing happens on invoice at: /user/%/order/%/invoice/print
$order_subtotal has the correct currency sign, $order_total hasn't ($ instead of £).

kenorb’s picture

The same happening on uc_order_pane_payment at /admin/store/orders/%.

The following patch fixes the problem:

--- a/payment/uc_payment/uc_payment_order_pane.inc
+++ b/payment/uc_payment/uc_payment_order_pane.inc
@@ -19,7 +19,7 @@ function uc_order_pane_payment($op, $order) {
       $output = '';
       if (variable_get('uc_payment_tracking', TRUE)) {
         $context = array(
-          'revision' => 'formatted-original',
+          'revision' => 'formatted',
           'type' => 'amount',
           'subject' => array(
             'order' => $order,

And also on invoice page at /admin/store/orders/%/invoice/print.

The following patch, fixes the problem:

--- a/uc_order/uc_order.module
+++ b/uc_order/uc_order.module
@@ -459,7 +459,7 @@ function uc_order_token_values($type, $object = NULL) {
       $values['order-subtotal'] = $subtotal;
       $values['order-subtotal-raw'] = $subtotal_raw;
       $context = array(
-        'revision' => 'formatted-original',
+        'revision' => 'formatted',
         'type' => 'order_total',
         'subject' => array(
           'order' => $order,
kenorb’s picture

Version: 6.x-2.12 » 6.x-2.x-dev
Status: Needs work » Needs review
24.46 KB
26.62 KB
53.43 KB
52.6 KB
2.87 KB
PASSED: [[SimpleTest]]: [MySQL] 2,186 pass(es). View

URL: /admin/store/orders/%
Before the patch:

After the patch:

URL: /admin/store/orders/%/invoice
Before the patch:

After the patch:

longwave’s picture

Status: Needs review » Postponed (maintainer needs more info)

The changes you list in #9 were not changed between 6.x-2.5 and 6.x-2.6 as far as I can see? They seem to have been there since 6.x-2.0 beta releases when uc_price() was first added, looking at git history.

We need the -original prices at those points to avoid price alterers (such as uc_vat) modifying the price twice. The price handler system is unfortunately fundamentally broken, and I don't want to commit such a patch now to 6.x that might fix the uc_multiprice problems for your site, while causing other problems for existing users.

As a lot of these are in theme functions, you should be able to override many of them in your own theme, if that helps.

longwave’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

I don't see a way forward with this without breaking existing sites, and it is probably not worth spending time on this at this stage in the 6.x-2.x cycle.