Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customer completed order email is sent in the wrong language #3

Closed
johnclause opened this issue Mar 20, 2015 · 54 comments · Fixed by #5
Closed

Customer completed order email is sent in the wrong language #3

johnclause opened this issue Mar 20, 2015 · 54 comments · Fixed by #5

Comments

@johnclause
Copy link
Member

Submitted in two places by https://wordpress.org/support/profile/og-s:
https://wordpress.org/support/topic/woocommerce-emails-3
https://wordpress.org/support/topic/wrong-email-language

The description copied here:

I'm using the latest version of Github qTranslate-X, WooCommerce & qTranslate-X

The customer processing order email is sent in the correct language. But than, all e-mails sent from the woocommerce admin are sent in the wrong language. The customer completed order email is sent in the wrong language. It seems that the default language is used.

@johnclause
Copy link
Member Author

Is this e-mail sent in the response to admin action? Indeed, then admin language will be used. Interesting, nobody noticed this before. A workaround would be to switch admin panel to the language needed before pressing button to complete order.

Before we go further, could you confirm that this works?

Michel (@mweimerskirch), did you hear about such problem before?

@OGSWEB
Copy link

OGSWEB commented Mar 20, 2015

The default language defined in qtranslate is used (not the admin language)

@johnclause
Copy link
Member Author

Anyway, I think this would not be very easy to solve (unless Michel already had this problem and has a solution), since the original language used on order is not saved anywhere with order, as far as I can imagine. We will have to figure out a way where to save it and then to re-use it on further admin emails.

@OGSWEB
Copy link

OGSWEB commented Mar 20, 2015

Do you think it can be resolved? Can I implement the solution from Michel ?

@johnclause
Copy link
Member Author

I am sure it can be done, just will take some time. We have to see what Michel says.

@mweimerskirch
Copy link
Contributor

My plugin didn't solve this either. Actually, I've never even thought about it. I'll see if I can find out whether it's possible or not. I think the only way to make it work would be to store the language at the time the order is made, because WooCommerce has an option to order without creating a user account. This way, the correct language would be used wheter or not the customer has a user account or not.

mweimerskirch added a commit to mweimerskirch/woocommerce-qtranslate-x that referenced this issue Mar 21, 2015
* Store the current WordPress language along with the order, so we know later on which language the customer used while ordering
* Append the language to the link for changing the order status, so that mails are sent in the language the customer used during the order process
@MarioS3
Copy link

MarioS3 commented Mar 22, 2015

I have a problem with order emails as well:

automatic email for processing order is sent ok and in correct language (the one that was chosen while making order). But all emails after that look like this:

SUBJECT: [:hr]Vaša Web narudžba od 22/03/2015 je dovršena[:en]Your MK LED Auto/Moto rasvjeta order from 22/03/2015 is complete[:]

Also if I add note to order or if it is marked as completed (basically every email after automatic processing email), it will be send in language that is used in admin panel. I tried several times and it's always like that.

Interesting is that if I deactivate qtranslate & woocommerce plugin, emails are fine, subject is ok and based on language that is used in admin panel.

Can you repair those 2 things?

@mweimerskirch
Copy link
Contributor

@MarioS3 your second problem (" it will be send in language that is used in admin panel") should be solved by #4. Please check if it works for you.

mweimerskirch added a commit to mweimerskirch/woocommerce-qtranslate-x that referenced this issue Mar 22, 2015
* Translate email subjects and email headings
@mweimerskirch
Copy link
Contributor

@MarioS3 I added a fix for your first problem to #4 as well. Please test it and let us know if it works for you as well.

johnclause added a commit that referenced this issue Mar 22, 2015
@johnclause
Copy link
Member Author

@OGSWEB, @MarioS3: just in case you are not sure, to test it, download the latest integrating plugin from GitHub https://github.com/qTranslate-Team/woocommerce-qtranslate-x, use "Download ZIP" button, or press here for the sake of convenience.

If all goes well for you, we will publish it as next release, version 1.1.

