View Single Post
  #3  
Old 01-22-2003, 12:37 PM
 
unioman unioman is offline
 

Member
  
Join Date: Nov 2002
Location: VA, United States
Posts: 25
 

Default Found A Solution

Okay - I found a way to keep the customer linked with the affiliate "forever" once the customer registers after following an affiliate's referral link/code.

There are several steps to this - they are outlined below. Note that the one thing this does not do is track a customer that may have come via an affiliate's link but didn't register, and then came back but not using the affiliate's link. I believe the only way to deal with this is to set a cookie (if the customer allows it) on his/her machine to link the partner login id with him/her.

However, if a customer registers during the same session after clicking on an affiliate's link, this will keep him/her tied to the affiliate so all other sales made by that customer are credited to the affiliate.

FIRST STEP: Add Б─°partnerБ─² as a field in the customers table. This is where the affiliateБ─≥s login will appear for each customer. Obviously, if the customer wasnБ─≥t referred, the login will be null. You will set this field with the same parameters as the login field (varchar(32)).

SECOND STEP: Change following code in the include/register.php file (find the code in the file and add the text I have in red, I inserted line wraps here for easier reading):

Quote:
db_query("insert into $sql_tbl[customers]
(login,usertype,membership,password,password_hint, password_hint_answer,title,firstname,lastname,comp any,
b_address,b_city,b_state,b_country,b_zipcode,s_add ress,s_city,s_state,s_country,s_zipcode,phone,emai l,fax,url,
card_name,card_type,card_number,card_expire,card_c vv2,first_login,status,referer,pending_membership, ssn,partner)
values ('$uname','$usertype','$membership','$crypted','$p assword_hint','$password_hint_answer','$title','$f irstname','$lastname','$company',
'$b_address','$b_city','$b_state','$b_country','$b _zipcode','$s_address','$s_city','$s_state','$s_co untry','$s_zipcode','$phone','$email','$fax','$url ',
'$card_name','$card_type','".text_crypt($card_numb er)."','$card_expire','$card_cvv2','".time()."','Y ','$RefererCookie','$pending_membership','$ssn','$partner')");

THIRD STEP: Now the Affiliate is linked to the new customer for life. Now you must update the code to look in the customerБ─≥s table for the partner assigned to him/her each time the customer logs in so as to track commissions from any purchases. Do this by adding Б─°partnerБ─² to the session variable once the customer logs in.
EDIT the include/login.php file as follows:

INSERT THE FOLLOWING CODE IN RED AT THE END OF THE Б─°SUCCESS LOGIN SECTIONБ─²:

Quote:
# Success login
#
$login=$username;
$login_type=$usertype;
$logged="";
$partner = $user_data["partner"];
session_register("partner");

That's it. It's working fine for me. It should work fine for you unless you have created some customization that might conflict with this.
Reply With Quote