Download & Extend

Provide order data as context for uc_price (for multicurrency support)

Project:Ubercart
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Issue tags:multicurrency

Issue Summary

When the Review page is being displayed, the cart checkout pane's rows are run through uc_price, but the order isn't being provided as a part of the context of the call. I'll attach a patch shortly which does this.

Comments

#1

Status:active» needs review

So, here's the patch I created to provide an order context to uc_price - please review.

AttachmentSizeStatusTest resultOperations
ubercart-621494.patch1.27 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch ubercart-621494.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details | Re-test

#2

Title:Cart Checkout Pane on Review page does not provide order as part of context to uc_price» Provide order data as context for uc_price (for multicurrency support)
Version:6.x-2.0» 6.x-2.x-dev

Re-rolling against current Ubercart and attaching changes from http://www.vintagedigital.net/content/how-add-multicurrency-support-uber... as well.

This patch sets $context['subject']['order'] = $order for each core UC payment module, and in a few other locations where uc_price() might need the contextual data to set price information based on the order details.

The benefit of doing this is that the order can store currency information, and the displayed price reflect the currency which the order occurred in.

I have not looked into why this patch does this, though:

@@ -377,7 +380,7 @@ function uc_payment_get_totals($return = FALSE, $order = NULL) {

     $context['revision'] = 'themed';
     $context['type'] = 'amount';
-    unset($context['subject']);
+    unset($context['subject']['line_item']);
     $output .= '<tr><td align="right"><b>'. t('Order total:') .'</b></td>'
               .'<td align="right">'. uc_price(uc_order_get_total($order), $context)
               .'</td></tr></table>';
AttachmentSizeStatusTest resultOperations
ubercart-621494-provide_order_context_to_uc_price.patch12.08 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch ubercart-621494-provide_order_context_to_uc_price.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.View details | Re-test

#3

Currently testing this code in line with development on a multicurrency payment gateway for Ubercart.

#4

Hmm. Possibly duplicated by existing work on #1097668: Multicurrency support as well.

#5

Status:needs review» needs work

The last submitted patch, ubercart-621494-provide_order_context_to_uc_price.patch, failed testing.

nobody click here