If you have a multilanguage site with ubercart when you change the language of the checkout pane items loaded with AJAX like Credit Card payment pane don't get translated.
$contents['payment_method'] = array(
'#type' => 'radios',
'#title' => t('Payment method'),
'#options' => $options,
'#default_value' => $default,
'#disabled' => count($options) == 1 ? TRUE : FALSE,
'#required' => TRUE,
'#attributes' => array('onclick' => "get_payment_details('cart/checkout/payment_details/' + this.value);"),
'#theme' => 'uc_payment_method_select',
);
Checkout in Spanish (URL = es/cart/checkout) should call get_payment_details('es/cart/checkout....') not get_payment_details('cart/checkout...')
Comments
Comment #1
jherencia commentedI think this might fix it.
Comment #2
Island Usurper commentedCan you please reroll the patch in unified format? The syntax is
diff -upif that's the program you used.Comment #3
jherencia commentedHere it goes.
Comment #4
rszrama commentedSo this is a compatibility issue with the i18n module? I'm not sure why you're manually adding in the ?q to the path in the JS. I thought we had a workaround for that?
Comment #5
Island Usurper commentedI don't think Drupal.settings.basePath includes ?q=, regardless of the clean URLs setting.
Comment #6
wojtha commentedHello there,
I have ran today in similar issue and came with similar solution, but with little bit different approach.
What about let the Drupal core to completely take care about the urls?
Then in uc_payment.js file we can just simply use:
I'm now on RC3, if you wish I can make some patch against Dev.
Comment #7
giorgoskpatch from #3 works as expected
@wojtha
A patch would be greatly appreciated since it would be easier to test ...
I am changing the files manually and then UC thinks javascript is disabled and gives this message
Comment #8
Island Usurper commentedHere's a patch that implements wojtha's idea for the payment pane.
Something kind of weird happens, though,
and I'm not sure whywhen I use Secure pages. If I go to the checkout page in another language, everything seems to work fine (shipping quotes show up, taxes are added, the line items are regenerated) until I try to switch payment methods. The loading image appears, but nothing ever replaces. Firebug tells me that a 302 Found response was returned without any data. What's really odd is that if I try to switch payment methods again, it works. HTTP 200 OK, and the correct form elements appear (in the correct language, too). Every other time the payment method is changed, it works, and then it doesn't. It doesn't matter if I click on the same payment method or a different one, Firebug's console has zebra stripes for successful and failed requests.Now that I remember right, someone's reported a similar problem. I don't think anyone had any good ideas about how to fix it.
I believe they are separate problems, though, so this patch ought to work fine on its own.
Comment #9
rszrama commentedMantooth, you sly animal. We should've thought of this approach sooner. : P
Comment #10
Island Usurper commentedNo, no. All credit goes to wojtha. I just made it happen.
Comment #11
rszrama commentedAhh, I see. Duly noted. Way to go, wojtha!
Comment #12
rszrama commentedComment #13
giorgosk#8 resolves the problem
+1 for commiting this
Comment #14
Island Usurper commentedJust had a thought. The same thing should probably be done for shipping quotes, and maybe taxes. Those can conceivably return translatable data, so the correct language should be taken into account.
Comment #15
wojtha commented@rszrama, @Island Usurper
Sorry guys, I have had no time /until now/ to make a patch. Nice to see my one of thoughs is going (probably) to be part of UC :-D
I can confirm that this code is working on one of my live sites. But it is only small shop - I don't use Https - so I can't test the Secure Pages issue mentioned in #8.
Comment #16
wojtha commentedStatus changed by accident... Most probably I opened this issue before Island Usurper sent his comment #14 and changed the status.
Comment #17
Island Usurper commentedWell, at least now the URLs are consistent. It turns out that the quote system needs more work to be truly translatable. However, now we can actually test any work done towards that.
Comment #18
Island Usurper commentedCommitted. This issue is about as fixed as it will get. The Secure Pages problem will need to be looked into further, but I think it's outside of this issue's scope.
Comment #19
Island Usurper commentedI should know better than to make statements like that. Someone apparently put the wrong key for the shipping quotes URL, and we shouldn't leave out the products order pane, either.
Comment #20
rszrama commentedFixed it for me. Drop the hammer!
Comment #21
Island Usurper commentedFire in the hole!
Er, I mean "committed".