Page 1 of 3 123 LastLast
Results 1 to 10 of 25
  1. #1
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Customise email title from Contact Us Messages

    At the moment, when customers send us a message from the contact us page, the title of the messages come through as, "Message from SILK BLOOMS"

    I'm wondering how easy it would be to change the header of the emails to the customers wedding date (which they would need to enter on the form before sending).

    I realise this would require custom coding. I'm looking for some help with this though. Anyone?

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Customise email Header from Contact Us Messages

    Did you try a search in the Tools ... Developers Tool Kit ... in the bottom input box for:
    message from

    and select Catalog ... then click SEARCH ... to see what files might have that define ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Customise email Header from Contact Us Messages

    Hi Ajeh,

    I did as it happens.

    includes/languages/english/CUSTOM/contact_us.php:
    PHP Code:
    Line #12 : define('EMAIL_SUBJECT', 'Message from ' . STORE_NAME); 
    I am able to add the wedding date as an <input id> so that it'd appear as a field in the contact us form, but how would I then get the contents of that field to appear in the title of the messages being sent? I'm assuming I'd need to change 'EMAIL_SUBJECT' to something that 'calls' the field with the wedding date?

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Customise email Header from Contact Us Messages

    You might look at the:
    /includes/modules/pages/contact_us/header_php.php

    The email is sent with:
    Code:
        zen_mail($send_to_name, $send_to_email, EMAIL_SUBJECT, $text_message, $name, $email_address, $html_msg,'contact_us');
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Customise email Header from Contact Us Messages

    I'm actually struggling with a mod I'm making using the "Add Phone Number to Contact Us Page".

    I have the field appearing on the contact us page, it now says, "Wedding Date", but when the form sends it's not sending it with the email. It has to do with this file:

    PHP Code:
    <?php
    /**
     * Contact Us Page
     *
     * @package page
     * @copyright Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: header_php.php 3230 2006-03-20 23:21:29Z drbyte $
     */
    require(DIR_WS_MODULES zen_get_module_directory('require_languages.php'));

    $error false;
    if (isset(
    $_GET['action']) && ($_GET['action'] == 'send')) {
      
    $phone zen_db_prepare_input($_POST['phonenumber']);
      
    $name zen_db_prepare_input($_POST['contactname']);
      
    $name zen_db_prepare_input($_POST['weddingdate']);
      
    $email_address zen_db_prepare_input($_POST['email']);
      
    $enquiry zen_db_prepare_input(strip_tags($_POST['enquiry']));

      
    $zc_validate_email zen_validate_email($email_address);

      if (
    $zc_validate_email and !empty($enquiry) and !empty($name)) {
        
    // auto complete when logged in
        
    if($_SESSION['customer_id']) {
          
    $sql "SELECT customers_id, customers_firstname, customers_lastname, customers_password, customers_email_address, customers_default_address_id, customers_telephone 
                  FROM " 
    TABLE_CUSTOMERS 
                  WHERE customers_id = :customersID"
    ;
          
          
    $sql $db->bindVars($sql':customersID'$_SESSION['customer_id'], 'integer');
          
    $check_customer $db->Execute($sql);
          
    $customer_email$check_customer->fields['customers_email_address'];
          
    $customer_phone$check_customer->fields['customers_telephone'];
          
    $customer_name$check_customer->fields['customers_firstname'] . ' ' $check_customer->fields['customers_lastname'];
        } else {
          
    $customer_phone='Not logged in';
          
    $customer_email='Not logged in';
          
    $customer_name='Not logged in';
        }

        
    // use contact us dropdown if defined
        
    if (CONTACT_US_LIST !=''){
          
    $send_to_array=explode("," ,CONTACT_US_LIST);
          
    preg_match('/\<[^>]+\>/'$send_to_array[$_POST['send_to']], $send_email_array);
          
    $send_to_emaileregi_replace (">"""$send_email_array[0]);
          
    $send_to_emaileregi_replace ("<"""$send_to_email);
          
    $send_to_name preg_replace('/\<[^*]*/'''$send_to_array[$_POST['send_to']]);
        } else {  
    //otherwise default to EMAIL_FROM and store name
        
    $send_to_email EMAIL_FROM;
        
    $send_to_name =  STORE_NAME;
        }

        
    // Prepare extra-info details
       
    $extra_info email_collect_extra_info($name$email_address$customer_name$customer_email$customer_phone);
    // Prepare Text-only portion of message
    $text_message OFFICE_FROM "\t" $name "\n" .
    OFFICE_PHONE "\t" $phone "\n" .
    OFFICE_WEDDING_DATE "\t" $weddingdate "\n" .
    OFFICE_EMAIL "\t" $email_address "\n\n" .
        
    '------------------------------------------------------' "\n\n" .
        
    strip_tags($_POST['enquiry']) .  "\n\n" .
        
    '------------------------------------------------------' "\n\n" .
        
    $extra_info['TEXT'];
        
    // Prepare HTML-portion of message
        
    $html_msg['EMAIL_MESSAGE_HTML'] = strip_tags($_POST['enquiry']);
        
    $html_msg['CONTACT_US_OFFICE_FROM'] = OFFICE_FROM ' ' $name '<br />' OFFICE_PHONE ' ' '<br />' OFFICE_WEDDING_DATE ' ' $weddingdate '<br />' OFFICE_EMAIL '(' $email_address ')';
        
    $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
        
    // Send message
        
    zen_mail($send_to_name$send_to_emailEMAIL_SUBJECT$text_message$name$email_address$weddingdate$html_msg,'contact_us');

        
    zen_redirect(zen_href_link(FILENAME_CONTACT_US'action=success'));
      } else {
        
    $error true;
        if (empty(
    $name)) {
          
    $messageStack->add('contact'ENTRY_EMAIL_NAME_CHECK_ERROR);
        }
        if (
    $zc_validate_email == false) {
          
    $messageStack->add('contact'ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
        }
        if (empty(
    $phone)) {
    $messageStack->add('contact'ENTRY_EMAIL_PHONE_CHECK_ERROR);
    }
        if (empty(
    $enquiry)) {
          
    $messageStack->add('contact'ENTRY_EMAIL_CONTENT_CHECK_ERROR);
        }
      }
    // end action==send

    // default email and name if customer is logged in
    if($_SESSION['customer_id']) {
      
    $sql "SELECT customers_id, customers_firstname, customers_lastname, customers_password, customers_email_address, customers_default_address_id,customers_telephone 
              FROM " 
    TABLE_CUSTOMERS 
              WHERE customers_id = :customersID"
    ;
      
      
    $sql $db->bindVars($sql':customersID'$_SESSION['customer_id'], 'integer');
      
    $check_customer $db->Execute($sql);
      
    $phone$check_customer->fields['customers_telephone'];
      
    $email$check_customer->fields['customers_email_address'];
      
    $name$check_customer->fields['customers_firstname'] . ' ' $check_customer->fields['customers_lastname'];
    }

    if (
    CONTACT_US_LIST !=''){
      foreach(
    explode(","CONTACT_US_LIST) as $k => $v) {
        
    $send_to_array[] = array('id' => $k'text' => preg_replace('/\<[^*]*/'''$v));
      }
    }

    // include template specific file name defines
    $define_page zen_get_file_directory(DIR_WS_LANGUAGES $_SESSION['language'] . '/html_includes/'FILENAME_DEFINE_CONTACT_US'false');

    $breadcrumb->add(NAVBAR_TITLE);
    ?>

    It's been defined properly but I'm struggling with the lines in this file that will actually attach it to the message. As you can see on lines 58, 23 and 17 I have tried to get it working by adding in the lines but I seem to be doing this part wrong. Can you see what I'm missing?
    Last edited by limelites; 29 Dec 2011 at 07:26 PM.

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Customise email Header from Contact Us Messages

    You may wish to change this line:
    Code:
      $name = zen_db_prepare_input($_POST['weddingdate']);
    to read:
    Code:
      $weddingdate = zen_db_prepare_input($_POST['weddingdate']);
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #7
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Customise email Header from Contact Us Messages

    I've edited my last reply, so the PHP has changed slightly. It's now sending the form but the fields are getting all jumbled up. Here is what it's sending:

    From: 22/11/11
    Phone: 0141*****45
    Wedding Date:
    Email: removed######################

    ------------------------------------------------------


    Here is what it should be sending:

    From: My name should be here
    Phone: 0141*****45
    Wedding Date: 22/11/11
    Email: removed######################

    ------------------------------------------------------

    Can you see from the PHP above what I have done wrong?

    If I can get this working then I'll be able to figure out how to append the wedding date to the title of the emails too. very useful for us just knowing the cutomers wedding date at a glance.

  8. #8
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Customise email Header from Contact Us Messages

    OK, that works, thank you!

    Now I need to figure out how to append the wedding date to the title of the email :)

  9. #9
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Customise email Header from Contact Us Messages

    Something like:
    Code:
        zen_mail($send_to_name, $send_to_email, EMAIL_SUBJECT, $text_message, $name, $email_address, $html_msg,'contact_us');
    to read:
    Code:
        zen_mail($send_to_name, $send_to_email, EMAIL_SUBJECT . ' - ' . $weddingdate, $text_message, $name, $email_address, $html_msg,'contact_us');
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  10. #10
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Customise email Header from Contact Us Messages

    Now that's what I call genius! I don't think I'd have figured that one out, ever! Thank you Ajeh, again!!

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 3
    Last Post: 23 Oct 2015, 06:51 PM
  2. v139h New Contact Form Email - Messages not being sent?
    By jazzyman in forum General Questions
    Replies: 9
    Last Post: 6 Feb 2013, 05:28 PM
  3. Replies: 3
    Last Post: 15 Aug 2009, 03:38 AM
  4. Replies: 1
    Last Post: 10 Feb 2009, 12:34 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR