freedombi Posted June 11, 2008 Share Posted June 11, 2008 The default behavior of * is to set a cookie with the affiliate id, and then send the user to the homepage. This prevents being able to link to a specific product or product group, and may be a bit confusing. Below, I have an * which, in addition to aff, also accepts gid or pid in the URL, and redirects to the appropriate group or product, respectively. gid takes precedence over pid. *: <?php define("CLIENTAREA",true); include("dbconnect.php"); include("includes/functions.php"); if (isset($aff)) { update_query("tblaffiliates",array("visitors"=>"+1"),array("id"=>$aff)); setcookie("WHMCSAffiliateID", $aff, time()+90*24*60*60); } $params = ''; // redirect to product group if (isset($_GET['gid'])) { $gid = (int)$_GET['gid']; if ($gid > 0) { $params = '?gid=' . $gid; } } // redirect to product elseif (isset($_GET['pid'])) { $pid = (int)$_GET['pid']; if ($pid > 0) { $params = '?a=add&pid=' . $pid; } } header('HTTP/1.1 301 Moved Permanently'); header('Location: ' . $CONFIG['SystemURL'] . '/cart.php' . $params); ?> 0 Quote Link to comment Share on other sites More sharing options...
Jortex Posted July 2, 2008 Share Posted July 2, 2008 I know its been 3 weeks since this was posted (and thank you very much freedombi for sharing it) but.... Has anyone had any success in using this? and to what extent? Reason im asking is that i now have the need for something like this, ideally a direct group link which would contain the group id, affiliate id and promotion code, basically something like: http://www.mydomain.com/cart.php?aff=001&promocode=coupon&gid=0000000003 Any suggestions are welcome, cheers. 0 Quote Link to comment Share on other sites More sharing options...
desmd Posted September 15, 2009 Share Posted September 15, 2009 Can you provide an example of how you used this, please? The default behavior of * is to set a cookie with the affiliate id, and then send the user to the homepage. This prevents being able to link to a specific product or product group, and may be a bit confusing. Below, I have an * which, in addition to aff, also accepts gid or pid in the URL, and redirects to the appropriate group or product, respectively. gid takes precedence over pid. *: <?php define("CLIENTAREA",true); include("dbconnect.php"); include("includes/functions.php"); if (isset($aff)) { update_query("tblaffiliates",array("visitors"=>"+1"),array("id"=>$aff)); setcookie("WHMCSAffiliateID", $aff, time()+90*24*60*60); } $params = ''; // redirect to product group if (isset($_GET['gid'])) { $gid = (int)$_GET['gid']; if ($gid > 0) { $params = '?gid=' . $gid; } } // redirect to product elseif (isset($_GET['pid'])) { $pid = (int)$_GET['pid']; if ($pid > 0) { $params = '?a=add&pid=' . $pid; } } header('HTTP/1.1 301 Moved Permanently'); header('Location: ' . $CONFIG['SystemURL'] . '/cart.php' . $params); ?> 0 Quote Link to comment Share on other sites More sharing options...
edvan.com.br Posted September 17, 2009 Share Posted September 17, 2009 <?php define("CLIENTAREA",true); include("dbconnect.php"); include("includes/functions.php"); if (isset($aff)) { update_query("tblaffiliates",array("visitors"=>"+1"),array("id"=>$aff)); setcookie("WHMCSAffiliateID", $aff, time()+90*24*60*60); } $params = ''; // redirect to product group if (isset($_GET['gid'])) { $gid = (int)$_GET['gid']; if ($gid > 0) { $params = '?gid=' . $gid; } header('HTTP/1.1 301 Moved Permanently'); header('Location: ' . $CONFIG['SystemURL'] . '/cart.php' . $params); } // redirect to product elseif (isset($_GET['pid'])) { $pid = (int)$_GET['pid']; if ($pid > 0) { $params = '?a=add&pid=' . $pid; } header('HTTP/1.1 301 Moved Permanently'); header('Location: ' . $CONFIG['SystemURL'] . '/cart.php' . $params); } // redirect domain else { header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$CONFIG["Domain"]); } ?> 0 Quote Link to comment Share on other sites More sharing options...
KevinR Posted September 22, 2009 Share Posted September 22, 2009 This is exactly what I need as well, I installed mine at /panel/cart.php and I'd like to be able to assign a promo code and affiliate code to a certain link. How would I do that? 0 Quote Link to comment Share on other sites More sharing options...
freedombi Posted September 23, 2009 Author Share Posted September 23, 2009 I haven't really done much with coupons or promo codes, myself. The question is how does it register that you have a coupon? I'm guessing it's not passed in the URL. If it's stored as a cookie, then you would just set the cookie from within the script. If it's just submitted as part of a form on one page, then I don't know if it's possible. 0 Quote Link to comment Share on other sites More sharing options...
KevinR Posted September 24, 2009 Share Posted September 24, 2009 How would I get the affiliate link to go to http://www.mydomain.com/panel/cart.php ? 0 Quote Link to comment Share on other sites More sharing options...
freedombi Posted September 28, 2009 Author Share Posted September 28, 2009 Either set SystemURL to http://www.mydomain.com/panel (in Configuration) or edit the script so it goes to that location. 0 Quote Link to comment Share on other sites More sharing options...
KevinR Posted September 29, 2009 Share Posted September 29, 2009 Thanks that was easy, is there anything maybe negative to having it set to mydomain.com/panel/cart.php under Config, General, Domain: 0 Quote Link to comment Share on other sites More sharing options...
Inetbiz Posted October 1, 2009 Share Posted October 1, 2009 What would really be spiffy is some smarty logic that helps them build custom links. Much like CRE Loaded Cart Affiliate Manager build custom links. In that cart, the store admin can BUILD links, let the affiliate search for a product and display the custom affiliate link or show a list of available banners OR what I would like to see from idevaffiliate is a way whmcs admins could create text box banners like google. 0 Quote Link to comment Share on other sites More sharing options...
KevinR Posted October 2, 2009 Share Posted October 2, 2009 That'd be nice 0 Quote Link to comment Share on other sites More sharing options...
decor Posted October 6, 2009 Share Posted October 6, 2009 So with that revised * page what affiliate url do you set up in the banners area to give the correct redirection? to a group or promotion. http://domainname.com/*?aff=### then what ????? thanks ian 0 Quote Link to comment Share on other sites More sharing options...
Inetbiz Posted October 12, 2009 Share Posted October 12, 2009 When I read http://wiki.whmcs.com/Affiliates it inserts a smarty variable. How would your code work with this wiki article? 0 Quote Link to comment Share on other sites More sharing options...
kennyjewels Posted October 22, 2009 Share Posted October 22, 2009 Oh thanks if it really works because it s very helpful trick. 0 Quote Link to comment Share on other sites More sharing options...
Joneiby Jimenez Posted September 4, 2012 Share Posted September 4, 2012 Hello, I need my WHMCS with the referral link will redirect you to register and have registered as referrals. 0 Quote Link to comment Share on other sites More sharing options...
jaytheshop Posted November 6, 2012 Share Posted November 6, 2012 How can I make an Affiliate Banner contain a Promo Code? When my affiliates copy our banners html and paste in on theirt website, it does not include any discount for the end customer... We want the affiliate banners to contain discount promo codes so the affiliate earns commission and the customer gets a discount.. I tried this but it does not add the discount code to the cart.... <a href="http://atmohost.com/[AffiliateLinkCode]/cart.php?promocode=migone"><img src="http://www.atmohost.com/templates/BlueHost/html/images/affbanners/atmo-affiliate1.jpg" width="200" height="300" border="0"></a><br> 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.