Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Trying to always use cust email as user ID....

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-28-2004, 05:55 AM
 
pipercub pipercub is offline
 

Advanced Member
  
Join Date: Oct 2002
Posts: 82
 

Default Trying to always use cust email as user ID....

Many sites use the customer email address as their userID. Can anyone offer any insight as to how I can eliminate the 'Username' field on the registration form and ALWAYS have xcart use the customer email address?

Thanks,
Piper
__________________
x-cart 3.4.4 (UNIX)
Reply With Quote
  #2  
Old 07-28-2004, 06:59 AM
 
xcell67 xcell67 is offline
 

Senior Member
  
Join Date: Dec 2003
Posts: 149
 

Default

In 3.5.x, I tried fiddling with include/register.php and made $uname=$email, and commented out the username field in skin1/customer/main/register.tpl.

I thought it worked but when I tried changing the user id, an sql error occured. I remember reading a thread where someone had done it before, I hope that person pops up again on this thread.
Reply With Quote
  #3  
Old 07-28-2004, 09:10 AM
 
pipercub pipercub is offline
 

Advanced Member
  
Join Date: Oct 2002
Posts: 82
 

Default

When you say change $uname=$email, what section in register.php did you change this in? I had searched register.php for a while before posting here, but I could not find the exact places to edit.

however, I did find the following bit of code that may resolve the SQL error.

In register.php, search for

Code:
# # Add new person to customers table #

Just below those lines, are the lines of code that query the DB.

In that chunk, change:
Code:
$uname
to
Code:
$email

Meanwhile, if you could give me some more detail on where you changed your code, we might be able to piece this together!

Thanks,
Piper
__________________
x-cart 3.4.4 (UNIX)
Reply With Quote
  #4  
Old 07-28-2004, 02:11 PM
 
xcell67 xcell67 is offline
 

Senior Member
  
Join Date: Dec 2003
Posts: 149
 

Default

Hi Piper,

First I modified this code for 3.5.6:

Code:
# # Check for errors # $uname_tmp=stripslashes($uname); if ( strcmp($uname_tmp, $uname) !=0) {$error="Username ".$uname_tmp." is invalid! Please correct"; } else $error=''; $smarty->assign("error",$error); $fillerror = (empty($uname) || !empty($error) || empty($passwd1) || empty($passwd2) || ($passwd1 != $passwd2) || empty($firstname) || empty($lastname) || empty($b_address) || empty($b_city) || (!empty($states) && empty($b_state)) || empty($b_country) || empty($b_zipcode) || empty($phone) || empty($email)); $fillerror |= ($emailerror = !func_check_email($email)); if (!(@$uerror || @$eerror || @$fillerror || @$error)) {

I took out $uname=tmp check and also the empty($unamee) in $fillerror.

so the code became this:

Code:
# # Check for errors # $smarty->assign("error",$error); $fillerror = (empty($passwd1) || empty($passwd2) || ($passwd1 != $passwd2) || empty($firstname) || empty($lastname) || empty($b_address) || empty($b_city) || (!empty($states) && empty($b_state)) || empty($b_country) || empty($b_zipcode) || empty($phone) || empty($email)); $fillerror |= ($emailerror = !func_check_email($email)); if (!(@$uerror || @$eerror || @$fillerror || @$error)) {

I did this so the cart wouldn't record an error if the username wasn't submitted.

Then I altered:

Code:
# # Fields filled without errors. User registered successfully # $crypted = text_crypt($passwd1); $s_address = trim($s_address); $s_city = trim($s_city); $s_zipcode = trim($s_zipcode); if (empty($s_address) && empty($s_city) && empty($s_zipcode)) { $s_state = $b_state; $s_country = $b_country; } if (empty($s_address)) $s_address = $b_address; if (empty($s_city)) $s_city = $b_city; if (empty($s_zipcode)) $s_zipcode = $b_zipcode;

At the bottom I entered

if (empty($uname)) $uname= $email;

I did this so the cart would automatically fill the empty username field with the email address.

I left the Add New/ and Update customer tables alone. Let me know if you figure it all out.
Reply With Quote
  #5  
Old 07-29-2004, 05:57 PM
 
mizzlewillz mizzlewillz is offline
 

Advanced Member
  
Join Date: Apr 2004
Posts: 45
 

Default E-mail as Username

I've been wanting to do this for awhile. Thanks for the post.

I just tried your method in X-Cart 4.0.1 and it works... One question though.

How do you deal with someone that changes their e-mail. The way you have it, without touching other parts of register.php when you change your e-mail your old e-mail (username) stays the same.

General Question: If you were to use e-mail as your username, would it mess up the orders history for that particular person when they change their e-mail (username)?

-Mike
Reply With Quote
  #6  
Old 07-30-2004, 12:42 AM
 
xcell67 xcell67 is offline
 

Senior Member
  
Join Date: Dec 2003
Posts: 149
 

Default

Mike,
The problem you just mentioned is the reason why I don't use the mod for my own shops. I was hoping that someone else knew the solution, but no one wants to share
Reply With Quote
  #7  
Old 07-31-2004, 12:58 PM
 
mizzlewillz mizzlewillz is offline
 

Advanced Member
  
Join Date: Apr 2004
Posts: 45
 

Default

Just to add an additional comment. I was thinking of keeping the username, but also allow the Customer to login using either their e-mail or their username. One company that does that is textbookx.com which sells books. I think that way, the Customer can alter their e-mail all they want, and they don't have to worry about remembering a username.

This may seem ridiculous, but at the moment it is the only way I can think of for allowing the Customer to use their e-mail to login.

This would be a nice feature for the X-Cart team to put into their product. And to please everyone just have checkbox so you can turn the feature on and off, but that would probably cause a problem if you switch back and forth from the two methods.

Just my thoughts.

-Mike
Reply With Quote
  #8  
Old 08-31-2004, 10:25 AM
  thundernugs's Avatar 
thundernugs thundernugs is offline
 

Senior Member
  
Join Date: May 2003
Location: Bend, OR
Posts: 117
 

Default

http://forum.x-cart.com/viewtopic.php?t=12126
__________________
X-Cart Gold 4.0.17 & 4.0.18
Linux Server
Hands-On Hosting
http://www.CoreCases.com - Ipod Cases
http://www.InnovativeOutlet.com - Pet Plants and other cool stuff you need
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:16 AM.

   

 
X-Cart forums © 2001-2020