Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

contact page


JB04

Recommended Posts

I've copied contact_us.php and renamed it to contact.php, added:

 

 if (!tep_session_is_registered('customer_id')) {
   $navigation->set_snapshot();
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }

 

to the top of the page just under: require('includes/application_top.php');

I then can add an extra contact link to the account page so when logged in a customer can use this one and have name, email filled in for them, i also add just under this bit but directly above the line which says <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

 

$customer_first_name = $firstname;

 $account_query = tep_db_query("select customers_gender, customers_firstname, customers_lastname, customers_dob, customers_email_address, customers_telephone, customers_fax from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
 $account = tep_db_fetch_array($account_query);

 

This fetches the name & email of the customer if logged in and fills in data for them on the form, we then also need to replace this bit:

 

<?php echo tep_draw_input_field('name'); ?>

 

With this:

 

<?php echo tep_draw_input_field('name', $account['customers_firstname']) . ' ' . (tep_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?>

 

And also just below replace this line:

 

<?php echo tep_draw_input_field('email'); ?>

 

With this:

 

<?php echo tep_draw_input_field('email', $account['customers_email_address']) . ' ' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?>

 

That's it..

 

I still havent worked out how to add first & last name in the same box so if anyone wants to help?

 

Muchly appreciated

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...