Jump to content

New_order email form emailalerts uses only the english template


pl.sabotinov

Recommended Posts

Hello,

we are using presrashop 8.1.4 and module ps_emailalerts ver. 3.0.0. I have tried several times to make translation of the email template for new order (new_order), but it seems it doesn't matter which language is used in the browser and the new_order templates is received only in english. I have made translation through the BO->Localization->Translations->Email templates-Body->theme (classic)->My language , but nothing is changed. I have no other theme innstalled still - so it is only the classc theme. When edit text/html  template is shown everything works we make the save -> then i recheck the saved change - but the new order comes only with the english template. (The changes in the en version of the template are shown correct after that - but i receive only the en version of the template - doesnt matter which language is used in browser).'So i have check manually in file manager in cpanel if the directory and the files are there and everything is correct.

We have in modules->ps_emailalerts->mails->bg/en folders for both languages with the templates inside.

We have also in themes->classic->modules->ps_emailalerts->mails->bg/en folders with templates also (And i think actually the changes from translations are made in these folders, because thease are the last changed files). 

And last we have also folder mails->themes->classic->modules->ps_emailalerts->mails->bg/en folders which i created and pasted this template new_order there.

So i think the templates are not the problem I suppose the problem is in module ps_emailalerts where the main function in ps_emailalerts.php could not recognise the browser language or the default language also.

 $dir_mail = false;
            if (file_exists(dirname(__FILE__) . '/mails/' . $mail_iso . '/new_order.txt')
                && file_exists(dirname(__FILE__) . '/mails/' . $mail_iso . '/new_order.html')) {
                $dir_mail = dirname(__FILE__) . '/mails/';
            }

            if (file_exists(_PS_MAIL_DIR_ . $mail_iso . '/new_order.txt')
                && file_exists(_PS_MAIL_DIR_ . $mail_iso . '/new_order.html')) {
                $dir_mail = _PS_MAIL_DIR_;
            }

            if ($dir_mail) {
                Mail::send(
                    $mail_id_lang,
                    'new_order',
                    $this->trans(
                        'New order : #%d - %s',
                        [
                            $order->id,
                            $order->reference,
                        ],
                        'Emails.Subject',
                        $locale),
                    $template_vars,
                    $merchant_mail,
                    null,
                    $configuration['PS_SHOP_EMAIL'],
                    $configuration['PS_SHOP_NAME'],
                    null,
                    null,
                    $dir_mail,
                    false,
                    $id_shop
                );

I think somewhere here this var $mail_iso is not giving correct value. Or maybe some other function - but inside this php file is the problem. Does anyone had the same problem and how did you find the solution to receive the mails from this module using the correct template.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...