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

Use E-mail address instead of username 3.5.x & 4.0
 
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features
 
Thread Tools Search this Thread
  #21  
Old 04-01-2005, 06:12 PM
 
Speedmaster Speedmaster is offline
 

Newbie
  
Join Date: Apr 2005
Posts: 3
 

Default

x-light,

It looks like this mod still allows anonymous checkout? How can a returning customer checkout anonymously if the email field is unique?

Also, let me know if I am understanding this correctly. When a customer enters his/her info during checkout, your mod creates the customer if the email is unique, but deletes it if it finds out the customer is checking out anonymously?

One more thing, our store has been live for a while so we have some customers. The last time I checked, we have up to 800 customers who have anonymously checked out more than once (in other words, we have a lot of duplicate emails). How can we remove or handle those?

Thanks.
__________________
3.5.10
Reply With Quote
  #22  
Old 04-03-2005, 12:38 PM
 
x-light x-light is offline
 

Member
  
Join Date: Mar 2005
Posts: 29
 

Default

Hi Speedmaster,

Quote:
It looks like this mod still allows anonymous checkout? How can a returning customer checkout anonymously if the email field is unique?

That's a good question. This relates to your second question. When a customer checks out anonymously, the mod will check to see if a his/her email exist in the customers table. If it does exist and it belongs to an anonymous user, it will first delete that specific record and create a new one with that email. However, if the email exist and it belongs to an registered user, the mod will set the eerror and an duplicate email error will be returned to the user. This should be safe since anonymous users only log in to place an order once and if they do place an order, a seperate order record is placed in the orders table.

Quote:
Also, let me know if I am understanding this correctly. When a customer enters his/her info during checkout, your mod creates the customer if the email is unique, but deletes it if it finds out the customer is checking out anonymously?

Actually, it only creates the record when the following is true as shown in the above answer.

Quote:
One more thing, our store has been live for a while so we have some customers. The last time I checked, we have up to 800 customers who have anonymously checked out more than once (in other words, we have a lot of duplicate emails). How can we remove or handle those?

Well I don't know exaclty what you want to do with this. However, if I understand you correctly, it sounds like you want to remove records that has duplicate emails. I think what you may need is a custom script which access the customers table outside x-cart and do some logic checking. However, since you are running a live store, I would definitely backup your entire database just in case if the script deletes the wrong records. You can whip up a script which retreives all anonymous customers from the customer table do perform the following logic:

1. store each records with with same email in an list of arrays
2. compare to see if the first_login time is newer than the previous one if exist if, so keep this record, else delete this record (this ensures that the emails should be most recent after all duplicate is removed)

That should be it, after you run a script which perform these logic, your customer table should have no duplicate emails along with the latest first_login time for each of them. Hope this helps.

~x-light
[/code]
__________________
X-Cart 4.xx Gold
Enterprise Linux
Reply With Quote
  #23  
Old 04-03-2005, 06:34 PM
 
Grumpy Grumpy is offline
 

Member
  
Join Date: Jan 2005
Location: Australia
Posts: 26
 

Default Email Address

OK, so what happens when the user changes their email address? I think a user name is a far simpler approach. Also easier to log in with.
__________________
GerryB
Xcart 4.0.11
____________
Remember not to forget that which you do not need to know.
Reply With Quote
  #24  
Old 04-04-2005, 11:49 AM
 
Speedmaster Speedmaster is offline
 

Newbie
  
Join Date: Apr 2005
Posts: 3
 

Default

x-light,

Thanks for the info. I'm going to go work on this now.
__________________
3.5.10
Reply With Quote
  #25  
Old 04-22-2005, 06:07 AM
 
phil_ phil_ is offline
 

Advanced Member
  
Join Date: Feb 2003
Location: Northern Ireland
Posts: 56
 

Default

Did anyone get the x-light code implemented for the 3.5x branch? I would really like this mod, but as soon as I changed the code to use 'func_query_first cell' it seemes to fall down.
__________________
-----------------------------------------
X-Cart5 v5.2.16 (Live)
-----------------------------------------
Reply With Quote
  #26  
Old 04-22-2005, 11:05 AM
 
Lingerieblowout Lingerieblowout is offline
 

X-Adept
  
Join Date: Sep 2003
Location: Annapolis, MD
Posts: 415
 

Default

Has anyone done this mod for 3.4.x ??
__________________
http://www.lingerieblowout.com
Version 4.1.10

