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

Repeat Sales credited to Affiliates?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 01-21-2003, 09:08 AM
 
unioman unioman is offline
 

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

Default Repeat Sales credited to Affiliates?

Has anyone tried to use the Affilate module to track repeat sales for affiliates? In other words - once a customer creates an account after coming via an affiliate's referral links, is it possible to link them to the affiliate for as long as the affiliate is an affiliate?

I believe the way things are working now - it only links the customer to the affiliate for the current session. So if the customer decides not to purchase then, but later comes back to the main site (not using the affiliate's links) - the affiliate won't get credit for the sale.

I would think one could add a new field in the customer table to hold the affiliate username/login so the customer would be linked to the affiliate forever. However, I'm not sure where in the code one would pull this info to update commissions due whenever the customer makes a purchase.

Any ideas?

Thanks.
Reply With Quote
  #2  
Old 01-21-2003, 09:20 AM
 
jpsowin jpsowin is offline
 

X-Adept
  
Join Date: Sep 2002
Posts: 459
 

Default

Good point.... I've never thought about that.
__________________
Joshua Sowin
...taking things one TPL at a time.
Reply With Quote
  #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
  #4  
Old 01-22-2003, 03:19 PM
 
TeeJay TeeJay is offline
 

Advanced Member
  
Join Date: Oct 2002
Location: UK
Posts: 85
 

Default No need

There will probably be no need to taylor your scripts as I have already ordered and paid for customisation on this.
my request was that I should be able to set in the admin area the length of time for which an affiliate gets paid commission on sales from a returning customer, I suggested that they might use a date and refferer in the mysql table or a cookie.
__________________
X-Cart 4.0

Windoze XP Pro
Sick and tired of figuring out code just wanna get on with my life and selling my goods, it\'s raining here too
Reply With Quote
  #5  
Old 01-22-2003, 03:24 PM
 
TeeJay TeeJay is offline
 

Advanced Member
  
Join Date: Oct 2002
Location: UK
Posts: 85
 

Default PS

Another thing that I am cosidering having taylored is the html output (3.3.1).
I want to have it so that it will generate a complete catalog for an affiliate (inserting his affiliate id in the links).
This would make a very powerfull affiliate site where your entire product catalog is duplicated with the correct links for each affiliate.
__________________
X-Cart 4.0

Windoze XP Pro
Sick and tired of figuring out code just wanna get on with my life and selling my goods, it\'s raining here too
Reply With Quote
  #6  
Old 01-22-2003, 05:29 PM
 
unioman unioman is offline
 

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

Default

Those are great suggestions
Reply With Quote
  #7  
Old 01-03-2004, 10:24 AM
 
concreteweb concreteweb is offline
 

Newbie
  
Join Date: Feb 2003
Posts: 4
 

Default Unionman's Mods for 3.5.1

Hi,

Has anyone successfully updated the appropriate files and made this mod work for version 3.5.1?

We made all the changes (with slightly modified syntax for the new version) - but can't seem to get the system to attach/correlate the referred customer's name with the originating affiliate.

Thanks!
Reply With Quote
  #8  
Old 01-03-2004, 04:26 PM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

im sure that as of 3.5.x you could set how long affiliates get accredited for sales as a number of days from sign up
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #9  
Old 01-03-2004, 04:40 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Looks like another one for Custom Mods!
Reply With Quote
  #10  
Old 01-04-2004, 03:37 PM
 
concreteweb concreteweb is offline
 

Newbie
  
Join Date: Feb 2003
Posts: 4
 

Default

Hi Shan,

Actually, not true - unless there is an undocumented feature. I hope someone speaks up and tells me I'm wrong!

There is a cookie setting - but that is close to worthless since most people clear out their cookies regularly.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


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 12:38 AM.

   

 
X-Cart forums © 2001-2020