Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Purchase Without Account Updated & Admin Functionality


Guest

Recommended Posts

I read through some more posts and have implemented this change:

in order_info.php, find this code near the top

$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
	} else {
	  $check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
	 $check_email = tep_db_fetch_array($check_email_query);
	  if ($check_email['total'] > 0) {
		$error = true;

Change to this

$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
	} else {
	  $check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
	  //$check_email = tep_db_fetch_array($check_email_query);
	  if ($check_email['total'] > 0) {
		$error = true;

Now PWA customers can use any email address they want over and over. The downside is they can use an e-mail that is already being used by an account holder and there is no error. Does someone know of a better way to fix this problem? I have looked over several of the files in the contribution and none of them havce any of these checks commented out.

 

Tim

Link to comment
Share on other sites

I read through some more posts and have implemented this change:

in order_info.php, find this code near the top

$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
	} else {
	  $check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
	 $check_email = tep_db_fetch_array($check_email_query);
	  if ($check_email['total'] > 0) {
		$error = true;

Change to this

$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
	} else {
	  $check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
	  //$check_email = tep_db_fetch_array($check_email_query);
	  if ($check_email['total'] > 0) {
		$error = true;

Now PWA customers can use any email address they want over and over. The downside is they can use an e-mail that is already being used by an account holder and there is no error. Does someone know of a better way to fix this problem? I have looked over several of the files in the contribution and none of them havce any of these checks commented out.

 

Tim

 

Tim,

 

Thanks for sharing this information, but when I make this change I get the page that asks me to select from the 3 choices: new account, customer login, or proceed directly to checkout. At the top is this message:

 

PWA_FAIL_ACCOUNT_EXISTS

 

Note: Your "Visitors Cart" contents will be merged with your "Members Cart" contents once you have logged on. [More Info

 

Any ideas?

 

Thanks.

Link to comment
Share on other sites

Tim,

 

Thanks for sharing this information, but when I make this change I get the page that asks me to select from the 3 choices: new account, customer login, or proceed directly to checkout. At the top is this message:

 

PWA_FAIL_ACCOUNT_EXISTS

 

Note: Your "Visitors Cart" contents will be merged with your "Members Cart" contents once you have logged on. [More Info

 

Any ideas?

 

Thanks.

Not real sure what happened. The page with the three choices is called login.php and the page my changes are made on is called order_info.php. In the normal checkout process, you vist login.php before order-info, so i don't know why changing order_info would affect the login page. Just for the heck of it, I am posting my complete order_info page. The only other modifications I have on this from the download is I added some code to change a persons name from all lowercase to fist letter capitalized. ie you enter 'bob' and the db records 'Bob'

 

<?php
/*
 $Id: create_account.php,v 1.65 2003/06/09 23:03:54 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

// Includes Country-State Selector (http://www.oscommerce.com/community/contributions,2028) and
// Purchase Without Account 0.90 (http://www.oscommerce.com/community/contributions,355)
// 

 require('includes/application_top.php');

// needs to be included earlier to set the success message in the messageStack
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CREATE_ACCOUNT);

 $process = false;
 // +Country-State Selector
 $refresh = false;
 if (isset($HTTP_POST_VARS['action']) && (($HTTP_POST_VARS['action'] == 'process') || ($HTTP_POST_VARS['action'] == 'refresh'))) {
if ($HTTP_POST_VARS['action'] == 'process')  $process = true;
if ($HTTP_POST_VARS['action'] == 'refresh') $refresh = true;
}
 // -Country-State Selector

if (ACCOUNT_GENDER == 'true') {
  if (isset($HTTP_POST_VARS['gender'])) {
	$gender = tep_db_prepare_input($HTTP_POST_VARS['gender']);
  } else {
	$gender = false;
  }
}
$firstname = tep_db_prepare_input(ucwords(strtolower($HTTP_POST_VARS['firstname'])));
$lastname = tep_db_prepare_input(ucwords(strtolower($HTTP_POST_VARS['lastname'])));
if (ACCOUNT_DOB == 'true') $dob = tep_db_prepare_input($HTTP_POST_VARS['dob']);
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
if (ACCOUNT_COMPANY == 'true') $company = tep_db_prepare_input($HTTP_POST_VARS['company']);
$street_address = tep_db_prepare_input(ucwords(strtolower($HTTP_POST_VARS['street_address'])));
if (ACCOUNT_SUBURB == 'true') $suburb = tep_db_prepare_input($HTTP_POST_VARS['suburb']);
$postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);
$city = tep_db_prepare_input(ucwords(strtolower($HTTP_POST_VARS['city'])));
if (ACCOUNT_STATE == 'true') {
  $state = tep_db_prepare_input($HTTP_POST_VARS['state']);
  if (isset($HTTP_POST_VARS['zone_id'])) {
	$zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']);
  } else {
	$zone_id = false;
  }
}
$country = tep_db_prepare_input($HTTP_POST_VARS['country']);
$telephone = tep_db_prepare_input($HTTP_POST_VARS['telephone']);
$fax = tep_db_prepare_input($HTTP_POST_VARS['fax']);
if (isset($HTTP_POST_VARS['newsletter'])) {
  $newsletter = tep_db_prepare_input($HTTP_POST_VARS['newsletter']);
} else {
  $newsletter = false;
}
$password = '';

// +Country-State Selector
if ($process) {
	// -Country-State Selector
	$error = false;

	if (ACCOUNT_GENDER == 'true') {
		if ( ($gender != 'm') && ($gender != 'f') ) {
		$error = true;

		$messageStack->add('create_account', ENTRY_GENDER_ERROR);
		}
	}

	if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_FIRST_NAME_ERROR);
	}

	if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_LAST_NAME_ERROR);
	}

	if (ACCOUNT_DOB == 'true') {
	  if (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4)) == false) {
		$error = true;

		$messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);
	  }
	}

	if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR);
	} elseif (tep_validate_email($email_address) == false) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
	} else {
	  $check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
	  //$check_email = tep_db_fetch_array($check_email_query);
	  if ($check_email['total'] > 0) {
		$error = true;

		$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
	  }
	}

	if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_STREET_ADDRESS_ERROR);
	}

	if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_POST_CODE_ERROR);
	}

	if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_CITY_ERROR);
	}

	if (is_numeric($country) == false) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_COUNTRY_ERROR);
	}

	if (ACCOUNT_STATE == 'true') {
	  // +Country-State Selector
	  if ($zone_id == 0) {
	  // -Country-State Selector

		if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
		  $error = true;

		  $messageStack->add('create_account', ENTRY_STATE_ERROR);
		}
	  }
	}

	if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_TELEPHONE_NUMBER_ERROR);
	}

	if ($error == false) {

		// PWA 0.70 : SELECT using new method of determining a customer has purchased without account:
		$check_customer_query = tep_db_query("select customers_id, purchased_without_account, 
			customers_firstname, customers_password, customers_email_address,
			customers_default_address_id from " . TABLE_CUSTOMERS . "
			where upper(customers_email_address) = '" . strtoupper($HTTP_POST_VARS['email_address']) . "' and
			upper(customers_firstname) = '" . strtoupper($HTTP_POST_VARS['firstname']) . "' and
			upper(customers_lastname) = '" . strtoupper($HTTP_POST_VARS['lastname']) . "'");

		// if password is EMPTY (null) and e-mail address is same then we just load up their account information.
		// could be security flaw -- might want to setup password = somestring and have it recheck here (during the first initial
		// creation

		$check_customer = tep_db_fetch_array($check_customer_query);

		if (tep_db_num_rows($check_customer_query)) {

			// PWA 0.70 added this for backwards compatibility with older versions of PWA
			// that made a blank password, causing logins to fail:
			if(!$check_customer['purchased_without_account']) {
				list($md5hash, $salt) = explode(':',$check_customer['customers_password']);
				if(md5($salt) == $md5hash) {
					// password was blank; customer purchased without account using a previous version of PWA code
					$check_customer['purchased_without_account'] = 1;
				}
			}

			if ($check_customer['purchased_without_account'] != 1) {
				// Customer found and has account - make them log in.
				tep_redirect(tep_href_link(FILENAME_LOGIN, 
					'login=fail&reason=' . urlencode(
					str_replace('{EMAIL_ADDRESS}',$check_customer['customers_email_address'],PWA_FAIL_ACCOUNT_EXISTS)), 'SSL'));

			} else {
				// Customer found but no account - fetch their details.

				$customer_id = $check_customer['customers_id'];
				// now get latest address book entry:
				$get_default_address = tep_db_query("select address_book_id, entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . "
					where customers_id = '" . $customer_id . "' ORDER BY address_book_id DESC LIMIT 1");
				$default_address = tep_db_fetch_array($get_default_address);
				$customer_default_address_id = $default_address['address_book_id'];
				$customer_first_name = $check_customer['customers_firstname'];
				$customer_country_id = $default_address['entry_country_id'];
				$customer_zone_id = $default_address['entry_zone_id'];
				tep_session_register('customer_id');
				tep_session_register('customer_default_address_id');
				tep_session_register('customer_first_name');
				tep_session_register('customer_country_id');
				tep_session_register('customer_zone_id');
				// PWA 0.71 update returning customer's address book:
				$customer_update = array('customers_firstname' => $firstname,
					'customers_lastname' => $lastname,
					'customers_telephone' => $telephone,
					'customers_fax' => $fax);
				if (ACCOUNT_GENDER == 'true') $customer_update['customers_gender'] = $gender;
				tep_db_perform(TABLE_CUSTOMERS, $customer_update, 'update', "customers_id = '".$customer_id."'");

				$address_book_update = array('customers_id' => $customer_id,
					'entry_firstname' => $firstname,
					'entry_lastname' => $lastname,
					'entry_street_address' => $street_address,
					'entry_postcode' => $postcode,
					'entry_city' => $city,
					'entry_country_id' => $country);
				if (ACCOUNT_GENDER == 'true') $address_book_update['entry_gender'] = $gender;
				if (ACCOUNT_COMPANY == 'true') $address_book_update['entry_company'] = $company;
				if (ACCOUNT_SUBURB == 'true') $address_book_update['entry_suburb'] = $suburb;
				if (ACCOUNT_STATE == 'true') {
					if ($zone_id > 0) {
						$address_book_update['entry_zone_id'] = $zone_id;
						$address_book_update['entry_state'] = '';
					} else {
						$address_book_update['entry_zone_id'] = '0';
						$address_book_update['entry_state'] = $state;
					}
				}

				tep_db_perform(TABLE_ADDRESS_BOOK, $address_book_update, 'update', "address_book_id = '".$customer_default_address_id."'");
			} // if-else $pass_ok

			if ($HTTP_POST_VARS['setcookie'] == '1') {
				setcookie('email_address', $HTTP_POST_VARS['email_address'], time()+2592000);
				setcookie('password', $HTTP_POST_VARS['password'], time()+2592000);
				setcookie('first_name', $customer_first_name, time()+2592000);
			} elseif ( ($HTTP_COOKIE_VARS['email_address']) && ($HTTP_COOKIE_VARS['password']) ) {
				setcookie('email_address', '');
				setcookie('password', '');
				setcookie('first_name', '');
			} // if cookies

			$date_now = date('Ymd');
			tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(),
				customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . $customer_id . "'");

		} else {
			// if customer_exist = NO

			// PWA 0.70 : new way of determining a customer purchased without an account : just say so!
			$sql_data_array = array('purchased_without_account' => 1,
								'customers_firstname' => $firstname,
								'customers_lastname' => $lastname,
								'customers_email_address' => $email_address,
								'customers_telephone' => $telephone,
								'customers_fax' => $fax,
								'customers_newsletter' => $newsletter,
								'customers_password' => tep_encrypt_password($password));
	//							'customers_default_address_id' => 1);

			if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
			if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob);

			tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

			$customer_id = tep_db_insert_id();

			$sql_data_array = array('customers_id' => $customer_id,
								'address_book_id' => $address_id,
								'entry_firstname' => $firstname,
								'entry_lastname' => $lastname,
								'entry_street_address' => $street_address,
								'entry_postcode' => $postcode,
								'entry_city' => $city,
								'entry_country_id' => $country);

			if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;
			if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company;
			if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;
			if (ACCOUNT_STATE == 'true') {
				if ($zone_id > 0) {
					$sql_data_array['entry_zone_id'] = $zone_id;
					$sql_data_array['entry_state'] = '';
				} else {
					$sql_data_array['entry_zone_id'] = '0';
					$sql_data_array['entry_state'] = $state;
				}
			}

			tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

			$address_id = tep_db_insert_id();

			tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");

			tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())");	

			$customer_first_name = $firstname;
			$customer_default_address_id = $address_id;
			$customer_country_id = $country;
			$customer_zone_id = $zone_id;
			tep_session_register('customer_id');
			tep_session_register('customer_first_name');
			tep_session_register('customer_default_address_id');
			tep_session_register('customer_country_id');
			tep_session_register('customer_zone_id');

		}  // end of check for whether customer exists.

		// restore cart contents
		$cart->restore_contents();

		tep_session_register('noaccount');

		tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
	} // if ($error = false)

// +Country-State Selector 
} // if ($process)
if ($HTTP_POST_VARS['action'] == 'refresh') {$state = '';}
if (!isset($country)){$country = DEFAULT_COUNTRY;}
// -Country-State Selector

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));
?>
<!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">
<?php require('includes/form_check.js.php'); ?>
</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="100%" cellspacing="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- 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('create_account', tep_href_link(FILENAME_ORDER_INFO, '', 'SSL'), 'post', 'onSubmit="return check_form(create_account);"') . tep_draw_hidden_field('action', 'process'); ?><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_account.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>
  <tr>
	<td class="smallText"><br><?php echo sprintf(TEXT_ORIGIN_LOGIN, tep_href_link(FILENAME_LOGIN, tep_get_all_get_params(), 'SSL')); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 if ($messageStack->size('create_account') > 0) {
?>
  <tr>
	<td><?php echo $messageStack->output('create_account'); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 }
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main"><b><?php echo CATEGORY_PERSONAL; ?></b></td>
	   <td class="inputRequirement" align="right"><?php echo FORM_REQUIRED_INFORMATION; ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" cellspacing="2" cellpadding="2">
<?php
 if (ACCOUNT_GENDER == 'true') {
?>
		  <tr>
			<td class="main"><?php echo ENTRY_GENDER; ?></td>
			<td class="main"><?php echo tep_draw_radio_field('gender', 'm') . '??' . MALE . '??' . tep_draw_radio_field('gender', 'f') . '??' . FEMALE . '?' . (tep_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td>
		  </tr>
<?php
 }
?>
		  <tr>
			<td class="main"><?php echo ENTRY_FIRST_NAME; ?></td>
			<td class="main"><?php echo tep_draw_input_field('firstname') . '?' . (tep_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td>
		  </tr>
		  <tr>
			<td class="main"><?php echo ENTRY_LAST_NAME; ?></td>
			<td class="main"><?php echo tep_draw_input_field('lastname') . '?' . (tep_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?></td>
		  </tr>
<?php
 if (ACCOUNT_DOB == 'true') {
?>
		  <tr>
			<td class="main"><?php echo ENTRY_DATE_OF_BIRTH; ?></td>
			<td class="main"><?php echo tep_draw_input_field('dob') . '?' . (tep_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''); ?></td>
		  </tr>
<?php
 }
?>
		  <tr>
			<td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
			<td class="main"><?php echo tep_draw_input_field('email_address') . '?' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
<?php
 if (ACCOUNT_COMPANY == 'true') {
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td class="main"><b><?php echo CATEGORY_COMPANY; ?></b></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" cellspacing="2" cellpadding="2">
		  <tr>
			<td class="main"><?php echo ENTRY_COMPANY; ?></td>
			<td class="main"><?php echo tep_draw_input_field('company') . '?' . (tep_not_null(ENTRY_COMPANY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
<?php
 }
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td class="main"><b><?php echo CATEGORY_ADDRESS; ?></b></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" cellspacing="2" cellpadding="2">
		  <tr>
			<td class="main"><?php echo ENTRY_STREET_ADDRESS; ?></td>
			<td class="main"><?php echo tep_draw_input_field('street_address') . '?' . (tep_not_null(ENTRY_STREET_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_STREET_ADDRESS_TEXT . '</span>': ''); ?></td>
		  </tr>
<?php
 if (ACCOUNT_SUBURB == 'true') {
?>
		  <tr>
			<td class="main"><?php echo ENTRY_SUBURB; ?></td>
			<td class="main"><?php echo tep_draw_input_field('suburb') . '?' . (tep_not_null(ENTRY_SUBURB_TEXT) ? '<span class="inputRequirement">' . ENTRY_SUBURB_TEXT . '</span>': ''); ?></td>
		  </tr>
<?php
 }
?>
			<tr>
			<td class="main"><?php echo ENTRY_CITY; ?></td>
			<td class="main"><?php echo tep_draw_input_field('city') . '?' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?></td>
		  </tr>
<?php
 if (ACCOUNT_STATE == 'true') {
?>
		  <tr>
			<td class="main"><?php echo ENTRY_STATE; ?></td>
			<td class="main">
<?php
// +Country-State Selector
	$zones_array = array();
	 $zones_query = tep_db_query("select zone_id, zone_name from " . TABLE_ZONES . " where zone_country_id = " . (int)$country . " order by zone_name");
	while ($zones_values = tep_db_fetch_array($zones_query)) {
	  $zones_array[] = array('id' => $zones_values['zone_id'], 'text' => $zones_values['zone_name']);
	}
	if (count($zones_array) > 0) {
	  echo tep_draw_pull_down_menu('zone_id', $zones_array);
	} else {
	  echo tep_draw_input_field('state');
	}
// -Country-State Selector
if (tep_not_null(ENTRY_STATE_TEXT)) echo '?<span class="inputRequirement">' . ENTRY_STATE_TEXT;

?>
			</td>
		  </tr>
<tr>
			<td class="main"><?php echo ENTRY_POST_CODE; ?></td>
			<td class="main"><?php echo tep_draw_input_field('postcode') . '?' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>
		  </tr>
<?php
 }
?>
		  <tr>
			<td class="main"><?php echo ENTRY_COUNTRY; ?></td>
			<?php // +Country-State Selector ?>
			<td class="main"><?php echo tep_get_country_list('country',$country,'onChange="return refresh_form(create_account);"') . '?' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>
			<?php // -Country-State Selector ?>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td class="main"><b><?php echo CATEGORY_CONTACT; ?></b></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" cellspacing="2" cellpadding="2">
		  <tr>
			<td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
			<td class="main"><?php echo tep_draw_input_field('telephone') . '?' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
		  </tr>
		  <tr>
			<td class="main"><?php echo ENTRY_FAX_NUMBER; ?></td>
			<td class="main"><?php echo tep_draw_input_field('fax') . '?' . (tep_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <?php echo tep_draw_hidden_field("password","DummyForPWA") . tep_draw_hidden_field("confirmation","DummyForPWA"); ?>
  </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><?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>
</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 include(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php include(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

Not real sure what happened. The page with the three choices is called login.php and the page my changes are made on is called order_info.php. In the normal checkout process, you vist login.php before order-info, so i don't know why changing order_info would affect the login page. Just for the heck of it, I am posting my complete order_info page. The only other modifications I have on this from the download is I added some code to change a persons name from all lowercase to fist letter capitalized. ie you enter 'bob' and the db records 'Bob'

 

<?php
/*
 $Id: create_account.php,v 1.65 2003/06/09 23:03:54 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

// Includes Country-State Selector (http://www.oscommerce.com/community/contributions,2028) and
// Purchase Without Account 0.90 (http://www.oscommerce.com/community/contributions,355)
// 

 require('includes/application_top.php');

// needs to be included earlier to set the success message in the messageStack
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CREATE_ACCOUNT);

 $process = false;
 // +Country-State Selector
 $refresh = false;
 if (isset($HTTP_POST_VARS['action']) && (($HTTP_POST_VARS['action'] == 'process') || ($HTTP_POST_VARS['action'] == 'refresh'))) {
if ($HTTP_POST_VARS['action'] == 'process')  $process = true;
if ($HTTP_POST_VARS['action'] == 'refresh') $refresh = true;
}
 // -Country-State Selector

if (ACCOUNT_GENDER == 'true') {
  if (isset($HTTP_POST_VARS['gender'])) {
	$gender = tep_db_prepare_input($HTTP_POST_VARS['gender']);
  } else {
	$gender = false;
  }
}
$firstname = tep_db_prepare_input(ucwords(strtolower($HTTP_POST_VARS['firstname'])));
$lastname = tep_db_prepare_input(ucwords(strtolower($HTTP_POST_VARS['lastname'])));
if (ACCOUNT_DOB == 'true') $dob = tep_db_prepare_input($HTTP_POST_VARS['dob']);
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
if (ACCOUNT_COMPANY == 'true') $company = tep_db_prepare_input($HTTP_POST_VARS['company']);
$street_address = tep_db_prepare_input(ucwords(strtolower($HTTP_POST_VARS['street_address'])));
if (ACCOUNT_SUBURB == 'true') $suburb = tep_db_prepare_input($HTTP_POST_VARS['suburb']);
$postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);
$city = tep_db_prepare_input(ucwords(strtolower($HTTP_POST_VARS['city'])));
if (ACCOUNT_STATE == 'true') {
  $state = tep_db_prepare_input($HTTP_POST_VARS['state']);
  if (isset($HTTP_POST_VARS['zone_id'])) {
	$zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']);
  } else {
	$zone_id = false;
  }
}
$country = tep_db_prepare_input($HTTP_POST_VARS['country']);
$telephone = tep_db_prepare_input($HTTP_POST_VARS['telephone']);
$fax = tep_db_prepare_input($HTTP_POST_VARS['fax']);
if (isset($HTTP_POST_VARS['newsletter'])) {
  $newsletter = tep_db_prepare_input($HTTP_POST_VARS['newsletter']);
} else {
  $newsletter = false;
}
$password = '';

// +Country-State Selector
if ($process) {
	// -Country-State Selector
	$error = false;

	if (ACCOUNT_GENDER == 'true') {
		if ( ($gender != 'm') && ($gender != 'f') ) {
		$error = true;

		$messageStack->add('create_account', ENTRY_GENDER_ERROR);
		}
	}

	if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_FIRST_NAME_ERROR);
	}

	if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_LAST_NAME_ERROR);
	}

	if (ACCOUNT_DOB == 'true') {
	  if (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4)) == false) {
		$error = true;

		$messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);
	  }
	}

	if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR);
	} elseif (tep_validate_email($email_address) == false) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
	} else {
	  $check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
	  //$check_email = tep_db_fetch_array($check_email_query);
	  if ($check_email['total'] > 0) {
		$error = true;

		$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
	  }
	}

	if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_STREET_ADDRESS_ERROR);
	}

	if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_POST_CODE_ERROR);
	}

	if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_CITY_ERROR);
	}

	if (is_numeric($country) == false) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_COUNTRY_ERROR);
	}

	if (ACCOUNT_STATE == 'true') {
	  // +Country-State Selector
	  if ($zone_id == 0) {
	  // -Country-State Selector

		if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
		  $error = true;

		  $messageStack->add('create_account', ENTRY_STATE_ERROR);
		}
	  }
	}

	if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_TELEPHONE_NUMBER_ERROR);
	}

	if ($error == false) {

		// PWA 0.70 : SELECT using new method of determining a customer has purchased without account:
		$check_customer_query = tep_db_query("select customers_id, purchased_without_account, 
			customers_firstname, customers_password, customers_email_address,
			customers_default_address_id from " . TABLE_CUSTOMERS . "
			where upper(customers_email_address) = '" . strtoupper($HTTP_POST_VARS['email_address']) . "' and
			upper(customers_firstname) = '" . strtoupper($HTTP_POST_VARS['firstname']) . "' and
			upper(customers_lastname) = '" . strtoupper($HTTP_POST_VARS['lastname']) . "'");

		// if password is EMPTY (null) and e-mail address is same then we just load up their account information.
		// could be security flaw -- might want to setup password = somestring and have it recheck here (during the first initial
		// creation

		$check_customer = tep_db_fetch_array($check_customer_query);

		if (tep_db_num_rows($check_customer_query)) {

			// PWA 0.70 added this for backwards compatibility with older versions of PWA
			// that made a blank password, causing logins to fail:
			if(!$check_customer['purchased_without_account']) {
				list($md5hash, $salt) = explode(':',$check_customer['customers_password']);
				if(md5($salt) == $md5hash) {
					// password was blank; customer purchased without account using a previous version of PWA code
					$check_customer['purchased_without_account'] = 1;
				}
			}

			if ($check_customer['purchased_without_account'] != 1) {
				// Customer found and has account - make them log in.
				tep_redirect(tep_href_link(FILENAME_LOGIN, 
					'login=fail&reason=' . urlencode(
					str_replace('{EMAIL_ADDRESS}',$check_customer['customers_email_address'],PWA_FAIL_ACCOUNT_EXISTS)), 'SSL'));

			} else {
				// Customer found but no account - fetch their details.

				$customer_id = $check_customer['customers_id'];
				// now get latest address book entry:
				$get_default_address = tep_db_query("select address_book_id, entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . "
					where customers_id = '" . $customer_id . "' ORDER BY address_book_id DESC LIMIT 1");
				$default_address = tep_db_fetch_array($get_default_address);
				$customer_default_address_id = $default_address['address_book_id'];
				$customer_first_name = $check_customer['customers_firstname'];
				$customer_country_id = $default_address['entry_country_id'];
				$customer_zone_id = $default_address['entry_zone_id'];
				tep_session_register('customer_id');
				tep_session_register('customer_default_address_id');
				tep_session_register('customer_first_name');
				tep_session_register('customer_country_id');
				tep_session_register('customer_zone_id');
				// PWA 0.71 update returning customer's address book:
				$customer_update = array('customers_firstname' => $firstname,
					'customers_lastname' => $lastname,
					'customers_telephone' => $telephone,
					'customers_fax' => $fax);
				if (ACCOUNT_GENDER == 'true') $customer_update['customers_gender'] = $gender;
				tep_db_perform(TABLE_CUSTOMERS, $customer_update, 'update', "customers_id = '".$customer_id."'");

				$address_book_update = array('customers_id' => $customer_id,
					'entry_firstname' => $firstname,
					'entry_lastname' => $lastname,
					'entry_street_address' => $street_address,
					'entry_postcode' => $postcode,
					'entry_city' => $city,
					'entry_country_id' => $country);
				if (ACCOUNT_GENDER == 'true') $address_book_update['entry_gender'] = $gender;
				if (ACCOUNT_COMPANY == 'true') $address_book_update['entry_company'] = $company;
				if (ACCOUNT_SUBURB == 'true') $address_book_update['entry_suburb'] = $suburb;
				if (ACCOUNT_STATE == 'true') {
					if ($zone_id > 0) {
						$address_book_update['entry_zone_id'] = $zone_id;
						$address_book_update['entry_state'] = '';
					} else {
						$address_book_update['entry_zone_id'] = '0';
						$address_book_update['entry_state'] = $state;
					}
				}

				tep_db_perform(TABLE_ADDRESS_BOOK, $address_book_update, 'update', "address_book_id = '".$customer_default_address_id."'");
			} // if-else $pass_ok

			if ($HTTP_POST_VARS['setcookie'] == '1') {
				setcookie('email_address', $HTTP_POST_VARS['email_address'], time()+2592000);
				setcookie('password', $HTTP_POST_VARS['password'], time()+2592000);
				setcookie('first_name', $customer_first_name, time()+2592000);
			} elseif ( ($HTTP_COOKIE_VARS['email_address']) && ($HTTP_COOKIE_VARS['password']) ) {
				setcookie('email_address', '');
				setcookie('password', '');
				setcookie('first_name', '');
			} // if cookies

			$date_now = date('Ymd');
			tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(),
				customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . $customer_id . "'");

		} else {
			// if customer_exist = NO

			// PWA 0.70 : new way of determining a customer purchased without an account : just say so!
			$sql_data_array = array('purchased_without_account' => 1,
								'customers_firstname' => $firstname,
								'customers_lastname' => $lastname,
								'customers_email_address' => $email_address,
								'customers_telephone' => $telephone,
								'customers_fax' => $fax,
								'customers_newsletter' => $newsletter,
								'customers_password' => tep_encrypt_password($password));
	//							'customers_default_address_id' => 1);

			if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
			if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob);

			tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

			$customer_id = tep_db_insert_id();

			$sql_data_array = array('customers_id' => $customer_id,
								'address_book_id' => $address_id,
								'entry_firstname' => $firstname,
								'entry_lastname' => $lastname,
								'entry_street_address' => $street_address,
								'entry_postcode' => $postcode,
								'entry_city' => $city,
								'entry_country_id' => $country);

			if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;
			if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company;
			if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;
			if (ACCOUNT_STATE == 'true') {
				if ($zone_id > 0) {
					$sql_data_array['entry_zone_id'] = $zone_id;
					$sql_data_array['entry_state'] = '';
				} else {
					$sql_data_array['entry_zone_id'] = '0';
					$sql_data_array['entry_state'] = $state;
				}
			}

			tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

			$address_id = tep_db_insert_id();

			tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");

			tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())");	

			$customer_first_name = $firstname;
			$customer_default_address_id = $address_id;
			$customer_country_id = $country;
			$customer_zone_id = $zone_id;
			tep_session_register('customer_id');
			tep_session_register('customer_first_name');
			tep_session_register('customer_default_address_id');
			tep_session_register('customer_country_id');
			tep_session_register('customer_zone_id');

		}  // end of check for whether customer exists.

		// restore cart contents
		$cart->restore_contents();

		tep_session_register('noaccount');

		tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
	} // if ($error = false)

// +Country-State Selector 
} // if ($process)
if ($HTTP_POST_VARS['action'] == 'refresh') {$state = '';}
if (!isset($country)){$country = DEFAULT_COUNTRY;}
// -Country-State Selector

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));
?>
<!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">
<?php require('includes/form_check.js.php'); ?>
</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="100%" cellspacing="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- 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('create_account', tep_href_link(FILENAME_ORDER_INFO, '', 'SSL'), 'post', 'onSubmit="return check_form(create_account);"') . tep_draw_hidden_field('action', 'process'); ?><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_account.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>
  <tr>
	<td class="smallText"><br><?php echo sprintf(TEXT_ORIGIN_LOGIN, tep_href_link(FILENAME_LOGIN, tep_get_all_get_params(), 'SSL')); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 if ($messageStack->size('create_account') > 0) {
?>
  <tr>
	<td><?php echo $messageStack->output('create_account'); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 }
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main"><b><?php echo CATEGORY_PERSONAL; ?></b></td>
	   <td class="inputRequirement" align="right"><?php echo FORM_REQUIRED_INFORMATION; ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" cellspacing="2" cellpadding="2">
<?php
 if (ACCOUNT_GENDER == 'true') {
?>
		  <tr>
			<td class="main"><?php echo ENTRY_GENDER; ?></td>
			<td class="main"><?php echo tep_draw_radio_field('gender', 'm') . '??' . MALE . '??' . tep_draw_radio_field('gender', 'f') . '??' . FEMALE . '?' . (tep_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td>
		  </tr>
<?php
 }
?>
		  <tr>
			<td class="main"><?php echo ENTRY_FIRST_NAME; ?></td>
			<td class="main"><?php echo tep_draw_input_field('firstname') . '?' . (tep_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td>
		  </tr>
		  <tr>
			<td class="main"><?php echo ENTRY_LAST_NAME; ?></td>
			<td class="main"><?php echo tep_draw_input_field('lastname') . '?' . (tep_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?></td>
		  </tr>
<?php
 if (ACCOUNT_DOB == 'true') {
?>
		  <tr>
			<td class="main"><?php echo ENTRY_DATE_OF_BIRTH; ?></td>
			<td class="main"><?php echo tep_draw_input_field('dob') . '?' . (tep_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''); ?></td>
		  </tr>
<?php
 }
?>
		  <tr>
			<td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
			<td class="main"><?php echo tep_draw_input_field('email_address') . '?' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
<?php
 if (ACCOUNT_COMPANY == 'true') {
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td class="main"><b><?php echo CATEGORY_COMPANY; ?></b></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" cellspacing="2" cellpadding="2">
		  <tr>
			<td class="main"><?php echo ENTRY_COMPANY; ?></td>
			<td class="main"><?php echo tep_draw_input_field('company') . '?' . (tep_not_null(ENTRY_COMPANY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
<?php
 }
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td class="main"><b><?php echo CATEGORY_ADDRESS; ?></b></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" cellspacing="2" cellpadding="2">
		  <tr>
			<td class="main"><?php echo ENTRY_STREET_ADDRESS; ?></td>
			<td class="main"><?php echo tep_draw_input_field('street_address') . '?' . (tep_not_null(ENTRY_STREET_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_STREET_ADDRESS_TEXT . '</span>': ''); ?></td>
		  </tr>
<?php
 if (ACCOUNT_SUBURB == 'true') {
?>
		  <tr>
			<td class="main"><?php echo ENTRY_SUBURB; ?></td>
			<td class="main"><?php echo tep_draw_input_field('suburb') . '?' . (tep_not_null(ENTRY_SUBURB_TEXT) ? '<span class="inputRequirement">' . ENTRY_SUBURB_TEXT . '</span>': ''); ?></td>
		  </tr>
<?php
 }
?>
			<tr>
			<td class="main"><?php echo ENTRY_CITY; ?></td>
			<td class="main"><?php echo tep_draw_input_field('city') . '?' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?></td>
		  </tr>
<?php
 if (ACCOUNT_STATE == 'true') {
?>
		  <tr>
			<td class="main"><?php echo ENTRY_STATE; ?></td>
			<td class="main">
<?php
// +Country-State Selector
	$zones_array = array();
	 $zones_query = tep_db_query("select zone_id, zone_name from " . TABLE_ZONES . " where zone_country_id = " . (int)$country . " order by zone_name");
	while ($zones_values = tep_db_fetch_array($zones_query)) {
	  $zones_array[] = array('id' => $zones_values['zone_id'], 'text' => $zones_values['zone_name']);
	}
	if (count($zones_array) > 0) {
	  echo tep_draw_pull_down_menu('zone_id', $zones_array);
	} else {
	  echo tep_draw_input_field('state');
	}
// -Country-State Selector
if (tep_not_null(ENTRY_STATE_TEXT)) echo '?<span class="inputRequirement">' . ENTRY_STATE_TEXT;

?>
			</td>
		  </tr>
<tr>
			<td class="main"><?php echo ENTRY_POST_CODE; ?></td>
			<td class="main"><?php echo tep_draw_input_field('postcode') . '?' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>
		  </tr>
<?php
 }
?>
		  <tr>
			<td class="main"><?php echo ENTRY_COUNTRY; ?></td>
			<?php // +Country-State Selector ?>
			<td class="main"><?php echo tep_get_country_list('country',$country,'onChange="return refresh_form(create_account);"') . '?' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>
			<?php // -Country-State Selector ?>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td class="main"><b><?php echo CATEGORY_CONTACT; ?></b></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" cellspacing="2" cellpadding="2">
		  <tr>
			<td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
			<td class="main"><?php echo tep_draw_input_field('telephone') . '?' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
		  </tr>
		  <tr>
			<td class="main"><?php echo ENTRY_FAX_NUMBER; ?></td>
			<td class="main"><?php echo tep_draw_input_field('fax') . '?' . (tep_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <?php echo tep_draw_hidden_field("password","DummyForPWA") . tep_draw_hidden_field("confirmation","DummyForPWA"); ?>
  </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><?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>
</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 include(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php include(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

Tim,

 

Thanks for all your assistance. I found the problem. Duh! After I commented out the check as you suggested in an earlier email, unfortunately I chose an account that was NOT a "PWA" account. So, of course, it didn't work correctly. Commenting out the check does work for PWA accounts.

 

You've been a great help!

 

By the way, what's your trick on successfully searching the forum for topics? The forum has a lot of good information, but sometimes I just can't seem to find the information I'm looking for. It can be overwhelming.

 

Thanks again.

Link to comment
Share on other sites

I read through some more posts and have implemented this change:

in order_info.php, find this code near the top

$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
	} else {
	  $check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
	 $check_email = tep_db_fetch_array($check_email_query);
	  if ($check_email['total'] > 0) {
		$error = true;

Change to this

$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
	} else {
	  $check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
	  //$check_email = tep_db_fetch_array($check_email_query);
	  if ($check_email['total'] > 0) {
		$error = true;

Now PWA customers can use any email address they want over and over. The downside is they can use an e-mail that is already being used by an account holder and there is no error. Does someone know of a better way to fix this problem? I have looked over several of the files in the contribution and none of them havce any of these checks commented out.

 

Tim

 

$check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "' and purchased_without_account = 0");

 

that will only select normal registered email accounts and thus give an error when trying to use that.

pwa accounts with that email address are ignored.

Treasurer MFC

Link to comment
Share on other sites

Tim,

 

By the way, what's your trick on successfully searching the forum for topics? The forum has a lot of good information, but sometimes I just can't seem to find the information I'm looking for. It can be overwhelming.

 

Thanks again.

I have never found a good way of searching the forums. It is only by going through each post until I glean enough info to make a decision. I have several unresolved issues at this point. Fortunately they are all minor.

 

I sure hope someone will reply to this thread with a better solution than what I posted.

 

Tim

 

 

edit:

Boxtel, I was typing my reply while you were posting yours. I will try the code you posted and let everyone know how it worked for me. Thanks!

Edited by knifeman
Link to comment
Share on other sites

$check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "' and purchased_without_account = 0");

 

that will only select normal registered email accounts and thus give an error when trying to use that.

pwa accounts with that email address are ignored.

That works wonderfully. I hope the authors will incorporate this line of code into the current release.

 

Thanks for the code Boxtel.

Link to comment
Share on other sites

I just intalled PWA and replaced the code in checkout_process.php on line 226 as per the setup instructions in order to remove the link in the invoice sent to the customer. But the link is still in the email. I made a test purchase through PWA.

 

This is the code that was changed:

 

	EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .

changed to:

			 (($customers_id === '0')? '':EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n") .

 

Anyone know how I can remove the detailed invoice link in the PWA email?

Link to comment
Share on other sites

I am having the same issue. I checked out using PWA. Did not create account. Then if I try to place another order using the same e-mail address, I get the same error that clearasmud is getting. I have just updated my PWA to version: 'Version 0.910 - Update'

 

Tim

 

Hmmm...im half puzzled. I cant replicate this issue with my shop.

 

Tell me this....if you start a checkout with PWA and abandon it......then later try to do PWA with the same email address, do you get the problem?

 

I realize Boxtel gave you some code that helped, but im wondering why my shop isnt having the same issue as you guys were before. Just want to make sure I dont have the same problem :thumbsup:

Link to comment
Share on other sites

Boxtel- I edited the header.php file to display the LOGOFF link for both registered and PWA customers. Is there a way so that if a person starts a checkout using PWA and then clicks LOGOFF that all their info they entered would be deleted(just like if they completed checkout)?

 

Thanks for any help :)

Link to comment
Share on other sites

Boxtel- I edited the header.php file to display the LOGOFF link for both registered and PWA customers. Is there a way so that if a person starts a checkout using PWA and then clicks LOGOFF that all their info they entered would be deleted(just like if they completed checkout)?

 

Thanks for any help :)

 

well, you can but why would you? that info is already being deleted if they checkout again (input their order info) and use the same email address, the facility especially deployed for those PWA's who do not complete checkout.

Treasurer MFC

Link to comment
Share on other sites

Hmmm...im half puzzled. I cant replicate this issue with my shop.

 

Tell me this....if you start a checkout with PWA and abandon it......then later try to do PWA with the same email address, do you get the problem?

Not sure about that. My problem was someone actually completeing a pwa order, then coming back to buy more at a later date. Their e-mail would be remebered and they could not use pwa a second time. The code from Boxtel fixed it quite nicely.

Link to comment
Share on other sites

Is there a way so that if a person starts a checkout using PWA and then clicks LOGOFF that all their info they entered would be deleted

I am curious, what percent of the PWA customers, do you estimate will use the log off button rather than just closing their browser?

 

Tim

Link to comment
Share on other sites

I am curious, what percent of the PWA customers, do you estimate will use the log off button rather than just closing their browser?

 

Tim

 

I can only imagine if someone enters order info data like name or address or phonenumber incorrectly and spots that before completing the order. Then Sign Off is a good means of clearing that stuff. and if you do not reset the cart in that action, even that contents remains.

Treasurer MFC

Link to comment
Share on other sites

well, you can but why would you? that info is already being deleted if they checkout again (input their order info) and use the same email address, the facility especially deployed for those PWA's who do not complete checkout.

 

Well, if they exit without purchasing then you have another cusotmer account created. If they never come back, its just wasted info in your database. Plus the whole idea of PWA is to not create an account.....what if I do a newsletter....will the abondoned PWA accounts get a copy? If yes, im sure they wont be happy since they didnt want to create an account with your store in the first place.

 

And im unsuse why.....but when a customer comes back and uses the same email they originally did during their first PWA session(in which they didnt complete checkout) it creates ANOTHER account in my store.....it does not delete the info from the first PWA session or write over it. Does the customer have to checkout the second time for it to erase both or....? Basically if a customer would be browsing and adds stuff to the cart with PWA and leaves.....each time they do so it creates another customer account, even if they use the same email address.

Link to comment
Share on other sites

Well, if they exit without purchasing then you have another cusotmer account created. If they never come back, its just wasted info in your database. Plus the whole idea of PWA is to not create an account.....what if I do a newsletter....will the abondoned PWA accounts get a copy? If yes, im sure they wont be happy since they didnt want to create an account with your store in the first place.

 

And im unsuse why.....but when a customer comes back and uses the same email they originally did during their first PWA session(in which they didnt complete checkout) it creates ANOTHER account in my store.....it does not delete the info from the first PWA session or write over it. Does the customer have to checkout the second time for it to erase both or....? Basically if a customer would be browsing and adds stuff to the cart with PWA and leaves.....each time they do so it creates another customer account, even if they use the same email address.

 

well, sure, you need to separate pwa accounts from regular accounts at all times, also when issueing newsletters. But since you cannot force anyone to use the sign off function, that account may be in your records whether you have that function or not.

 

The normal (should be) logic for pwa with regard to account removal is as such (if I remember correctly as my version is pretty old and somewhat modified):

 

if complete checkout -> remove the account

 

if create REG account ->

if email address exists in a PWA account -> remove that account

if email address exists in a REG account -> error message ->use signin

process as normal

 

if entering PWA order info ->

if email address exists in a PWA account -> remove that account

if email address exists in a REG account -> error message -> use signin

 

3 locations where the account is removed, that should be enough.

Treasurer MFC

Link to comment
Share on other sites

if entering PWA order info ->

if email address exists in a PWA account -> remove that account

if email address exists in a REG account -> error message -> use signin

 

that doesnt seem to be true for me.

 

'if email address exists in a PWA account -> remove that account'- doesnt remove account, creates new one.

 

'if email address exists in a REG account -> error message -> use signin'- this feature does work, but more then teh email needs to match....I think 3 things have to match(like name, town and email).

Link to comment
Share on other sites

that doesnt seem to be true for me.

 

'if email address exists in a PWA account -> remove that account'- doesnt remove account, creates new one.

 

'if email address exists in a REG account -> error message -> use signin'- this feature does work, but more then teh email needs to match....I think 3 things have to match(like name, town and email).

 

1) that is then not correct, it should delete the existing one and yes create a new one.

 

2) also strange as the email address is unique (not in the database but global) so I see no need or desire to have also name and town match as people will later signin with the email address alone.

 

I would change that logic.

Treasurer MFC

Link to comment
Share on other sites

I think I located the issue. In version .91 primadude addressed this. The only problem is that it was only done in the order_info file located in the main install folder, not the order_info files in the extras folder. Im using country state selector and used the order_info located there which didnt have the fix applied.

 

In my order_info.php I have:

// PWA 0.70 : SELECT using new method of determining a customer has purchased without account:
		$check_customer_query = tep_db_query("select customers_id, purchased_without_account, 
			customers_firstname, customers_password, customers_email_address,
			customers_default_address_id from " . TABLE_CUSTOMERS . "
			where upper(customers_email_address) = '" . strtoupper($HTTP_POST_VARS['email_address']) . "' and
			upper(customers_firstname) = '" . strtoupper($HTTP_POST_VARS['firstname']) . "' and
			upper(customers_lastname) = '" . strtoupper($HTTP_POST_VARS['lastname']) . "'");

 

instead of:

// PWA 0.910 : SELECT using new method of determining a customer has purchased without account:
		$check_customer_query = tep_db_query("select customers_id, purchased_without_account,
		   customers_password, customers_email_address,
		   customers_default_address_id from " . TABLE_CUSTOMERS . "
		   where upper(customers_email_address) = '" . strtoupper($HTTP_POST_VARS['email_address']) . "'");

 

Think that is the only fix I need for the issue of needing to have 3 things match instead of just the email? Ill test it out shortly. Im not sure where to fix the other issue of the first PWA account being deleted if the same email address is used again for PWA.....think this same section of code will take care of that as well?

Link to comment
Share on other sites

OK, the above looks like it corrected both issues. Now all of the below is happening:

 

if complete checkout -> remove the account

 

if create REG account ->

if email address exists in a PWA account -> remove that account

if email address exists in a REG account -> error message ->use signin

process as normal

 

if entering PWA order info ->

if email address exists in a PWA account -> remove that account

if email address exists in a REG account -> error message -> use signin

 

:)

Link to comment
Share on other sites

Has anyone figured out how to add the functionality to change the shipping address so that users can ship to an address other than the billing address?

 

I've installed the contribution and it works great, except that we get a lot of users who want to ship to an address other than they're own and they can't.

 

I've seen a number of posts about this issue, but none that offered a solution. My client is seeing red because she's losing sales, Help! :(

Link to comment
Share on other sites

Has anyone figured out how to add the functionality to change the shipping address so that users can ship to an address other than the billing address?

 

I've installed the contribution and it works great, except that we get a lot of users who want to ship to an address other than they're own and they can't.

 

I've seen a number of posts about this issue, but none that offered a solution. My client is seeing red because she's losing sales, Help! :(

It works on my test shop. I don't know why it doesn't work on yours. It should just bring up the

catalog\includes\modules\checkout_new_address.php file like it does for account holders.

Link to comment
Share on other sites

It works on my test shop. I don't know why it doesn't work on yours. It should just bring up the

catalog\includes\modules\checkout_new_address.php file like it does for account holders.

 

Hi Leslie, thanks for your response!

 

Well, the contribution said to change line 231 in checkout_shipping.php from:

<td class="main" width="50%" valign="top"><?php echo TEXT_CHOOSE_SHIPPING_DESTINATION . '<br><br><a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '">' . tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '</a>'; ?></td>

 

to:

<td class="main" width="50%" valign="top"><?php echo (($customer_id==='0')? ' ':TEXT_CHOOSE_SHIPPING_DESTINATION . '<br><br><a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '">' . tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '</a>'); ?></td>

 

And you can see in the code there that if the customer is a guest account ($customer_id==='0') nothing will be put on the screen to change the shipping address. Which means you end up with only one possible address to use for shipping and billing.

 

Here's a link to the site I'm working on, and you can see that there is no option to ship to a different address other than the billing address.

 

https://www.erikmenendez.com/shop/login2.php

 

Maybe you figured out some way around this?

Link to comment
Share on other sites

Maybe you figured out some way around this?

 

Just don't apply the change you mentioned. What version of PWA are you using?

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...