VirtueMart Forum

VirtueMart 2 + 3 => Language/Translations => Topic started by: lanthan on November 29, 2012, 13:02:52 pm

Title: E-Mail confirmation title in any language always Mr or Mrs.
Post by: lanthan on November 29, 2012, 13:02:52 pm
Hi guys,

I´m using VM 2.0.12f and Joomla 2.5.8. Language German for both.

All confirmation and status e-mails use the title "Mr" or "Mrs".

Of course I changed the de-DE.com_virtuemart.ini to

COM_VIRTUEMART_SHOPPER_TITLE_MR="Herr"
COM_VIRTUEMART_SHOPPER_TITLE_MRS="Frau"

and configured the user fields to Herr and Frau in the shop. It works fine within the shop for e.g. delivery address but for all confirmation e-mails I get always "Mr" and "Mrs" and do not have any idea why.

In the mail_html_header.php line 34 I found $this->orderDetails['details']['BT']->title but have no idea how to get the right titles. The shopper address is right.

By the way I also did a test and changed en-GB.com_virtuemart.ini to german, thought probably there is a bug with the language but this didn´t help either.

Any ideas to solve this problem?
Thanks

Lanthan
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: jaccod on January 05, 2013, 16:08:20 pm
Do you resolve it? I have same problem.
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: jjk on January 05, 2013, 22:43:28 pm
If my time permits, I'll write a short tutorial describing how it works in VM 2.0.16 (in 2.0.12 the title was handled differently, if I remember correctly) some time next week. In the meantime you could simply disable the display of the title in Configuration - Shopper fields. Customers don't complain if they don't have to select a title :-)
...However, I first have to check what you would have to change in the email files.
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: reinhold on January 05, 2013, 22:48:11 pm
Apparently, the problem is that the Mr./Mrs. title field displayed in the greeting in the mail is a field of the orderDetails data array, while the correctly translated Herr/Frau are the directly accesses userfields ("Kundenfelder" -> "title") value.

The orderDetails list is also created from the userfields, but the database request in VirtueMartModelOrders::getOrder reads all values directly from the database and does only a LEFT JOIN with the userinfo table, but does NOT try to translate the title field like the VirtueMartModelUserfields does... 

