Author Topic: E-Mail confirmation title in any language always Mr or Mrs.  (Read 15410 times)

lanthan

  • Jr. Member
  • **
  • Posts: 99
  • VM 2.6.10, J2.5.27, PHP5.5
E-Mail confirmation title in any language always Mr or Mrs.
« 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

jaccod

  • Beginner
  • *
  • Posts: 5
Re: E-Mail confirmation title in any language always Mr or Mrs.
« Reply #1 on: January 05, 2013, 16:08:20 pm »
Do you resolve it? I have same problem.

jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3717
  • using Matomo instead of Google Analytics
Re: E-Mail confirmation title in any language always Mr or Mrs.
« Reply #2 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.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

reinhold

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 204
Re: E-Mail confirmation title in any language always Mr or Mrs.
« Reply #3 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

lindapowers

  • Full Member
  • ***
  • Posts: 1335
  • If you're going through hell, keep going.
    • Los Angeles immigration lawyers
  • Skype Name: manu.gonzalez91
  • VirtueMart Version: Latest avi
Re: E-Mail confirmation title in any language always Mr or Mrs.
« Reply #4 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",



both appeared at the frontend together with Mr and Mrs:



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:



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?






jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3717
  • using Matomo instead of Google Analytics
Re: E-Mail confirmation title in any language always Mr or Mrs.
« Reply #5 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]
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

reinhold

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 204
Re: E-Mail confirmation title in any language always Mr or Mrs.
« Reply #6 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...

lindapowers

  • Full Member
  • ***
  • Posts: 1335
  • If you're going through hell, keep going.
    • Los Angeles immigration lawyers
  • Skype Name: manu.gonzalez91
  • VirtueMart Version: Latest avi
Re: E-Mail confirmation title in any language always Mr or Mrs.
« Reply #7 on: January 06, 2013, 19:47:22 pm »
can you guys use an empty title for the vendor details?

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10094
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: E-Mail confirmation title in any language always Mr or Mrs.
« Reply #8 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.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

lindapowers

  • Full Member
  • ***
  • Posts: 1335
  • If you're going through hell, keep going.
    • Los Angeles immigration lawyers
  • Skype Name: manu.gonzalez91
  • VirtueMart Version: Latest avi
Re: E-Mail confirmation title in any language always Mr or Mrs.
« Reply #9 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

lanthan

  • Jr. Member
  • **
  • Posts: 99
  • VM 2.6.10, J2.5.27, PHP5.5
Re: E-Mail confirmation title in any language always Mr or Mrs.
« Reply #10 on: January 10, 2013, 00:12:56 am »
So currently we do not have any solution for the "mr." and "mrs." problem?

lindapowers

  • Full Member
  • ***
  • Posts: 1335
  • If you're going through hell, keep going.
    • Los Angeles immigration lawyers
  • Skype Name: manu.gonzalez91
  • VirtueMart Version: Latest avi
Re: E-Mail confirmation title in any language always Mr or Mrs.
« Reply #11 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.

lanthan

  • Jr. Member
  • **
  • Posts: 99
  • VM 2.6.10, J2.5.27, PHP5.5
Re: E-Mail confirmation title in any language always Mr or Mrs.
« Reply #12 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.

jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3717
  • using Matomo instead of Google Analytics
Re: E-Mail confirmation title in any language always Mr or Mrs.
« Reply #13 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.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

lanthan

  • Jr. Member
  • **
  • Posts: 99
  • VM 2.6.10, J2.5.27, PHP5.5
Re: E-Mail confirmation title in any language always Mr or Mrs.
« Reply #14 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