Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Contact us page.


danboy122

Recommended Posts

Posted

All,

I have had someone review my shop and tell me stuff that i should take out leave in or alter.

 

One thing that has been mentioned is the "Contact us" page. I need it so if someone is already logged in it inputs their name & e-mail address its coming from already OR not ask for that option and just know automatically who it is going from?

 

Guests should get all the options to fill out but logged in users shouldn't have to enter this information in again.

 

Does anyone have any ideas on how to do this?

 

Thanks

Dan

Posted

Search contributions for Contact Us

There are several different options there.

Posted

Search contributions for Contact Us

There are several different options there.

 

Yeah i have tried searching them several appear but nothing in the lines what is required above. They are mainly to add extra information on like the full address and e-mail links etc...

Posted

My approach is to have 2 seperate contact us pages, one for logged in & one for everyone else, then you make each to ask what is required for each of those cases.

 

I achieve this by a little code addition to the contact_us links, ie it links to one page for logged in, otherwise the other.

 

<?php if (tep_session_is_registered('customer_id')) { echo ('<a href="' . tep_href_link(FILENAME_CONTACT_US) . '"' ); } else { echo ('<a href="' . tep_href_link('contact.php') . '"' ); } ?>Contact Us</a>

 

 

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

My approach is to have 2 seperate contact us pages, one for logged in & one for everyone else, then you make each to ask what is required for each of those cases.

 

I achieve this by a little code addition to the contact_us links, ie it links to one page for logged in, otherwise the other.

 

<?php if (tep_session_is_registered('customer_id')) { echo ('<a href="' . tep_href_link(FILENAME_CONTACT_US) . '"' ); } else { echo ('<a href="' . tep_href_link('contact.php') . '"' ); } ?>Contact Us</a>

 

What page will i need to alter that on matey?

 

I presume this will change the physical link where the link points to? e.g. either contact_us.php / contact.php

Posted

What page will i need to alter that on

 

I would have that on the footer, but as i recall the default osc only has thet link in the info box (boxes/information.php)

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

My Information.php shows as the following: -

 

-------------------------------------------------