AFAICS, this is my interpretation of the missing translation (which I'm able to reproduce, btw) of the title in the mail. I know it sounds technical and confusing, so don't worry if you don't really understand it, this explanation is mainly targeted at the VM developers
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: lindapowers on January 06, 2013, 05:06:18 am
There is an additional issue with the titles:

The problem is that at the vendor additional information you can't choose an empty title.

I created a new empty value and a test one "prueba",

(http://s13.postimage.org/qkbc5txiv/Sin_t_tulo_4.jpg)

both appeared at the frontend together with Mr and Mrs:

(http://s8.postimage.org/ahl3fwvp1/Sin_t_tulo_6.jpg)

but the vendor tab doesn't like the empty value and you can't choose it at the additional information for the vendor under shop:

(http://s7.postimage.org/5lc1opbvf/Sin_t_tulo_2.jpg)

Our vendor is a company and we obviously can't put "Mr Company Name" which appears in all the confirmation emails.

And for the main issue commented here I was doing the transifex translation for spanish before and noticed titles were already translated in the actual version but they show in english, same issue as with german and probably the rest of languages.

So how we translate them?





Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: jjk on January 06, 2013, 08:46:08 am
I don't have a version earlier than 2.0.16 anymore to test this. However, part of the solution in VM 2.0.16 should be to enter translatable language keys in the fields like in the screenshot below and add those keys/strings into your language file overrides. This works in the forms  but I didn't test yet where the language keys have to be added into the files which generate the emails. I have to leave now, so you will have to wait another day or two for more details. Perhaps you find it out yourself in the meantime.

[attachment cleanup by admin]
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: reinhold on January 06, 2013, 14:47:05 pm
jjk, this is only part of the solution (I already did those changes before my tests). Those translatable strings fix the translations for the userfield values (which are used for the shipping / billing addresses). They are translated correctly.

However, the greeting in the confirmation mails do not use the userfields, but rather the orderDetails, which I think simply extracts the title stored in the dabatase (Mr.) and never tries to translate it...
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: lindapowers on January 06, 2013, 19:47:22 pm
can you guys use an empty title for the vendor details?
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: Milbo on January 07, 2013, 12:38:21 pm
Apparently, the problem is that the Mr./Mrs. title field displayed in the greeting in the mail is a field of the orderDetails data array, while the correctly translated Herr/Frau are the directly accesses userfields ("Kundenfelder" -> "title") value.

The orderDetails list is also created from the userfields, but the database request in VirtueMartModelOrders::getOrder reads all values directly from the database and does only a LEFT JOIN with the userinfo table, but does NOT try to translate the title field like the VirtueMartModelUserfields does... 

Hmmm, very complex problem. First I thought, okey lets store them translated. But this could lead to the situation that the shopowner does not understand it himself. Hmmm.

LindaPowers, add a field, leave the value empty, write into the "title" something like "Select". Then you have it.
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: lindapowers on January 07, 2013, 13:36:19 pm
I tried what you said:

Title= Select
value empty
result= shows text "select" both frontend and backend

I tried the other way round:
Title left empty
Value= Select

Frontend works fine= shows an emtpy title option
Vendor additional details= doesn't show the empty value option
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: lanthan on January 10, 2013, 00:12:56 am
So currently we do not have any solution for the "mr." and "mrs." problem?
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: lindapowers on January 10, 2013, 03:39:07 am
Still can't solve the translation of the fields and there is no way I can make an emtpy title at the vendor additional information tab, I've had to use a field "-" to avoid the Mr and Mrs in the vendor tab. Not a very nice solution cause now "-" is a field that can be chosen by the users at the registers and in their account.

Theres no way to select and empty title for the vendor it seems or I just can't find it.

I guess maybe the solution for now is to disable the title field.
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: lanthan on January 11, 2013, 00:17:13 am
Hi Lindapowers,

well, I think I have an idea for a temporary solution. What about the userfields, catching the title, store it in a variable and just echo title, firstname and lastname.

Code: [Select]
<?php
  foreach (
$this->userfields['fields'] as $field) {
 if ($field['name'] == 'title') { 
 $title $field['value'];   
}
}?>


<strong>
<?php echo JText::sprintf ('COM_VIRTUEMART_MAIL_SHOPPER_NAME'$title." "$this->orderDetails['details']['BT']->first_name ' ' $this->orderDetails['details']['BT']->last_name); ?></strong><br/>

Insert this code and it works. You catch the title from the userfield which is generated correctly.
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: jjk on January 11, 2013, 09:18:06 am
Just for your info - one of the devs mentioned that the reason why it doesn't translate is a missing JTEXT for the values for the emails.
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: lanthan on January 12, 2013, 02:16:55 am
Hi JJK,
this didn´t help me because I don´t know where exactly the orderdetails array is generated. The small code above solves the problem temporary.
Greetings
Lanthan
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: lindapowers on January 15, 2013, 02:44:09 am
Hi lanthan thanks but what is the file I have to modify for that code?

Right now I have a "-" added ;D

2.018a and the problem still persists^^

Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: lanthan on January 15, 2013, 18:10:15 pm
mail_html_header.php  ;) in your invoice overwrite folder
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: ocean1 on November 27, 2013, 11:18:52 am
So now we are in version 2.0.24c and its still there
Any solution on this?
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: jjk on November 29, 2013, 20:49:57 pm
If I remember correctly that was fixed some versions ago but showed up again recently. A developer is working on this issue.
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: ocean1 on December 09, 2013, 14:14:39 pm
Any progress?
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: jjk on December 10, 2013, 20:44:33 pm
Any progress?
Not really. It does work on the developer's machine, but we still didn't figure out why it doesn't work on mine. Maybe the same reason why it doesn't work for you. As I mentioned before, I simply unpublish the title on my live website in order to avoid the problem.
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: jjk on December 12, 2013, 21:05:24 pm
Finally fixed VM 2.0.25f. Note, that the override keys must be created in both BE and FE. Just tested it successfully with:
COM_VIRTUEMART_SHOPPER_TITLE_MR="Mr."
COM_VIRTUEMART_SHOPPER_TITLE_MRS="Mrs."
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: Milbo on March 14, 2014, 21:32:14 pm
Please try the new vm2.5.3 http://dev.virtuemart.net/attachments/download/691/com_virtuemart.2.5.3_extract_first.zip
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: changlee on March 20, 2015, 10:54:55 am
mail_html_header.php  ;) in your invoice overwrite folder

How exactly I make the override? I modify the mail_html_header.php and later upload it to TEMPLATE folder?
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: jjk on March 20, 2015, 11:08:24 am
I think this old tutorial is still valid: http://docs.virtuemart.net/tutorials/multilingual-store/105-using-language-keys-in-form-fields.html
Title: Re: E-Mail confirmation title in any language always Mr or Mrs.
Post by: changlee on April 03, 2015, 18:07:29 pm
I am asking for the template overrides  :)

Not for language overrides.

What is the best way to override VM template files?