Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When you are on the checkout page, either view or review mode, the cart content pane does not translate on multilingual sites. I.e the product description always shows in Englis.
Here is patch to ubercart/uc_cart/uc_cart_checkout_pane.inc that fixes the issue by first checking if we are on a translation page, and then using the tnid to get back the product description.
This patch does not fix issues with attributes however, they remain untranslated.
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedLooks like I submitted a reverse patch, trying again.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedSomeone on #ubercart suggested I wrap the code in module_exists('translation') blocks, just in case :)
updated patch
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #4
TR CreditAttribution: TR commentedI think this is wrong:
uc_pnslation_node_get_translationroduct_get_description($item)
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedThanks! Obviously a vi typo.
resubmitting
Comment #6
robby.smith CreditAttribution: robby.smith commentedsubscribing
Comment #7
stewart.adam CreditAttribution: stewart.adam commentedThe patch looks good, except that I would try to optimize the part that sets $desc. It looks like in whether or not the translation module exists this call is always performed:
So no need to have it inside and outside the conditional.
Comment #8
xibun CreditAttribution: xibun commented+1
Comment #9
YK85 CreditAttribution: YK85 commentedsubscribing
+1 for translatable content in Ubercart
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedI submitted this patch 5 months ago but it doesn't seem to have been picked up by the Ubercart folks.
I know it's perhaps not the best solution but it's the best I can come up with my limited knowledge.
If it's not good enough or correct enough it would be nice to get some feedback/direction from the UC maintainers perhaps? :)
Comment #11
TR CreditAttribution: TR commentedThe only review this patch has received was #7, who suggested a change and moved the status to "needs work". His concern has not been addressed by you or anyone else, so the patch is not ready to commit. Even then, I'd like to see someone do some real testing on this. I do not use the translation module so I can't test it myself. But I was under the impression that having a separate nid for translated product content causes lots of problems, for instance stock isn't decremented correctly because stock levels are associated with a nid. That said, even if your patch doesn't cause problems, it may not be the right thing to do.
Comment #12
Anonymous (not verified) CreditAttribution: Anonymous commentedTR, as I posted above, I'm hoping that someone else will pick this up. I'm not a Drupal developer and anything more than the simple patch I submitted is out of my league.
I agree with you that my patch may or may not be the right way to go. Could an 'expert' from the UC group yea-or-nay this approach or offer comments?
Or if this is not high on the UC team's priority list, which I can accept, let us know and I'll let this die. Or perhaps the issue needs to be reformulated and a new, better worded, issue raised so the UC team can address it?
UC is definitely the best e-commerce module for Drupal bar none, but one of it's major weak points is multi-lingual sites and this is my attempt at trying to help on this front :)
Comment #13
alduya CreditAttribution: alduya commentedI updated the totsubo's patch from #5 with the comments firewing1 gave in #7.
I don't know Übercart well enough to decide if this is the best solution, but this makes translating Übercart a little less troublesome.
Comment #14
longwaveA slightly different approach is attached. A new checkbox, "Use source translation node when adding products to the cart", is added to the cart settings. When this is enabled, product titles will be translated in the cart and checkout and the localized name will be stored against the order, but translated products will be grouped together in the cart and reports - however, this is at the expense of allowing different product settings per language. Seems to work well if you are using i18sync module and the fields sync patch that was committed recently.
Further work is needed to support attributes and some other modules, but as this new option is disabled by default it could still be committed as-is.
Comment #16
TR CreditAttribution: TR commentedPay no attention to the bot behind the curtain...
Can't trust the test results yet - bot is misbehaving. I reported the above failure as a testbot bug, see #1096900: Releases should not be tested.
Comment #17
splash112 CreditAttribution: splash112 commentedsubscribe
Comment #18
kenorb CreditAttribution: kenorb commented#14: uc_cart-translation.patch queued for re-testing.
Comment #20
longwaveThis is unlikely to be fixed in 6.x now, as nobody tested the patch I uploaded two years ago in #14. This could still be changed in 7.x if someone wants to work on it.
Comment #21
kenorb CreditAttribution: kenorb commentedI've this patch already applied to one live site for over 1 year, so this patch actually has been tested under 6.x
Comment #22
kenorb CreditAttribution: kenorb commented