Jump to content

Remove shop name from email subjects


Recommended Posts

Hi There,

I have a question about e-mailsubject to.
My shop sent the mail correctly but there is a prefix in the subject.

The subject contains "{shop_name} Welcome!" for example.

How can i remove the {shop_name} from the subject so there is only "Welcome!" in there?

Thanks a lot!

Grtz
Edwin

Link to comment
Share on other sites

Topic split - please create a separate topic instead of posting on an existing solved topic

Change line 93 of classes/Mail.php (in Prestashop v1.2.5) from:

$message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME').'] '.((is_array($_LANGMAIL) AND key_exists($subject, $_LANGMAIL)) ? $_LANGMAIL[$subject] : $subject));



to:

$message = new Swift_Message(/*'['.Configuration::get('PS_SHOP_NAME').'] '.*/((is_array($_LANGMAIL) AND key_exists($subject, $_LANGMAIL)) ? $_LANGMAIL[$subject] : $subject));

  • Like 1
Link to comment
Share on other sites

  • 10 months later...

That's right. The code I wrote above is supposed to remove the shop name only from the email subjects. The following part of the code checks whether there is a translation in mails//lang.php for 'Welcome!'. If there is, then it uses it, otherwise it just uses 'Welcome!'.

((is_array($_LANGMAIL) AND key_exists($subject, $_LANGMAIL)) ? $_LANGMAIL[$subject] : $subject)



You should have a line like the following in mails//lang.php:

$_LANGMAIL['Welcome!'] = 'Bienvenido !';



This is the Spanish translation for 'Welcome!'. Change 'Bienvenido !' to your translation.

Link to comment
Share on other sites

  • 3 years later...

How can I change mail subject in ps 1.6?

 

Best regards

 

Access from the admin end

It is located in: Localization --> Translations 

Then look for the Email Templates, and find the order confirmation email template. You will need to change both the HTML version and TXT file version. 

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

 

It is located here: Localization --> Translations 

Then look for the Email Templates, and find the order confirmation email template. You will need to change both the HTML version and TXT file version. 

 

 

I don't find there...

 

What I must change in classes --> Mail.php?

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...
 

What to comment out in prestashop 1.6?

 

 

It worked for me to replace this:
 

$message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME', null, null, $id_shop).'] '.$subject);
 
with:

$message = new Swift_Message(/*'['.Configuration::get('PS_SHOP_NAME', null, null, $id_shop).'] '.*/$subject);
Edited by midana (see edit history)
Link to comment
Share on other sites

  • 6 months later...

Hello,

 

Thank you for your explanation regarding how to modify the shop name in the subject.

 

I am trying to do it using an override but I am not sure how to proceed, could you help me on that?

 

For now, I created a Mail.php file in Override/Classes/ with the following but it doest not seem to work :

<?php
class Mail extends MailCore{
    
    public static function Send()
    {
        $id_shop = Context::getContext()->shop->id;
        
        $subject = Configuration::get('PS_SHOP_NAME', null, null, $id_shop).' :'.$subject;
    }
    
}

Thank you in advance for your answer and have a good day,

 

Julien

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

  • 1 year later...

Search for $subject in classes/Mail.php.

    $subject = '['.Configuration::get('PS_SHOP_NAME', null, null, $id_shop).'] '.$subject;

Just delete the line and you are done. The welcome mail would then only say:

 

Welcome

 

Or replace it whith:

   $subject = '['.Configuration::get('PS_SHOP_DOMAIN', null, null, $id_shop).'] '.$subject;

which results in

 

[example.com] Welcome

 

Pls report back.

Edited by Scully (see edit history)
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...