@OGSWEB
Copy link

OGSWEB commented Mar 22, 2015

Parse error: syntax error, unexpected T_FUNCTION in ...woocommerce-qtranslate-x/qwc-admin.php on line 558

@mweimerskirch
Copy link
Contributor

I changed the code so it is compatible with PHP 5.3 again.
@OGSWEB You should upgrade to 5.4. PHP 5.3 is no longer supported by the PHP developers.

@johnclause
Copy link
Member Author

I did not mean to close it yet, I do not know why it did, but anyway we can write to closed issue and may re-open if it gets big again.

@OGSWEB, @MarioS3: to test it again, deactivate previously tested plugin, delete its files, then do as before: download the latest integrating plugin from GitHub https://github.com/qTranslate-Team/woocommerce-qtranslate-x, use "Download ZIP" button, or press here for the sake of convenience. You will see the same version 1.1 on newly downloaded plugin, but it is updated.

@mweimerskirch
Copy link
Contributor

@johnclause: It closed, because I wrote "Fixes #3" in the pull request.

@MarioS3
Copy link

MarioS3 commented Mar 25, 2015

I deleted last posts, this is summarized one:

This is list of all problems with plugin version 1.1 activated:

  • There in no data on thank you page, no message on thank you page
  • Total sum in new order email is 0
  • In new order email, there is no billing or shipping address, no customer data
  • Customer doesn't get processing order email at all

When deactivated following problems appear:

  • products are displayed wrong in shopping cart widget, in emails and in admin orders (this is fixed when plugin is activated). Example:

[:hr]Osram Cool Blue Hyper 12V - do 50% bjelije (5000K)[:en]Osram Cool Blue Hyper 12V - up to 50% whiter light (5000K)[:]

  • emails are sent in wrong language (this is fixed when plugin is activated)

@johnclause
Copy link
Member Author

Sorry, guys, for the delay. We will take a look into it, hopefully over this weekend.

@johnclause johnclause reopened this Mar 27, 2015
@OGSWEB
Copy link

OGSWEB commented Mar 31, 2015

Hope you can fix it :-)

@johnclause
Copy link
Member Author

Apparently Michel is currently unavailable. I may take a look into it within next couple of days. Sorry for the delay.

@mweimerskirch
Copy link
Contributor

I tried reproducing the issues over the weekend, but I wasn't able to. Tried again just now. Everything works fine for me. Are you using any other WooCommerce-related plugins? If yes, try deactivating them. Also, please try using one of the default WordPress themes. Other themes might override the WooCommerce templates and they might ignore some of the newer filters.

@MarioS3
Copy link

MarioS3 commented Mar 31, 2015

@mweimerskirch There were no problems of this kind with previous version, they started with 1.1 version. I don't have overridden templates or anything that could possibly affect to the list of problems that I stated above. Also it's happening on "stock" COD payment method, I didn't even try custom ones, so that also shouldn't be a problem. I have U-design theme, I think that can't be problem also. Maybe you can check by yourself if you are willing to?

@johnclause
Copy link
Member Author

one of the default WordPress themes

Which one, for example, would you recommend for testing?

I am trying Storefront now and cannot get it working in a meaningful way. Emails are not sent to customer, 'thank you' page is apparently messed up, it is basically empty and error message is shown

Notice: Undefined variable: order in /wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php on line 196

Order is shown in multiple languages in /wp-admin/post.php?post=XX&action=edit, and some fields are raw multilingual fields. If I press 'Save Order', email then goes in admin language. However, I verified that, your filter 'save_post' worked and there is meta value for order language in the database.

That is the story so far.

@MarioS3
Copy link

MarioS3 commented Apr 1, 2015

Same problems like johnclause, looks like I'm not the only one :)

@mweimerskirch
Copy link
Contributor

Hmm, strange. I'll check again today. Maybe I mistakenly tested one of my branches instead of the "master" branch. I'll let you know.

As to the theme: Any theme that does not include WooCommerce files is fine for testing. If there are WooCommerce files in the theme, they might override the original ones.