<?php
/*
 $Id: information.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- information //-->
         <tr>
           <td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_INFORMATION);

 new infoBoxHeading($info_box_contents, false, false);

 $info_box_contents = array();
 $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .
                                        '<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .
                                        '<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a><br>' .
                                        '<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>');

 new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- information_eof //-->

-------------------------------------------------

 

I have changed what i think i need to be i keep getting errors when going to the home page, what would you change on here sorry im a big newbie to all this stuff. I have tried to alter alot of stuff on the store but this is one i need to try and get done and discount codes that are not working but thats another matter.

Posted

 

In that instance it slightly different as your putting data in an array so you must stay within the php tags.

 

replace:

 

 '<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>');

 

with:

 

'<a href="' . (tep_session_is_registered('customer_id') ? tep_href_link(FILENAME_CONTACT_US) :  tep_href_link('contact.php')) . '">' . BOX_INFORMATION_CONTACT . '</a>');

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

Thank you very much i got it working now to 2 links.

 

Do you know how i would now make it automatically populate with the peoples name & e-mail address from their accounts? (Code from the contact_us.php)

 

Thanks

Dan.

Posted

 

 

There are a number of changes to do, to make it easy, here is the entire content of a contact_us page that I`ve used b4, take care, there may be stuff there that is non-standard.

 

Always backup first.

 

 

 

<?php
/*
 $Id: contact_us.php,v 1.42 2003/06/12 12:17:07 hpdl Exp $

modified to get dbase data for customer

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com/"]http://www.oscommerce.com[/url]

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

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

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONTACT_US);

 $error = false;
 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']);
 $xipaddress = $HTTP_SERVER_VARS["REMOTE_ADDR"];
 $phone = tep_db_prepare_input($HTTP_POST_VARS['phone']);
$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
 $date = 'Date Sent: ' . date("d M Y H:i:s");
 if (strlen($name) < 2) {
 	$error = true;

 	$messageStack->add('contact', 'Sorry, Your name is too short.');
}
 if (strlen($enquiry) < 8) {
 	$error = true;

 	$messageStack->add('contact', 'Sorry, you seem to have forgotten to enter your message?');
}
  $check = array ("-","_","."," ","(",")","ext");
 $tel_check = str_ireplace($check, '', $phone);
 if (!is_numeric($tel_check) && tep_not_null($phone)) {
   	$error = true;
   	$messageStack->add('contact', 'Sorry, your telephone number contains invalid characters.');
  }

if (tep_validate_email($email_address)) {
$enquiry = 'Message from: ' . $name . "\n" . $date . "\n" . 'Phone Number: ' .  $phone . "\n" . 'Client Number: ' .  $customer_id . "\n" . 'At IP: ' . $xipaddress . '.' . "\n\n" . 'Message:' . "\n" . $enquiry;
 	if (!$error) {
   tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, 'Enquiry', $enquiry, $name, $email_address);
   tep_redirect(tep_href_link(FILENAME_CONTACT_US, 'action=success'));
   }
} else {
 	$error = true;

 	$messageStack->add('contact', 'Sorry, We could’nt understand your e-mail address.');
}
 }

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CONTACT_US));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="900" cellspacing="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="0"  style="margin-left:-4px;">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><?php echo tep_draw_form('contact_us', tep_href_link(FILENAME_CONTACT_US, 'action=send')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
 	<tr>
   	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
     	<tr>
       	<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
       	<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_contact_us.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
     	</tr>
   	</table></td>
 	</tr>
 	<tr>
   	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 	</tr>
<?php
 if ($messageStack->size('contact') > 0) {
?>
 	<tr>
   	<td><?php echo $messageStack->output('contact'); ?></td>
 	</tr>
 	<tr>
   	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 	</tr>
<?php
 }

 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
?>
 	<tr>
   	<td class="main" align="center"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_man_on_board.gif', HEADING_TITLE, '0', '0', 'align="left"') . TEXT_SUCCESS; ?></td>
 	</tr>
 	<tr>
   	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 	</tr>
 	<tr>
   	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
     	<tr class="infoBoxContents">
       	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         	<tr>
           	<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
           	<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
           	<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
         	</tr>
       	</table></td>
     	</tr>
   	</table></td>
 	</tr>
<?php
 } else {

$account_query = tep_db_query("select customers_firstname, customers_lastname, customers_telephone, customers_id, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
$account = tep_db_fetch_array($account_query);
$name = $account['customers_firstname']." ".$account['customers_lastname'] ;
$email_address = $account['customers_email_address'] ;
$phone = $account['customers_telephone'] ;
$customer_id = $account['customers_id'] ;

?>
 	<tr>
   	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
     	<tr class="infoBoxContents">
       	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         	<tr>
           	<td class="main"><?php echo ENTRY_NAME; ?></td>
         	</tr>
         	<tr>
           	<td class="main"><input type="hidden" name="name" value="<?php echo $name ; ?>"><?php echo $name ; ?></td>
         	</tr>
         	<tr>
           	<td class="main"><?php echo ENTRY_EMAIL; ?></td>
         	</tr>
         	<tr>
           	<td class="main"><input type="hidden" name="email" value="<?php echo $email_address ; ?>"><?php echo $email_address ?></td>
         	</tr>
      <tr>
           	<td class="main"><input type="hidden" name="phone" value="<?php echo $phone ; ?>"></td>
         	</tr> 
         	<tr>
           	<td class="main"><?php echo ENTRY_ENQUIRY; ?></td>
         	</tr>
      <?php $text = ''; ?>
         	<tr>
           	<td><?php echo tep_draw_textarea_field('enquiry', 'soft', 50, 15, $text); ?></td>
         	</tr>
       	</table></td>
     	</tr>
   	</table></td>
 	</tr>
 	<tr>
   	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 	</tr>
 	<tr>
   	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
     	<tr class="infoBoxContents">
       	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         	<tr>
           	<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
           	<td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
           	<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
         	</tr>
       	</table></td>
     	</tr>
   	</table></td>
 	</tr>
<?php
 }
?>
</table></form></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


 

 

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

Well i have tried to add that code. My page is just called "contact.php" so i changed the first line to: -

 

"<?php/*  $Id: contact.php,v 1.42 2003/06/12 12:17:07 hpdl Exp"

 

rather than contact_us.php

 

When i try to load up the contact.php page now on the site i get the following error message: -

 

"Parse error: syntax error, unexpected T_REQUIRE in /home/herbalif/public_html/store/contact.php on line 1"

 

It might be because i need to leave the filename as contact_us.php i suppose?

Posted

Well i have tried to add that code. My page is just called "contact.php" so i changed the first line to: -

 

"<?php/*  $Id: contact.php,v 1.42 2003/06/12 12:17:07 hpdl Exp"

 

rather than contact_us.php

 

When i try to load up the contact.php page now on the site i get the following error message: -

 

 

 

It might be because i need to leave the filename as contact_us.php i suppose?

 

 

Nope i have just tried either way i do it i get the same error message.

Posted

Nope i have just tried either way i do it i get the same error message.

 

 

The page i posted is to replace your existing contact_us page, it just gets the data from the dbase, which is what u asked for, you need to make the other yourself. smile.gif

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Archived

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

×
×
  • Create New...