View Single Post
  #14  
Old 05-21-2010, 03:33 AM
 
Learner Learner is offline
 

X-Adept
  
Join Date: Dec 2008
Posts: 807
 

Default Re: Added field in registration

Quote:
Originally Posted by Kanyon71
Well I added a How did you hear about us to the registration process. Used some code I had found in other posts, I also added fields to my email's for siginin and modify for users. This is pretty much what I did:

First: Added the new field to the database using myphpadmin

Code:
ALTER TABLE `xcart_customers` ADD `referred` VARCHAR(255) NOT NULL;

Next: I added a new label - lbl_referrer

Next: I modified my include/register.php

Code:
Original code: # # 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', b_city='$b_city', b_state='$b_state', b_country='$b_country', b_zipcode='$b_zipcode', s_address='$s_address', s_city='$s_city', 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='".text_crypt($card_number)."', card_expire='$card_expire', card_cvv2='$card_cvv2', pending_membership='$pending_membership', ssn='$ssn' where login='$login' and usertype='$login_type'"); New Code: # # 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', b_city='$b_city', b_state='$b_state', b_country='$b_country', b_zipcode='$b_zipcode', s_address='$s_address', s_city='$s_city', 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='".text_crypt($card_number)."', card_expire='$card_expire', card_cvv2='$card_cvv2', pending_membership='$pending_membership', referred='$referred', ssn='$ssn' where login='$login' and usertype='$login_type'"); Next Change: Old Code: # # Add new person to customers table # $intershipper_recalc = "Y"; db_query("insert into $sql_tbl[customers] (login,usertype,membership,password,password_hint,password_hint_answer,title,firstname,lastname,company,b_address,b_city,b_state,b_country,b_zipcode,s_address,s_city,s_state,s_country,s_zipcode,phone,email,fax,url,card_name,card_type,card_number,card_expire,card_cvv2,first_login,status,referer,pending_membership,ssn) values ('$uname','$usertype','$membership','$crypted','$password_hint','$password_hint_answer','$title','$firstname','$lastname','$company','$b_address','$b_city','$b_state','$b_country','$b_zipcode','$s_address','$s_city','$s_state','$s_country','$s_zipcode','$phone','$email','$fax','$url','$card_name','$card_type','".text_crypt($card_number)."','$card_expire','$card_cvv2','".time()."','Y','$RefererCookie','$pending_membership','$ssn')"); New Code: # # Add new person to customers table # $intershipper_recalc = "Y"; db_query("insert into $sql_tbl[customers] (login,usertype,membership,password,password_hint,password_hint_answer,title,firstname,lastname,company,b_address,b_city,b_state,b_country,b_zipcode,s_address,s_city,s_state,s_country,s_zipcode,phone,email,fax,url,referred,card_name,card_type,card_number,card_expire,card_cvv2,first_login,status,referer,pending_membership,ssn) values ('$uname','$usertype','$membership','$crypted','$password_hint','$password_hint_answer','$title','$firstname','$lastname','$company','$b_address','$b_city','$b_state','$b_country','$b_zipcode','$s_address','$s_city','$s_state','$s_country','$s_zipcode','$phone','$email','$fax','$url','$referred','$card_name','$card_type','".text_crypt($card_number)."','$card_expire','$card_cvv2','".time()."','Y','$RefererCookie','$pending_membership','$ssn')"); Final Change in this file is adding a field towards the bottom of the file: $userinfo[referred]=stripslashes($referred); I added this after company.

Next: I modified skin/main/register.tpl
Following was added after company once again.

Code:
<tr valign=middle> <td align=right>{$lng.lbl_referer}</td> <td></td> <td nowrap> <input type=text name=referred value="{$userinfo.referred}"> </td> </tr>

Next: I modified skin1/mail/signin_notification.tpl and skin1/mail/profile_admin_modified.tpl

The following code was added to the bottom of the file.

Code:
{$lng.lbl_referer}: {$userinfo.referred}

The
is in the there as I have all of my emails in HTML (well some of them far more html then others)

Thanks to all those whose code I found, hope someone gets some use out of this. Took me a while of playing around to get the sql to work right and the fields to store correctly and display correctly.

I know that it is old post but I want to add Date of birth (D-M-Y ) and Date of anniversary (D-M-Y) in registration page.How to add it ? It will be better if we add a calender options.

How to do it?

Can you help me?

Thanks to all.
__________________
4.6.1 Platinum


Reply With Quote