Jump to content

1.7.6 Change edit email subject?


Dan1

Recommended Posts

How to edit email subject in ps 1.7.6? I know how to edit email body in themes/mytheme/mails/ or in BO translations, but email subject can't be edited in either.

In BO - translations - email - subject, there are no expressions to edit.

In BO - translations - email - body - core emails I can find the email whose subject I want to change but it also states: No Subject was found for password_query in the database.

In this case I want to change the subject of the password reset email.

Screenshot_2019-09-28 Translations • Spearfishing Store.png

Link to comment
Share on other sites

  • 2 weeks later...

I had similar issues: I translated all email subjects in BO but when I got an email, the subject was still in english.
For some reason Prestashop did not use the translations. I do not have any idea why or was able to figure it out.

But what I was able, is to hardcode the translation in the file "lang.php" which can be found here: \themes\YOUR_TEMPLATE\mails\YOUR_LANGUAGE\
In the example below you see 2 hardcoded translations.

<?php

global $_LANGMAIL;
$_LANGMAIL = array();
$_LANGMAIL['Your order has been changed'] = 'Ihre Bestellung wurde geändert';
$_LANGMAIL['Product out of stock'] = '';
$_LANGMAIL['Product available'] = '';
$_LANGMAIL['New order : #%d - %s'] = '';
$_LANGMAIL['Stock coverage'] = '';
$_LANGMAIL['New return from order #%d - %s'] = '';
$_LANGMAIL['New credit slip regarding your order'] = 'Gutschrift für Ihre Bestellung';

?>

I hope this helps to solve your issue.

