News:

Looking for documentation? Take a look on our wiki

Main Menu

E-Mail confirmation title in any language always Mr or Mrs.

Started by lanthan, November 29, 2012, 13:02:52 PM

Previous topic - Next topic

lanthan

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


jjk

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

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

#4
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

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

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

can you guys use an empty title for the vendor details?

Milbo

Quote from: 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... 

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

lindapowers

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

So currently we do not have any solution for the "mr." and "mrs." problem?

lindapowers

#11
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

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.


<?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

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

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