Use this mod to enter snail mail or phone orders. Installs a powerful search function in the admin that allows you to quickly select a desired customer, and load their email into the customer login form on the catalog side. If you have installed a master password contribution, then enter the master password and voila, you are signed on as that customer and can complete an order, change their account info, or any other customer accessed functions.
- Install one of these master password contributions from the OSCommerce site.
- Install this table where desired in admin/index.php
<!--customer search form-->
<table cellspacing="5" cellpadding="2" width="100%">
<tr>
<td width="30%" valign="top" >
<?php echo tep_draw_form('search_customers', FILENAME_DEFAULT, 'action=process', 'SSL', 'get', 'contact', ''); ?>
<?php
echo '<table class="mainText"><tr><td>email:<br>'.tep_draw_input_field('search_email').'</td></tr>
<tr><td>last name:<br>'.tep_draw_input_field('search_lastname').'</td></tr>
<tr><td>phone:<br>'.tep_draw_input_field('search_phone').'</td></tr></table>'
.tep_image_submit('button_search.gif', IMAGE_BUTTON_SEARCH).tep_hide_session_id().'</form>';
?>
</td>
<td width="70%" bgcolor="#F2F2F2">
<?php
if ($HTTP_GET_VARS['search_email']) {
$search_email = tep_db_prepare_input($HTTP_GET_VARS['search_email']);
$where_clause = "customers_email_address RLIKE '".tep_db_input($search_email)."'";
}
if ($HTTP_GET_VARS['search_phone']) {
$search_phone = tep_db_prepare_input($HTTP_GET_VARS['search_phone']);
$where_clause .= ($where_clause ? ' or ' : '')."customers_telephone RLIKE '".tep_db_input($search_phone)."'";
}
if ($HTTP_GET_VARS['search_lastname']) {
$search_lastname = tep_db_prepare_input($HTTP_GET_VARS['search_lastname']);
$where_clause .= ($where_clause ? ' or ' : '')." customers_lastname RLIKE '".tep_db_input($search_lastname)."'";
}
if ($where_clause) {
$search_sql = "select * from ".TABLE_CUSTOMERS." where ".$where_clause;
$search_query = tep_db_query($search_sql);
if (tep_db_num_rows($search_query)) {
?>
<table width="100%" >
<tr><td colspan="3" class="mainText"><b>Click email to enter order:<b></td></tr>
<tr><td colspan="3" height="1" bgcolor="000000"></td></tr>
<?php
while ($search_result = tep_db_fetch_array($search_query)) {
echo '<tr>
<td class="smallText"><a href="/login.php?'.$search_result['customers_email_address'].'">'.$search_result['customers_email_address'].'</a></td>
<td class="smallText">'.$search_result['customers_firstname'].' '.$search_result['customers_lastname'].'</td>
<td class="smallText">'.$search_result['customers_telephone'].'</td>
</tr><tr><td colspan="3" height="1" bgcolor="666666"></td></tr>';
}
?>
</table>
<?php
} else {
?>
<table>
<tr><td>No customers match this search</td></tr>
</table>
<?php
}
}
?>
</td>
</tr>
</table>
<!--end customer search form--> - Make these changes in catalog/login.php
- add this code just above the head tag (it can be anywhere on the page as long as it is above the login form and preferably below the error message code above the page header – paying attention to use of the ?> and <?php tags ):
<?php
$customersearch_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '".$_SERVER['QUERY_STRING']."'");
$customersearch = tep_db_fetch_array($customersearch_query);
if ($customersearch['customers_email_address']==$_SERVER['QUERY_STRING']){
$login_email = $_SERVER['QUERY_STRING'];
}
?> - change:
<?php echo tep_draw_input_field('email_address',' ','class=" required email"'); ?>
to:
<?php echo tep_draw_input_field('email_address',$login_email,'class=" required email"'); ?>
- add this code just above the head tag (it can be anywhere on the page as long as it is above the login form and preferably below the error message code above the page header – paying attention to use of the ?> and <?php tags ):
-
That’s it.