Use this page to set a cookie for an affiliate id.
# -------------------------------------------------------------------
# AFFILIATE_ID JAVASCRIPT
# -------------------------------------------------------------------
STEP ONE: Add this to your index page
This code is used to capture an affilite id when the user enters your
web site. It grabs the affiliate ID passed in the url and sets a cookie
which will be accessed later in the order form page.
The link to this page should be as follows:
http://www.YOURSITE.com/index.html?ID=12345
the 12345 is the affiliate number we want to save. You can use anything
you like on the left side of the equal sign like this:
http://www.YOURSITE.com/index.html?member=12345
http://www.YOURSITE.com/index.html?affiliate=12345
http://www.YOURSITE.com/index.html?id=12345
etc... It does not matter...
One Moment Please...
The rest of your page goes here....
# -------------------------------------------------------------------
STEP TWO (version 2.12 and above):
Replace the function formFill() in your orderform.js with this:
function formFill(){
for(a = 0; a < document.forms.length; a++){
for(i = 0; i < document.forms[a].elements.length -1; i++){
var inType = document.forms[a].elements[i].type;
var fieldName = document.forms[a].elements[i].name;
var myCookie = getValue(fieldName);
if((inType == "text")&&(myCookie != null)){
document.forms[a].elements[i].value = myCookie;
}
if((inType == "hidden")&&(fieldName == "Customer_Number")&&(myCookie != null)){
document.forms[a].elements[i].value = myCookie;
}
if((inType == "hidden")&&(fieldName == "affiliate_id")&&(myCookie != null)){
document.forms[a].elements[i].value = myCookie;
alert(document.forms[a].elements[i].value);
}
}
}
}
This affiliate_id will now get passed into the email and if you put:
Affiliate = AFFILIATE_ID
...in your email templates, it will show up.
# -------------------------------------------------------------------
If you are using an older version than 2.12, replace the formFill()
in the credit_card.html page:
function formFill(){
for(a = 0; a < document.forms.length; a++){
for(i = 0; i < document.forms[a].elements.length -1; i++){
var inType = document.forms[a].elements[i].type;
var fieldName = document.forms[a].elements[i].name;
var myCookie = getValue(fieldName);
if((inType == "text")&&(myCookie != null)){
document.forms[a].elements[i].value = myCookie;
}
if((inType == "hidden")&&(fieldName == "26-CUSTOMER_NUMBER")&&(myCookie != null)){
document.forms[a].elements[i].value = myCookie;
}
if((inType == "hidden")&&(fieldName == "affiliate_id")&&(myCookie != null)){
document.forms[a].elements[i].value = myCookie;
alert(document.forms[a].elements[i].value);
}
}
}
}
Then, make sure the:
affiliate_id=34-Affiliate ID Number
...is in the [ORDER_FORM_FIELDS] section of your qs_main.cgi file
so you can see the id in the store email.
# -------------------------------------------------------------------
STEP THREE:
Open your quikstore.cgi and search for this
$users_cart_path = "$cwd$cf{'user_carts_path'}/$cart_id.cart";
Just below it, add this:
if(($form_data{'affiliate_id'} eq "")&&($cookie{'affiliate_id'} ne "")){
$form_data{'affiliate_id'} = $cookie{'affiliate_id'};
}
That will pass the affiliate_id cookie in hidden fields so the
secure server will pick it up.
You may need to add some hidden fields to your , especially on
the shipping.html template, like this:
If you view the source of the page when it in the browser, you should
see the affiliate_id filled in when it's working correctly.