Jump to content
Sign in to follow this  
Dr. Mary Calaveris

Running CE-Phoenix-master 1.0.5.5 and wishing to show clients name in Email subject line

Recommended Posts

Posted (edited)

Running CE-Phoenix-master 1.0.5.5 and wishing to show clients name in Email subject line, and all I can seem to locate is the following line of code under admin/mail.php

 <label for="Subject" class="col-form-label col-sm-3 text-left text-sm-right"><?php echo TEXT_SUBJECT; ?></label>

I am hoping to have it read for example <label for="Subject" Thank you [client's name] for calling our clinic, it is presently closed due to our fellow Healthcare workers extreme fear of the coronavirus as they are at higher risk due to safety gear shortage.</label>

Does anyone know a way to accomplish this? Thanks.

Edited by Dr. Mary Calaveris
To many empty spaces

Share this post


Link to post
Share on other sites

The line that sends the email is

      $mimemessage->send($customer_data->get('name', $mail), $customer_data->get('email_address', $mail), $from_name, $from_address, $subject);

And changing it to

      $mimemessage->send($customer_data->get('name', $mail), $customer_data->get('email_address', $mail), $from_name, $from_address, sprintf($subject, $customer_data->get('name')));

If you set the subject to be

          <?php echo tep_draw_input_field('subject', 'Thank you %s for calling our clinic, it is presently closed due to our fellow Healthcare workers extreme fear of the coronavirus as they are at higher risk due to safety gear shortage.', 'id="Subject" required="required" aria-required="true"'); ?>

But the tool is not really designed to be used that way. 


Always back up before making changes.

Share this post


Link to post
Share on other sites

Thanks for your response, I was able to locate such file under /admin/mail.php

    //Let's build a message object using the email class
    $mimemessage = new email();
    $mimemessage->add_message($message);
    $mimemessage->build_message();
    while ($mail = tep_db_fetch_array($mail_query)) {
      $mimemessage->send($customer_data->get('name', $mail), $customer_data->get('email_address', $mail), $from_name, $from_address, $subject);

*** and made the change as shown below ***

    //Let's build a message object using the email class
    $mimemessage = new email();
    $mimemessage->add_message($message);
    $mimemessage->build_message();
    while ($mail = tep_db_fetch_array($mail_query)) {
      $mimemessage->send($customer_data->get('name', $mail), $customer_data->get('email_address', $mail), $from_name, $from_address, sprintf($subject, $customer_data->get('name')));

**** Received the following message ****

Fatal error: Uncaught ArgumentCountError: Too few arguments to function customer_data::get(), 1 passed in /admin/mail.php on line 45 and exactly 2 expected in /includes/system/versioned/1.0.5.1/customer_data.php:61 Stack trace: #0 /admin/mail.php(45): customer_data->get('name') #1 {main} thrown in /includes/system/versioned/1.0.5.1/customer_data.php on line 61

Fatal error Uncaught ArgumentCountError.png

Share this post


Link to post
Share on other sites

Sorry, it needs the $mail. 

      $mimemessage->send($customer_data->get('name', $mail), $customer_data->get('email_address', $mail), $from_name, $from_address, sprintf($subject, $customer_data->get('name', $mail))); 

 


Always back up before making changes.

Share this post


Link to post
Share on other sites

1)  /includes/languages/english/contact_us.php     Found this code on line 16.

define('EMAIL_SUBJECT', 'Enquiry from %s');

Changed to 

define('EMAIL_SUBJECT', 'Thank you %s for calling our clinic, it is presently closed due to our fellow Healthcare workers extreme fear of the coronavirus as they are at higher risk due to safety gear shortage.', 'id="Subject" required="required" aria-required="true"');


2)  /admin/mail.php     Found this code on line 45.

      $mimemessage->send($customer_data->get('name', $mail), $customer_data->get('email_address', $mail), $from_name, $from_address, $subject);

Changed to 

      $mimemessage->send($customer_data->get('name', $mail), $customer_data->get('email_address', $mail), $from_name, $from_address, sprintf($subject, $customer_data->get('name', $mail)));

*************************************************************************************************************************
Received the following email:

Subject: Thank you StoreName for calling our clinic, it is presently closed due to our fellow Healthcare workers extreme fear of the coronavirus as they are at higher risk due to safety gear shortage.
From: Sandra Dias <sdias@company.com>
Date: Sat Apr  4 15:21:53 2020
To: Store Owner <admin@StoreName.com>


Testing Result

*************************************************************************************************************************
It seems that the store name only is referenced by %s and not the clients name?

Share this post


Link to post
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
Sign in to follow this  

×