Tips and Tricks HQ Support Portal › Forums › WP Affiliate Platform › WP Affiliate General Questions › Automatically tying a sale to an affiliate
Tagged: affiliate, default affiliate, estore
- This topic has 8 replies, 5 voices, and was last updated 11 years, 2 months ago by admin.
-
AuthorPosts
-
May 13, 2011 at 2:11 am #3393FrankMember
One of our customers would like to be able to automatically attach sales to a default affiliate if they come to the sales pages with no affiliate link attached. Thing is they really like the accounting pages in the affiliate section. Any ideas on how to handle this?
Thanks!
Frank
May 13, 2011 at 11:03 pm #32420amin007ParticipantIt will be easy to assign an affiliate (if there is no affiliate attached) at checkout time instead of doing it when a visitor lands on the sales page. I am assuming you are using eStore? This can be done easily in eStore.
May 20, 2011 at 6:59 pm #32421FrankMemberYes Amin I am. How would I do it?
Frank
May 21, 2011 at 12:08 am #32422amin007ParticipantPlease find the following function in the “wp_eStore1.php” file:
function eStore_get_custom_field_value()
Now, find the following code block inside the function:
else if (isset($_COOKIE['ap_id']))
{
$name = 'ap_id';
$value = $_COOKIE['ap_id'];
$custom_field_val = append_values_to_custom_field($name,$value);
}Once you find it please change it to the following:
else if (isset($_COOKIE['ap_id']))
{
$name = 'ap_id';
$value = $_COOKIE['ap_id'];
$custom_field_val = append_values_to_custom_field($name,$value);
}
else
{
$name = 'ap_id';
$value = "DEFAULT_ID"; //Specify the default affiliate ID here
$custom_field_val = append_values_to_custom_field($name,$value);
}Just change “DEFAULT_ID” with the affiliate ID that you want to be get credited if there are no referrer involved.
June 21, 2011 at 6:06 pm #32423FrankMemberAwesome thanks you!
July 13, 2012 at 1:29 pm #32424patbloomfieldMemberPerfect, just what I needed too
I assume this will need re-programming with updates or is it possible to configure a default in the interface now?
July 14, 2012 at 6:59 am #32425adminKeymasterIf a lot of users want to use it then I will add this as an option inside the settings.
September 10, 2013 at 3:35 pm #32426ewoudMemberhow would this work in WooCommerce? Does anyone know?
September 10, 2013 at 11:15 pm #32427adminKeymasterYou can set a cookie with the affiliate ID (if no ID is present already) when the visitor lands on the landing page.
Here is an example sudo code of how you can determine if a cookie exists for the visitor. If no affiliate ID value is present then you can set a default affiliate ID which will get the commission:
if (!isset($_COOKIE['ap_id']) && !isset($_SESSION['ap_id'])
{
$default_affiliate = "DEFAULT_ID"; //Specify the default affiliate ID here
$cookie_life_time = aff_get_cookie_life_time();
setcookie("ap_id", $default_affiliate, $cookie_life_time, "/",COOKIE_DOMAIN);
}The criteria for the default affiliate ID will probably be diffrent for each site. So if you are not a developer this will need a small custom solution. You can use the following option to get a quote for getting the code done by us:
-
AuthorPosts
- You must be logged in to reply to this topic.