The following documents (rightly or wrongly) how I added the Phone Number field to the Contact Us form.
I got the basic steps from a thread in the support archives, however they didn't work for 1.3.5 and required some additional customization.
The following will:
a) Add the Phone Number field to the contact us page
b) Fill in the phone number field if the user is logged in and has a phone number in their account
c) print the phone number in the email
These are the files I edited
./includes/languages/english/MYTEMPLATE/contact_us.php
./includes/languages/english/MYTEMPLATE/email_extras.php
./includes/modules/pages/contact_us/header_php.php
./includes/templates/MYTEMPLATE/templates/tpl_contact_us_default.php
./admin/includes/languages/english/email_extras.php
File 1: Insert the following lines
./includes/languages/english/MYTEMPLATE/contact_us.php
File 2: Insert the following linedefine('ENTRY_PHONE', 'Phone Number:');
define('ENTRY_EMAIL_PHONE_CHECK_ERROR','You must enter your phone number. Please try again.');
./includes/languages/english/MYTEMPLATE/email_extras.php
File 3:define('OFFICE_PHONE','<strong>Phone:</strong>');
./includes/modules/pages/contact_us/header_php.php
Add this to around line 15
Modify the sql line around line 24$phone = zen_db_prepare_input($_POST['phonenumber']);
Insert this line around line 32$sql = "SELECT customers_id, customers_firstname, customers_lastname, customers_password, customers_email_address, customers_default_address_id, customers_telephone
Around line 50, modify the extra_info and text_message to look like$customer_phone= $check_customer->fields['customers_telephone'];
...
} else {
...
$customer_phone='Not logged in';
Around line 63, change html_msg to look like$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_EMAIL . "\t" . $email_address . "\n\n" .
Around line 78, insert the code to test whether or not the phone number field has text in it$html_msg['CONTACT_US_OFFICE_FROM'] = OFFICE_FROM . ' ' . $name . '<br />' . OFFICE_PHONE . ' ' . $phone . '<br />' . OFFICE_EMAIL . '(' . $email_address . ')';
Around line 90, change the sql statementif (empty($phone)) {
$messageStack->add('contact', ENTRY_EMAIL_PHONE_CHECK_ERROR);
}
A few lines down, insert$sql = "SELECT customers_id, customers_firstname, customers_lastname, customers_password, customers_email_address, customers_default_address_id, customers_telephone
File 4: Insert the following in between the contactname and email-address field definitions$phone= $check_customer->fields['customers_telephone'];
./includes/templates/MYTEMPLATE/templates/tpl_contact_us_default.php
File 5: Insert the following define<label class="inputLabel" for="phonenumber"><?php echo ENTRY_PHONE; ?></label>
<?php echo zen_draw_input_field('phonenumber', $phone, ' size="40" id="phonenumber"') . '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
<br class="clearBoth" />
./admin/includes/languages/english/email_extras.php
Hope this helps someone (or me when I forget how I did it :-)define('OFFICE_PHONE','Phone:');



for the small problem phone number field verification ( error when only the phone field is left blank)