Edited by Oli4CH (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 3 months later...
On 10/10/2019 at 2:41 PM, Oli4CH said:

I had similar issues: I translated all email subjects in BO but when I got an email, the subject was still in english.
For some reason Prestashop did not use the translations. I do not have any idea why or was able to figure it out.

But what I was able, is to hardcode the translation in the file "lang.php" which can be found here: \themes\YOUR_TEMPLATE\mails\YOUR_LANGUAGE\
In the example below you see 2 hardcoded translations.


<?php

global $_LANGMAIL;
$_LANGMAIL = array();
$_LANGMAIL['Your order has been changed'] = 'Ihre Bestellung wurde geändert';
$_LANGMAIL['Product out of stock'] = '';
$_LANGMAIL['Product available'] = '';
$_LANGMAIL['New order : #%d - %s'] = '';
$_LANGMAIL['Stock coverage'] = '';
$_LANGMAIL['New return from order #%d - %s'] = '';
$_LANGMAIL['New credit slip regarding your order'] = 'Gutschrift für Ihre Bestellung';

?>

I hope this helps to solve your issue.

Perfect! I've been strugling with the d*mn translations for so far!

Thank you

Link to comment
Share on other sites

  • 8 months later...
On 10/10/2019 at 9:41 AM, Oli4CH said:

I had similar issues: I translated all email subjects in BO but when I got an email, the subject was still in english.
For some reason Prestashop did not use the translations. I do not have any idea why or was able to figure it out.

But what I was able, is to hardcode the translation in the file "lang.php" which can be found here: \themes\YOUR_TEMPLATE\mails\YOUR_LANGUAGE\
In the example below you see 2 hardcoded translations.


<?php

global $_LANGMAIL;
$_LANGMAIL = array();
$_LANGMAIL['Your order has been changed'] = 'Ihre Bestellung wurde geändert';
$_LANGMAIL['Product out of stock'] = '';
$_LANGMAIL['Product available'] = '';
$_LANGMAIL['New order : #%d - %s'] = '';
$_LANGMAIL['Stock coverage'] = '';
$_LANGMAIL['New return from order #%d - %s'] = '';
$_LANGMAIL['New credit slip regarding your order'] = 'Gutschrift für Ihre Bestellung';

?>

I hope this helps to solve your issue.

Thanks but there is no lang,php file at that location.

 

This is an issue that has not been fixed https://github.com/PrestaShop/PrestaShop/issues/9599

Edited by Dan1 (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

Hi,

the text inside the parenthesis [XXX] is the shop name, you want to remove the shop names from all the email subjects, or only for one email?

If you want to remove for all mails then you can create an override for the Mail.php class, override function send( 

The subject line is being created in the send function, in this line:

 $subject = '[' . strip_tags($configuration['PS_SHOP_NAME']) . '] ' . $subject;

Kind regards, Leo

 

Link to comment
Share on other sites

1 hour ago, Leo @ Prestachamps said:

If you want to remove for all mails then you can create an override for the Mail.php class, override function send( 

The subject line is being created in the send function, in this line:


 $subject = '[' . strip_tags($configuration['PS_SHOP_NAME']) . '] ' . $subject;

 

Hi Leo,

 

yes, i want to remove the website name from all email subjects.

Where can i find the mail.php class? In which Folder?

I have no experience with override. Maybe it is easier to change the mail.php

regards

Michael

Link to comment
Share on other sites

31 minutes ago, Leo @ Prestachamps said:

it is in folder /classes/Mail.php

I have found it!

so if i understand right i need to change the line

$subject = '[' . strip_tags($configuration['PS_SHOP_NAME']) . '] ' . $subject;

to

$subject = $subject;

?

regards Michael

Link to comment
Share on other sites

  • 7 months later...
  • 7 months later...
On 10/10/2019 at 4:41 PM, Oli4CH said:

I had similar issues: I translated all email subjects in BO but when I got an email, the subject was still in english.
For some reason Prestashop did not use the translations. I do not have any idea why or was able to figure it out.

But what I was able, is to hardcode the translation in the file "lang.php" which can be found here: \themes\YOUR_TEMPLATE\mails\YOUR_LANGUAGE\
In the example below you see 2 hardcoded translations.

<?php

global $_LANGMAIL;
$_LANGMAIL = array();
$_LANGMAIL['Your order has been changed'] = 'Ihre Bestellung wurde geändert';
$_LANGMAIL['Product out of stock'] = '';
$_LANGMAIL['Product available'] = '';
$_LANGMAIL['New order : #%d - %s'] = '';
$_LANGMAIL['Stock coverage'] = '';
$_LANGMAIL['New return from order #%d - %s'] = '';
$_LANGMAIL['New credit slip regarding your order'] = 'Gutschrift für Ihre Bestellung';

?>

I hope this helps to solve your issue.

PS 1.7.8.5  (PHP 7.3.33)

Where is this lang.php-file that needs to be uploaded? It's not in file directory. Can you upload exact lang.php file here for downloading, please.

I've had fresh installalations since PS 1.7.0.0.-1.7.8.5 and no such file can be found in mentioned directory. It would be nice to try it if it works if the file was downloadable somewhere. Thanks :)

Any other solution for this could also be nice. I've read https://github.com/PrestaShop/PrestaShop/issues/9599

 

Link to comment
Share on other sites

  • 4 weeks later...

This worked for me in PS 1.7.6:

1. In files modules/ps_emailalerts/ps_emailalerts.php
and themes/yourtheme/modules/ps_emailalerts/ps_emailalerts.php
Replace: Emails.Subject
With: Modules.Emailalerts.Emailsubject

There are 5 occurrences, I changed all 5.

2. In ps_emailalerts/mails/en/ and themes/yourtheme/modules/ps_emailalerts/en/ add a lang.php file. I don't know if this step is necessary, I checked the lang.php files afterwards and there was nothing in them.

3. International - translations - installed modules translations - Mail alerts - Language English - Modify - Modules^Emailalerts^Emailsubject - Change: New order : #%d - %s to: YourText #%d - %s

Translation will not save if you leave out this part which is the order Reference number:  - %s

Clear Cache.

  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...

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