Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

Automatically tying a sale to an affiliate

by

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, 9 months ago by admin.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • May 13, 2011 at 2:11 am #3393
    Frank
    Member

    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 #32420
    amin007
    Participant

    It 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 #32421
    Frank
    Member

    Yes Amin I am. How would I do it?

    Frank

    May 21, 2011 at 12:08 am #32422
    amin007
    Participant

    Please 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 #32423
    Frank
    Member

    Awesome thanks you!

    July 13, 2012 at 1:29 pm #32424
    patbloomfield
    Member

    Perfect, 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 #32425
    admin
    Keymaster

    If 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 #32426
    ewoud
    Member

    how would this work in WooCommerce? Does anyone know?

    September 10, 2013 at 11:15 pm #32427
    admin
    Keymaster

    You 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:

    https://support.tipsandtricks-hq.com/need-custom-work-done

  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