Posted by jcfiala on November 2, 2009 at 10:49pm
| 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
So, here's the patch I created to provide an order context to uc_price - please review.
#2
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>';
#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
The last submitted patch, ubercart-621494-provide_order_context_to_uc_price.patch, failed testing.