http://www.topnichewebsites.com
Version 4.4.5

Michael
Reply With Quote
  #27  
Old 04-22-2005, 09:12 PM
 
usiripakdi usiripakdi is offline
 

Advanced Member
  
Join Date: Jan 2005
Posts: 47
 

Default

Has anyone modify it in 4.13? Any problems?
I think register.php in /include is a bit different.
__________________
Siripakdi
Version 4.0.13
Reply With Quote
  #28  
Old 04-23-2005, 12:38 AM
 
x-light x-light is offline
 

Member
  
Join Date: Mar 2005
Posts: 29
 

Default

Hi all,

I am glad to hear some feedbacks about this mod.

Quote:
Did anyone get the x-light code implemented for the 3.5x branch? I would really like this mod, but as soon as I changed the code to use 'func_query_first cell' it seemes to fall down.

Code:
Has anyone done this mod for 3.4.x ??

hey guys, unfortunately I don't have v3.4.x or 3.5x release so I would not know how much work is required to make it compatible. I only have v4.0.12 and v4.0.13 release. Also, I have been working on other mods to customize my store so I won't have too much time in looking at this. Hopefully, someone out there with your versions finds this mod useful and make the proper modifications. Good luck.

Quote:
Has anyone modify it in 4.13? Any problems?
I think register.php in /include is a bit different.

hello usiripakdi, actually, I switched from v4.0.12 to v4.0.13 so I have the updated code. There isn't much difference between these 2 versions as far as the mod is concerned. Here is the updated code.

------------------------------------
include/register.php v3

