X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Repeat Sales credited to Affiliates? (https://forum.x-cart.com/showthread.php?t=1239)

unioman 01-21-2003 09:08 AM

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.

jpsowin 01-21-2003 09:20 AM

Good point.... I've never thought about that.

unioman 01-22-2003 12:37 PM

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. :wink:

TeeJay 01-22-2003 03:19 PM

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.

TeeJay 01-22-2003 03:24 PM

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.

unioman 01-22-2003 05:29 PM

Those are great suggestions :wink:

concreteweb 01-03-2004 10:24 AM

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!

shan 01-03-2004 04:26 PM

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

adpboss 01-03-2004 04:40 PM

Looks like another one for Custom Mods! ;)

concreteweb 01-04-2004 03:37 PM

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.


All times are GMT -8. The time now is 06:17 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.