Hej,
Jeg har forsøgt at få hjælp fra oscommerce.com til at få nogle flere felter under min kontakt os side.
Der var en venlig sjæl som viste mig dette:
Når jeg redigere filen som vist nedenfor kommer der rigtigt nok et "phone" felt frem og jeg kan også sende emailen, men der kommer ikke nogen E-mail i min inbox efter denne redigering..
Er der en der kan se om der er en fejl i koden?
Vh Tommy
C. How to add extra fields to the contact us form?
Lets say you want to add the customers phone to the form
1) In catalog/contact_us.php
find the code
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {
$name = tep_db_prepare_input($HTTP_POST_VARS['name']);
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
if (tep_validate_email($email_address)) {
tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);
replace it with
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {
$name = tep_db_prepare_input($HTTP_POST_VARS['name']);
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);
$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
$phone = tep_db_prepare_input($HTTP_POST_VARS['phone']); // add phone 21.6.09
// BOF multimixer//
//define variable $email_body. if you want to add more fields do so by adding this line [ ."\r\n" . ] between the fields you wish to display and order them accordingly//
$email_body = EMAIL_TEXT_CUSTOMER_NAME . ' ' . $name . "\r\n" . EMAIL_TEXT_CUSTOMER_EMAIL . ' ' . $email_address . "\r\n" . EMAIL_TEXT_CUSTOMER_PHONE . ' ' . $phone . "\r\n" . EMAIL_TEXT_CUSTOMER_MESSAGE . ' ' . $enquiry;
//define variable $from_email. Set to Store owner email address as defined in Admin panel. If you want mails to be sent from customers mail address, set it to email_address//
$from_email = (STORE_OWNER_EMAIL_ADDRESS);
//EOF multimixer //
//BOF Multimixer//
// $enquiry replaced by $email_body Includes $email_body to message instead of $enquiry. $email_address replaced by $from_email Email is getting send from $from-email instead of $email_address//
if (tep_validate_email($email_address)) {
tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $email_body, $name, $from_email);
//EOF multimixer//
2) In the same file,
find the code
<tr>
<td class="main"><?php echo ENTRY_EMAIL; ?></td>
</tr>
<tr>
<td class="main"><?php echo tep_draw_input_field('email'); ?></td>
</tr>
add after
<tr>
<td class="main"><?php echo ENTRY_PHONE; ?></td>
</tr>
<tr>
<td><?php echo tep_draw_input_field('phone'); ?></td>
</tr>
3) In file includes/languages/yourlanguage/contact_us.php add anywhere befote last ?>
// mm 23.6.2009define('EMAIL_TEXT_CUSTOMER_NAME', 'Name:');define('EMAIL_TEXT_CUSTOMER_EMAIL', 'email:');define('EMAIL_TEXT_CUSTOMER_PHONE', 'Phone:');define('EMAIL_TEXT_CUSTOMER_MESSAGE', 'Message:');
You will have the phone in the form, and the phone send by email. In this configurations mails are send from Store owners mail address, but you can change this