Code:
# mod1 # find original code snippet # # User registration info passed to register.php via POST method # $existing_user = func_query_first("select password, email from $sql_tbl[customers] where login='$uname'"); if (empty($existing_user)) { $existing_user = func_query_first("SELECT login FROM $sql_tbl[orders] WHERE login='$uname'"); } # end original code snippet # replace modified code snippet # # User registration info passed to register.php via POST method # $existing_user = func_query_first("select password, email from $sql_tbl[customers] where login='$uname'"); if (empty($existing_user)) { $existing_user = func_query_first("SELECT login FROM $sql_tbl[orders] WHERE login='$uname'"); # mod.use.email.rather.username # generate unique id number as username since email is used as unique key in customers and order table # only for non-anonymous users if( !$anonymous_user ){ for( $i=0; $i<3; $i++ ){ $u_tmp = uniqid(rand()); if( $login != $u_tmp ) break; } $uname = $u_tmp; } } # end modified code snippet # mod2 # find original code snippet if (!(@$uerror || @$eerror || @$fillerror || @$error)) { # # Fields filled without errors. User registered successfully # $crypted = addslashes(text_crypt($passwd1)); # end original code snippet # replace modified code snippet # mod.use.email.rather.username if(!$fillerror) { # check if email already exist in customers table $email = strtolower($email); if( $email == func_query_first_cell("select email from $sql_tbl[customers] where email='$email'")) { # duplicate email not allowed $eerror = true; } # exception checks to this rule if( $mode != "update") { # check if this is anonymous registration during checkout if( $eerror && func_query_first_cell("select status from $sql_tbl[customers] where email='$email' and usertype='C'") == 'A' ) { # delete this record since the user is anonymous requesting the same email # we can't assume that the email belongs to the user, but at least this way # the original user can use his/her same email to register again anonymously during another checkout # if an anonymous user already placed an order with this email, it will not effect the orders table # since it is a seperate record # note, if the user is already registered, we will never allow to automatically delete the registered user's record db_query("DELETE FROM $sql_tbl[customers] WHERE login LIKE 'anonymous%' AND email='$email' and usertype='C' AND status='A'"); # this is not an error since we have deleted this record $eerror = false; } } else { if( $email == func_query_first_cell("select email from $sql_tbl[customers] where login='$login' and email='$email'")) { # email match, user did not change email $eupdate = false; # this is not an error since the existing email belong to this user $eerror = false; } else { # email does not match, see if new requested email is taken if( !$eerror ) $eupdate = true; } } } // mod.use.email.rather.username if (!(@$uerror || @$eerror || @$fillerror || @$error)) { # # Fields filled without errors. User registered successfully # $crypted = addslashes(text_crypt($passwd1)); # end modified code snippet # mod3 # find original code snippet # # Update/Insert user info # if ($mode=="update") { $intershipper_recalc = "Y"; db_query("UPDATE $sql_tbl[customers] SET password='$crypted', password_hint='$password_hint', password_hint_answer='$password_hint_answer', title='$title', firstname='$firstname', lastname='$lastname', company='$company', b_address='".$b_address."\n".$b_address_2."', b_city='$b_city', b_county='".(@$b_county)."', b_state='$b_state', b_country='$b_country', b_zipcode='$b_zipcode', s_address='".$s_address."\n".$s_address_2."', s_city='$s_city', s_county='".(@$s_county)."', s_state='$s_state', s_country='$s_country', s_zipcode='$s_zipcode', phone='$phone', email='$email', fax='$fax', url='$url', card_name='$card_name', card_type='$card_type', card_number='".addslashes(text_crypt($card_number))."', card_expire='$card_expire', card_cvv2='$card_cvv2', pending_membership='$pending_membership', ssn='$ssn', change_password='$change_password', parent = '$parent', pending_plan_id = '$pending_plan_id' WHERE login='$login' AND usertype='$login_type'"); # end original code snippet # replace modified code snippet # # Update/Insert user info # if ($mode=="update") { $intershipper_recalc = "Y"; # mod.use.email.rather.username # update email only if eupdate is true if( !$eupdate ) db_query("UPDATE $sql_tbl[customers] SET password='$crypted', password_hint='$password_hint', password_hint_answer='$password_hint_answer', title='$title', firstname='$firstname', lastname='$lastname', company='$company', b_address='".$b_address."\n".$b_address_2."', b_city='$b_city', b_county='".(@$b_county)."', b_state='$b_state', b_country='$b_country', b_zipcode='$b_zipcode', s_address='".$s_address."\n".$s_address_2."', s_city='$s_city', s_county='".(@$s_county)."', s_state='$s_state', s_country='$s_country', s_zipcode='$s_zipcode', phone='$phone', fax='$fax', url='$url', card_name='$card_name', card_type='$card_type', card_number='".addslashes(text_crypt($card_number))."', card_expire='$card_expire', card_cvv2='$card_cvv2', pending_membership='$pending_membership', ssn='$ssn', change_password='$change_password', parent = '$parent', pending_plan_id = '$pending_plan_id' WHERE login='$login' AND usertype='$login_type'"); else db_query("UPDATE $sql_tbl[customers] SET password='$crypted', password_hint='$password_hint', password_hint_answer='$password_hint_answer', title='$title', firstname='$firstname', lastname='$lastname', company='$company', b_address='".$b_address."\n".$b_address_2."', b_city='$b_city', b_county='".(@$b_county)."', b_state='$b_state', b_country='$b_country', b_zipcode='$b_zipcode', s_address='".$s_address."\n".$s_address_2."', s_city='$s_city', s_county='".(@$s_county)."', s_state='$s_state', s_country='$s_country', s_zipcode='$s_zipcode', phone='$phone', email='$email', fax='$fax', url='$url', card_name='$card_name', card_type='$card_type', card_number='".addslashes(text_crypt($card_number))."', card_expire='$card_expire', card_cvv2='$card_cvv2', pending_membership='$pending_membership', ssn='$ssn', change_password='$change_password', parent = '$parent', pending_plan_id = '$pending_plan_id' WHERE login='$login' AND usertype='$login_type'"); # end modified code snippet

~x-light
__________________
X-Cart 4.xx Gold
Enterprise Linux
Reply With Quote
  #29  
Old 04-23-2005, 01:54 AM
 
usiripakdi usiripakdi is offline
 

Advanced Member
  
Join Date: Jan 2005
Posts: 47
 

Default

Thanks X-light
__________________
Siripakdi
Version 4.0.13
Reply With Quote
  #30  
Old 06-30-2005, 11:40 PM
  2019's Avatar 
2019 2019 is offline
 

Advanced Member
  
Join Date: Dec 2004
Posts: 76
 

Default

passing to 4.0.14 any code changes?
updated and all my custom work fly away closed to shop to fix them out

for example register.php in root is different on 4.0.14

x-light hear my cry
__________________
// x-cart 4.1.9

X-CART CSS SKIN
XC SEO
IP Addresses in Users Online for all users
Color coded order status
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 08:50 AM.

   

 
X-Cart forums © 2001-2018