mweimerskirch added a commit to mweimerskirch/woocommerce-qtranslate-x that referenced this issue Apr 1, 2015
@MarioS3
Copy link

MarioS3 commented Apr 1, 2015

I tested you new release and here is summary:

  • There in no data on thank you page, no message on thank you page - OK now
  • Total sum in new order email is 0 - OK now
  • In new order email, there is no billing or shipping address, no customer data - OK now
  • Customer doesn't get processing order email at all - OK now

But there are still some problems (So far that I noticed):

  • mail with Note is sent like this - [:hr]Vašoj Web narudžbi je dodana napomena[:en]A note has been added to your order[:]
  • automatic processing mail is in correct language but all others are still in admin language
  • new order email (repeated one, from admin bar) is send like this - [:hr]Web narudžba[:en]Web order[:]

These are now really small problems, not crucial ones :)

@mweimerskirch
Copy link
Contributor

The "your order is complete" mail should be sent in the correct language though. (the one that is sent when you click the "complete" button:
image

Other issues:

  • I've never used the notes before. I'll work on that
  • With "all others" you mean when you resend one from here?:
    image
    I did indeed not look after these. All the mails are sent using different mechanisms, so we have to use different workarounds.

@mweimerskirch
Copy link
Contributor

I committed another patch that fixes the translation tags displayed in the "note added to your order" mail. It does not yet use the user's language (working on that) but at least it does not show translation tags in the subject anymore.

@MarioS3
Copy link

MarioS3 commented Apr 1, 2015

@mweimerskirch yes all others are these from "resend order emails" :)

mweimerskirch added a commit to mweimerskirch/woocommerce-qtranslate-x that referenced this issue Apr 1, 2015
…ls are sent in the language the customer used during the order process

Needed, so the "note added to your order" mails are sent in the correct language
Issue qTranslate-Team#3
@mweimerskirch
Copy link
Contributor

And another one. This one is for the "note added to your order" emails.

I'm not sure yet what to do about the "resend order emails" action. If that is the only thing missing, I'd suggest to create a new issue just for this.

@johnclause
Copy link
Member Author

I committed a few more filters to help with translations from order editor page and things like e-mail footer and 'from name' on re-sent email, which you probably did not yet tried to localize.

At this point, in my testing, everything is fine except e-mails re-sent from order editor page with a press of button "Save Order". E-mail now goes partly in the language of order, and partly in admin language. This problem may be very difficult to solve, because the order editor page and action of sending email are both processed within the same request. By the time of email sending, some strings are already translated into admin language and use of filters 'woocommerce_before_resend_order_emails' and 'woocommerce_after_resend_order_emails' only helps on a part of email. I do not know how to solve this. I am curious, how WPML does it? Does anyone have an experience with it?

With the exception mentioned, are we done here? There is a workaround in the worst case, switch admin to the language of order before sending e-mail. It works, it is inconvenient, but better than nothing.

@johnclause
Copy link
Member Author

Michel, it just occured to me that we may ask Woocommerce to change the way they send e-mails from editor pages. It would not be difficult for them to use ajax calls instead in which we could sent language to be different. I have already asked them for a couple of changes, and they did cooperate. But we would need to prepare a complete solution with a single clean PR to simplify their work. They will be naturally concerned not to break anyone, so we really need to test it all in all the ways before coming to them. Do you think it may work?

@MarioS3
Copy link

MarioS3 commented Apr 2, 2015

There is just one more problem with completed email (after clicking button for completed order):

This are Instructions for COD payment gateway, they were shown in both languages like this:

[:hr]Molimo Vas da proizvode platite gotovinom prilikom preuzimanja paketa. Detalje o narudžbi možete pratiti preko Korisničkih stranica.[:en]Please pay your Order with cash when it is delivered to your address. Details about order can be seen on My Account page.[:]

@johnclause
Copy link
Member Author

