About Club osCommerce

Showcasing osCommerce – the good, the bad and the ugly!

StumbleUpon It! DIGG It!

Remove the Password in osCommerce

Written By Gary on Apr 24 2009 · Comments (1)

When a person elects to buy from your shop the first time, they are presented with a "create_account" page, on which they fill out some details about themselves. For years I've been teaching people to rename this page, and simplify it.

It's frightening for a potential buyer to have to give so much information, I think. So, you can easily change the words "create account" to "your details for delivery" or somesuch. You can also remove some of the fields that are not needed (such as date of birth, fax number and others).

How about removing the password fields?

Doing this make the whole page less intimidating, and is very easy to do...

Step 1. Open up create_account.php

Find this:

PHP:
  1. $password = tep_db_prepare_input($HTTP_POST_VARS['password']);
  2. $confirmation = tep_db_prepare_input($HTTP_POST_VARS['confirmation']);

Change to:

PHP:
  1. $password = tep_create_random_value(10);
  2. $confirmation = $password

Here we are saying, set the password to a random value of 10 characters, and set the confirmation the same!

Step 2: In the same file

Find this:

PHP:
  1. $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;

This creates the "welcome email" that is sent to the user. We need to add in a short message here to tell them what their new password is. So change it to:

PHP:
  1. $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
  2. $email_text .= sprintf(EMAIL_PASSWORD, $password);

I have used a new text definition called "EMAIL_PASSWORD", so this must be added to the language file...

Step 3: Add the definition to the create_account language file

Open up /includes/languages/{language}/create_account.php and add this:

PHP:
  1. define('EMAIL_PASSWORD', 'Your password for all future orders is %s - please keep this password safe!');

Step 4: Back to create_account.php

Remove the password and confirmation input box by finding this:

PHP:
  1. <tr>
  2.         <td class="main"><b><?php echo CATEGORY_PASSWORD; ?></b></td>
  3.       </tr>
  4.       <tr>
  5.         <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
  6.           <tr class="infoBoxContents">
  7.             <td><table border="0" cellspacing="2" cellpadding="2">
  8.               <tr>
  9.                 <td class="main"><?php echo ENTRY_PASSWORD; ?></td>
  10.                 <td class="main"><?php echo tep_draw_password_field('password') . '&nbsp;' . (tep_not_null(ENTRY_PASSWORD_TEXT) ? '<span class="inputRequirement">' . ENTRY_PASSWORD_TEXT . '</span>': ''); ?></td>
  11.               </tr>
  12.               <tr>
  13.                 <td class="main"><?php echo ENTRY_PASSWORD_CONFIRMATION; ?></td>
  14.                 <td class="main"><?php echo tep_draw_password_field('confirmation') . '&nbsp;' . (tep_not_null(ENTRY_PASSWORD_CONFIRMATION_TEXT) ? '<span class="inputRequirement">' . ENTRY_PASSWORD_CONFIRMATION_TEXT . '</span>': ''); ?></td>
  15.               </tr>
  16.             </table></td>
  17.           </tr>
  18.         </table></td>
  19.       </tr>
  20.       <tr>
  21.         <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  22.       </tr>

Simply remove it all.

DONE! Now there is no password input boxes. The password is automatically created and emailed to the new client in the "welcome email".

Going further

What you could now do is log the new customer off, and force them to check their email in order to get the password to log in. This might be a step too far, but I'll show you the basics of how to do it;

Step 5: Redirect to logoff.php

In create_account.php, find this:

PHP:
  1. tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));

Change to:

PHP:
  1. tep_redirect(tep_href_link(FILENAME_LOGOFF, '', 'SSL'));

On the "log out" page you will need to have a message saying "check your email to log back in". I'll cover that in a future post.

This could be a good way of weeding out buyers that are not really buyers, and those who insertt fake email addresses.


Buy Gary A Beer?
Buying me a "beer" helps me to keep my contributions updated and keep this blog alive. Cheers!


1 Comment

  1. That's a great tip which is sure to enhance the user experience. I think it will be really worth taking that extra time to do this for future clients.

    Thanks!

    Comment by Adam Gersbach — April 24, 2009 @ 3:24 pm


Leave a comment

RSS feed for comments on this post · TrackBack URL

Hot 100 osCommerce Shops

View the osCommerce HOT 100These are the best looking, most exceptional osCommerce Stores as voted for by you.

New to osCommerce - get inspiration from these beautiful shops. Reckon your site has what it takes to become a member of the HOT 100? Submit it!