[SOLVED Workaround] No translation in the CONFIRM email

Started by tzic, April 20, 2012, 10:49:47 AM

Previous topic - Next topic

tzic

The confirmation e-mail comes to the customer in English (when you confirm the order in VM configuration panel and send email to customer). The pending order mail (the first one) comes in the correct language. Is there a way to fix this?

Milbo

I hope you can help use with it, look in  FE helpers/shopfunctionsf.php function sendVmMail  line 230 . There we load the language for the mails, maybe someone here of the forum can.

The other problem is that we do not store the language of the shopper in the order, so we the emails use always default language imho.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

K&K media production

If you change the order status in backend, vm use the administrator language files for the emails. So, language overrides must be configured for site and administrator.

I think the solution for your problem is, to change the global default backend language to your language.

Please let us now if this solved your problem.

tzic

Quote from: kkmediaproduction on April 20, 2012, 14:22:11 PM

I think the solution for your problem is, to change the global default backend language to your language.


That did it, thank you for the solution. But I believe it is still a bug and needs fixing

digiversum

I think indeed that this need a real solution, because in multilingual sites you don't want to change the backend language for every shopper to react upon.

Liewilyn

Need help here!!! I'm developing a multilingual site and this is a big issue for us... can anybody give a proper solution or workaround for this?

Milbo

Do you still have actually the problem? In which version then? As far as I know this is solved.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

cezard

Fix :
Add a Shopper Field named 'language', title Language, type text, max-length 7, field size 7. Enable this field for users in shipment form.

Add the field to your cart/shopper_address.php template file. If you're using standard template you will need to first make sure the field won't get printed out since this needs to be a hidden field. (add an if statement to the foreach that prints out the fields).
To add the field in the shopper_address.php template file add
<input type="hidden" name="language" value="<?php echo JFactory::getLanguage()->getTag(); ?>" /> to this file.

This will cause the language of the user to get saved in the orders database.

Now we need to make sure the correct language is loaded when sending the email:

Inside helpers/shopfunctions.php, edit the sendVmMail function and add

if ($view->orderDetails['details']['BT']->language) {
$jlang->load('com_virtuemart', JPATH_SITE, $view->orderDetails['details']['BT']->language, true);
}

after the line
$jlang->load('com_virtuemart', JPATH_SITE, null, true);

That's it !

4est

quite a complete workaround.
maybe this or something similar should be implemented in VM? Milbo, what do you think?

K&K media production

I have implemented a solution in core and it will be in vm 2.2

exhost


neleausta

As Cezard said:
QuoteTo add the field in the shopper_address.php template file add
Code: [Select]
<input type="hidden" name="language" value="<?php echo JFactory::getLanguage()->getTag(); ?>" />

I'm really sorry but I didn't understand where exactly paste this line.

My shopper_address.php code is:
defined('_JEXEC') or die('Restricted access');
?>
<table width="100%">
  <tr>
    <td width="50%" bgcolor="#ccc">
      <?php echo JText::_('COM_VIRTUEMART_USER_FORM_BILLTO_LBL'); ?>
   </td>
   <td width="50%" bgcolor="#ccc">
      <?php echo JText::_('COM_VIRTUEMART_USER_FORM_SHIPTO_LBL'); ?>
   </td>
  </tr>
  <tr>
    <td width="50%">

      <?php    foreach($this->BTaddress['fields'] as $item){
               if(!empty($item['value'])){
                  echo $item['title'].': '.$this->escape($item['value']).'<br/>';
               }
            } ?>

   </td>
    <td width="50%">
         <?php
         if(!empty($this->STaddress['fields'])){
            foreach($this->STaddress['fields'] as $item){
               if(!empty($item['value'])){
                  echo $item['title'].': '.$this->escape($item['value']).'<br/>';
               }
            }
         } else {
            foreach($this->BTaddress['fields'] as $item){
               if(!empty($item['value'])){
                  echo $item['title'].': '.$this->escape($item['value']).'<br/>';
               }
            }
         } ?>
   </td>
  </tr>
</table>

I don't see anything recalling the right place to paste the line.
Please help me!

Milbo

Nice done cezard,

I think we added it also to vm2.0.15, please check the latest version. If it is implemented.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

chiappa


K&K media production