It did not reproduce for me, but I noticed that email footer is wrong. Is footer correct for you?
@MarioS3: Try new order from scratch again. If instructions are still wrong, that must be on your theme template overrides. To test the theory, remove template overrides and see if it helps. If it does, then you can fix it under a child theme. Woocommerce has instruction on how to override templates. I also assume you use the latest version of everything?

@MarioS3
Copy link

MarioS3 commented Apr 2, 2015

@mweimerskirch I don't have template overrides. I tried again, from new order - automatic email instructions are fine and they look like this:

  • Molimo Vas da proizvode platite gotovinom prilikom preuzimanja paketa. Detalje o narudžbi možete pratiti preko Korisničkih stranica.

but when these instructions are displayed in completed order email (or repeated emails from "Order actions", than they are like this:

  • [:hr]Molimo Vas da proizvode platite gotovinom prilikom preuzimanja paketa. Detalje o narudžbi možete pratiti preko Korisničkih stranica.[:en]Please pay your Order with cash when it is delivered to your address. Details about order can be seen on My Account page.[:]

It's not that big problem - take your time :)

Was there maybe new update after this one? #3 (comment)

@johnclause
Copy link
Member Author

I am sorry, footer is correct, I had it typed in wrong way. So all good for me. @OGSWEB, are you testing it too? Can we release 1.1?

@johnclause
Copy link
Member Author

@MarioS3, yes, I followed your instructions and tested both ways for completed email. It works fine for me, and for COD as well.

I don't have template overrides

I meant, your theme may have it overridden, almost surely. But you can change the overrides through child theme. Please, read Woocommerce instructions. Are you using the latest Woocommerce and WP?

@MarioS3
Copy link

MarioS3 commented Apr 2, 2015

There is one more little thing to look out - this is button when you enter to product attributes :)

image

@johnclause maybe it's because of U-Design, I wouldn't know. Yes, latest Woocommerce and WP.

@johnclause
Copy link
Member Author

@mweimerskirch, do you think we are ready to release 1.1? Do you think we should describe the little issue left with sending admin email from order editor page in an "Known Issue" section? Do you wish to do it, or do you wish me to do it?

@mweimerskirch
Copy link
Contributor

Yes, I think we can release. I'll prepare something for the known issues.

@johnclause
Copy link
Member Author

@MarioS3:

maybe it's because of U-Design, I wouldn't know

I am saying that you can know. Remove overrides temporary to test. Woocommerce instructions on child theme creation explain how it works.

@johnclause
Copy link
Member Author

@mweimerskirch: thanks for the readme, I expanded it a little bit, https://github.com/qTranslate-Team/woocommerce-qtranslate-x#known-issues, and also included the issue with buttons display as @MarioS3 reported. For the latter, I will need to adjust qTranslate-X, may be on 3.3 release, which is coming soon. Anything else I missed?

I would wait for a final feedback from @OGSWEB and @MarioS3, since they are probably the only ones at trouble now with the older version.

@johnclause
Copy link
Member Author

@MarioS3: did you figure it out? What is the status?

@johnclause
Copy link
Member Author

@OGSWEB: Are you still interested?

@OGSWEB
Copy link

OGSWEB commented Apr 4, 2015

Yes of course :-) ! Thank you very much !! I was very busy but I will make tests next week

@MarioS3
Copy link

MarioS3 commented Apr 4, 2015

@johnclause I didn't, it's probably because of U-Design since I'm the only one having this "Instructions" issue. You may proceed with official update.

@johnclause
Copy link
Member Author

probably because of U-Design

If so, then this would be totally fixable with a child theme creation and a little modification, as Woocommerce recommend on their 'System Status' page: "If you're modifying WooCommerce or a parent theme you didn't build personally we recommend using a child theme. See: How to create a child theme."

@johnclause
Copy link
Member Author

Version 1.1 is released. Seems like this issue can be closed, we can still continue discussion under closed issue, if needed.

@Excelautomation
Copy link

What is the status on this? I'm experiencing language problems with basicly all email templates. They are send in wrong language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants