Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2013
    Location
    New Delhi
    Posts
    6
    Plugin Contributions
    0

    help question Making Changes in Email_extras.php

    I want an extra filed, i.e Company Name to be received in Email while a customer creates a New Account... I tried adding the following code:

    Code:
    define('OFFICE_COMPANY_NAME','<strong>Company Name:</strong>');
    at line 20 in \includes\languages\english\email_extras.php

    ... but it doesn't make the difference to the output email. Any suggestions, where else to make changes, so that it works ?

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,874
    Plugin Contributions
    96

    Default Re: Making Changes in Email_extras.php

    You don't say where within the email you want the company name value to appear, but the module /includes/modules/create_account.php handles that email formatting and output.

    You'll want to make your edits in your template-override folder, so if your template name is mytemplate you need to:
    1. Copy /includes/modules/create_account.php to /includes/modules/mytemplate/create_account.php (creating this folder if it doesn't already exist)
    2. Make your edits to /includes/modules/mytemplate/create_account.php

  3. #3
    Join Date
    Sep 2013
    Location
    New Delhi
    Posts
    6
    Plugin Contributions
    0

    Default Re: Making Changes in Email_extras.php

    Hi, thanks for the response...
    I wanted to make edit in the email received, which at the end reads "Office Use Only", by inserting in Company Name (which user enters), after Login Email, whose code is provided in the file: Email_extras.php ?

    Office Use Only:
    From: ####################____
    Email: ******######################
    Login Name: ##############################__
    Login Email: *****######################
    Company Name: ####################___
    Telephone:
    Fax:
    IP Address:
    Host Address:
    Date and Time:

    I am not sure how it can be edited in create_account.php.

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,874
    Plugin Contributions
    96

    Default Re: Making Changes in Email_extras.php

    You'll actually need to edit two files:
    1. /includes/modules/mytemplate/create_account.php. Here's a code fragment that starts at line 415 in v1.5.1:
    Code:
        // send additional emails
        if (SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_STATUS == '1' and SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO !='') {
          if ($_SESSION['customer_id']) {
            $account_query = "select customers_firstname, customers_lastname, customers_email_address, customers_telephone, customers_fax
                                from " . TABLE_CUSTOMERS . "
                                where customers_id = '" . (int)$_SESSION['customer_id'] . "'";
    
            $account = $db->Execute($account_query);
          }
    
          $extra_info=email_collect_extra_info($name,$email_address, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address'], $account->fields['customers_telephone'], $account->fields['customers_fax']);
          $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
          if (trim(SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT) != 'n/a') zen_mail('', SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO, SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT . ' ' . EMAIL_SUBJECT,
          $email_text . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'welcome_extra');
        } //endif send extra emails
    You'll change this to:
    Code:
        // send additional emails
        if (SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_STATUS == '1' and SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO !='') {
          if ($_SESSION['customer_id']) {
            $account_query = "select customers_firstname, customers_lastname, customers_email_address, customers_telephone, customers_fax
                                from " . TABLE_CUSTOMERS . "
                                where customers_id = '" . (int)$_SESSION['customer_id'] . "'";
    
            $account = $db->Execute($account_query);
          }
    
          $extra_info=email_collect_extra_info($name,$email_address, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address'], $account->fields['customers_telephone'], $account->fields['customers_fax'], $company);
          $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
          if (trim(SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT) != 'n/a') zen_mail('', SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO, SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT . ' ' . EMAIL_SUBJECT,
          $email_text . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'welcome_extra');
        } //endif send extra emails
    2. /includes/functions/functions_email.php. Note that this is a core-file edit and the file will be changed again in v1.6.0! Make a backup copy (functions_email.php.v151) before you start! Change the function email_collect_extra_info to include the company input:
    Code:
      function email_collect_extra_info($from, $email_from, $login, $login_email, $login_phone='', $login_fax='', $company='') {
        // get host_address from either session or one time for both email types to save server load
        if (!$_SESSION['customers_host_address']) {
          if (SESSION_IP_TO_HOST_ADDRESS == 'true') {
            $email_host_address = @gethostbyaddr($_SERVER['REMOTE_ADDR']);
          } else {
            $email_host_address = OFFICE_IP_TO_HOST_ADDRESS;
          }
        } else {
          $email_host_address = $_SESSION['customers_host_address'];
        }
    
        // generate footer details for "also-send-to" emails
        $extra_info=array();
        $extra_info['TEXT'] =
          OFFICE_USE . "\t" . "\n" .
          OFFICE_FROM . "\t" . $from . "\n" .
          OFFICE_EMAIL. "\t" . $email_from . "\n" .
          (trim($login) !='' ? OFFICE_LOGIN_NAME . "\t" . $login . "\n"  : '') .
          (trim($login_email) !='' ? OFFICE_LOGIN_EMAIL . "\t" . $login_email . "\n"  : '') .
          ($login_phone !='' ? OFFICE_LOGIN_PHONE . "\t" . $login_phone . "\n" : '') .
          ($login_fax !='' ? OFFICE_LOGIN_FAX . "\t" . $login_fax . "\n" : '') .
          ($company != '' ? 'Company Name:' . "\t" . $company . "\n": '') .
          OFFICE_IP_ADDRESS . "\t" . $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR'] . "\n" .
          OFFICE_HOST_ADDRESS . "\t" . $email_host_address . "\n" .
          OFFICE_DATE_TIME . "\t" . date("D M j Y G:i:s T") . "\n\n";
    
        $extra_info['HTML'] = '<table class="extra-info">' .
          '<tr><td class="extra-info-bold" colspan="2">' . OFFICE_USE . '</td></tr>' .
          '<tr><td class="extra-info-bold">' . OFFICE_FROM . '</td><td>' . $from . '</td></tr>' .
          '<tr><td class="extra-info-bold">' . OFFICE_EMAIL. '</td><td>' . $email_from . '</td></tr>' .
          ($login !='' ? '<tr><td class="extra-info-bold">' . OFFICE_LOGIN_NAME . '</td><td>' . $login . '</td></tr>' : '') .
          ($login_email !='' ? '<tr><td class="extra-info-bold">' . OFFICE_LOGIN_EMAIL . '</td><td>' . $login_email . '</td></tr>' : '') .
          ($login_phone !='' ? '<tr><td class="extra-info-bold">' . OFFICE_LOGIN_PHONE . '</td><td>' . $login_phone . '</td></tr>' : '') .
          ($login_fax !='' ? '<tr><td class="extra-info-bold">' . OFFICE_LOGIN_FAX . '</td><td>' . $login_fax . '</td></tr>' : '') .
          ($company != '' ? '<tr><td class="extra-info-bold">' . 'Company Name:' . '</td><td>' . $company . '</td></tr>' : '') .
          '<tr><td class="extra-info-bold">' . OFFICE_IP_ADDRESS . '</td><td>' . $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR'] . '</td></tr>' .
          '<tr><td class="extra-info-bold">' . OFFICE_HOST_ADDRESS . '</td><td>' . $email_host_address . '</td></tr>' .
          '<tr><td class="extra-info-bold">' . OFFICE_DATE_TIME . '</td><td>' . date('D M j Y G:i:s T') . '</td></tr>' . '</table>';
        return $extra_info;
      }

  5. #5
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Making Changes in Email_extras.php

    Ya, the changes to functions_email for v160 are here: https://github.com/zencart/zencart/c...867cdc615f64cf ... and would make your changes slightly simpler.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Sep 2013
    Location
    New Delhi
    Posts
    6
    Plugin Contributions
    0

    Default Re: Making Changes in Email_extras.php

    Thanks for the replies... highly appreciated !

  7. #7
    Join Date
    Sep 2013
    Location
    New Delhi
    Posts
    6
    Plugin Contributions
    0

    Default Re: Making Changes in Email_extras.php

    It worked perfectly well.
    Thanks a lot again !

 

 

Similar Threads

  1. v139h Making Text Changes to Shopping_Cart.php
    By traytray in forum Basic Configuration
    Replies: 8
    Last Post: 22 Apr 2014, 11:21 PM
  2. Trouble with email_extras.php
    By kehrli in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 6 Sep 2007, 05:51 AM

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