Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › eStore – Email Settings – how to use for multilangauge site
Tagged: email settings
- This topic has 5 replies, 4 voices, and was last updated 8 years, 7 months ago by Olik.
-
AuthorPosts
-
January 16, 2015 at 4:34 pm #12069MarekMember
Hi,
I have site with few languages and I would like to use eStore.
I would like that email body (Buyer) is language specific. Is it possible? I use Polylang.
Thanks
Marek
January 16, 2015 at 7:42 pm #68045MarekMemberAdditional info: I use only donation button, no cart.
Marek
January 16, 2015 at 7:59 pm #68046wzpModeratorThe email body cannot be multi-lingual. It can only be in whatever language you put into the email body template.
April 25, 2016 at 11:04 pm #68047OlikMemberActually, I might have a solution for this, both the labels, and the emails. Without changing TipsAndTricks plugins. Are you interested to see it?
April 26, 2016 at 7:02 am #68048adminKeymasterYeah sure. Please share your solution.
April 26, 2016 at 3:22 pm #68049OlikMemberActually, for emails there can be a very simple solution, not requiring any code changes anywhere: the email bodies can just contain texts in both languages, and these combined texts can be entered in Settings for TTHQ plugins (I’ll call them “your plugins” here).
But that’s not the solution I wanted to suggest. Since I value very highly seamless integration, and therefore not changing your plugins code, what I was thinking, when trying to find a solution, was how I could hack the path, on which your plugins get these values. And I found the way.
The trick is in using filters. Your plugins get these values with get_option, and fortunately, we have not only option filter, but even pre_option filter, that is called before going to database.
So, the algorithm roughly is like the following:
1. in Plugin Organizer, load Polylang first
2. in your own (client) functions define filters for all get_option that eStore & … use. It is simple to find them all at: wp-admin/options.php
3. redefine the option filter for language, too, using conversion from Polylang values to eStore file names, like in the example code below.
For WP eMember:
all is in
eMember_configs
, so replace emails there,all messages (that content is not available, for example, and so on) define in shortcode attributes and your own text (for each page), or use your __(),
in forms hide fields text is stubborn in, and add yours with same links,
(you can always use jQuery as well! if Polylang vars are not available there, pass them with wp_localize_script, and then replace everything in page as you like.
interesting to use wp_localize_script by its direct purpose, too
why: you cannot (you better not) change the eStore code, where they create those forms, to insert there your text. But you can hide elements with css and then append or replace text and show, with jQuery)
for the rest hope it’s more or less international ♥
For eStore:
for the
eStore_cart_language
define pre_option filter applying conversion like in the following (what you’re interested in, is only the file names):`else if (ICL_LANGUAGE_CODE == “en”){
$language_file = “languages/eng.php”;
}
else if (ICL_LANGUAGE_CODE == “de”){
$language_file = “languages/ger.php”;
}
else if (ICL_LANGUAGE_CODE == “fr”){
$language_file = “languages/fr.php”;
}`
like it’s said at https://support.tipsandtricks-hq.com/forums/topic/multilanguage-support/page/2#post-28494
and define pre_option filters for all emails, returning them accordingly to your language.
For WP Affiliate:
thank God all is available as for eStore:
wp_aff_language
& email bodies, too.Interesting how pages in affiliate center are created. Maybe changing
wp_aff_language
will take care of it.That’s it.
It is not all in one place, but you will be able to update eStore &… plugins easily and surely, directly uploading zip files (just change permissions recursively after, if your hosting has rules that don’t suit you).
What’s exciting, is that GetResponse integration can be changed accordingly so that it would send your contact language as a custom field (tag) to GR, so that even there, at GR, using their if-then-else, emails can be sent in a language, matching the contact.
Good luck & ease to us all.
-
AuthorPosts
- You must be logged in to reply to this topic.