Jump to content

Affiliate Link and Promo Code


Recommended Posts

Hi,

 

We have created some promo codes and given to our affiliate partners. They have appended promo codes with their affiliate Id(For eg: their affiliate id is "www.mysite.com/clients/*?aff=2" and promo code is "MSWPMONSOON25", so they have created url like "www.mysite.com/clients/*?aff=2&promocode=MSWPMONSOON25" This url is perfectly redirecting to our mysite.com home page and while going to checkout there is not showing respective promo code.

 

But if we append same promo code with our direct cart url "http://www.mysite.com/clients/cart.php?gid=4&promocode=MSWPMONSOON25" and its working fine and this promo code is validated in checkout page.

 

So please guide us how to append promo codes with affiliate ids.

Link to comment
Share on other sites

this is because the affiliate page is not coded to pass a promocode in that way - however, it can be persuaded to by editing the * file (it's not encrypted) and adding the following line...

 

// if promotional code is passed, pass promocode
if ($promocode = $whmcs->get_req_var('promocode')) redir("promocode=".$promocode,"cart.php");

i'd suggest putting it after the product group if statement - if you do that, then using your www.mysite.com/clients/*?aff=2&promocode=MSWPMONSOON25 link, should pass the promo to the cart and be visible at the checkout stage. :idea:

Link to comment
Share on other sites

  • 3 years later...
On 6/26/2016 at 9:54 PM, brian! said:

this is because the affiliate page is not coded to pass a promocode in that way - however, it can be persuaded to by editing the * file (it's not encrypted) and adding the following line...

 

 


// if promotional code is passed, pass promocode
if ($promocode = $whmcs->get_req_var('promocode')) redir("promocode=".$promocode,"cart.php");
 

 

i'd suggest putting it after the product group if statement - if you do that, then using your www.mysite.com/clients/*?aff=2&promocode=MSWPMONSOON25 link, should pass the promo to the cart and be visible at the checkout stage. :idea:

Where I have to write that code

 

Link to comment
Share on other sites

3 hours ago, Shobha Patwal said:

It is not working, I added the above code in * file but promocode is not adding to url after going to checkout page

it doesn't need to be included in the URL by the time you get to checkout - it will have already been passed to the cart and used by it if there is an applicable  product within the cart...

Wq9LSq3.png

... and if there are no products in the cart affected by the promo code, the user will be told...

9qLTiwl.png

the fact that the promo code is no longer in the URL at checkout is intended behaviour.

Link to comment
Share on other sites

43 minutes ago, Shobha Patwal said:

Neither Premium code is applying to product nor billing cycle in sidebar

the a f f file isn't designed for multiple conditions to be passed to it unless you use gocart in the url...

aff . php?aff=143&gocart=true&a=add&pid=21&promocode=PREMIUM75&billingcycle=triennially

... and you might need to move where gocart is specified in the a f f file for this to work.

Edited by brian!
Link to comment
Share on other sites

15 hours ago, brian! said:

aff . php?aff=143&gocart=true&a=add&pid=21&promocode=PREMIUM75&billingcycle=triennially

Using gocart in url , promocode and billing cycle are added to product but now affiliate ID is not working..

There is no increase in  number of clicks  in my affiliate account

 

Link to comment
Share on other sites

2 hours ago, Shobha Patwal said:

There is no increase in  number of clicks  in my affiliate account

there is when I test it locally - this is the tblaffiliates_hits table from the dev...

ZeXmE2b.png

... every one of those entries was added by a gocart link and the hits count is increasing on that affiliate's page. 🙂

Link to comment
Share on other sites

2 minutes ago, Shobha Patwal said:

I tested many times there is no increase in number of clicks  , but when i removing the gocart from url , it increases number of clicks with removal of promocode and billing cycle

did you move the above gocart code like I suggested ?

Link to comment
Share on other sites

56 minutes ago, Shobha Patwal said:

What  I have to do?

I would make it the first of the if statements...

// if gocart = true, redirect to cart with request params
if ($whmcs->get_req_var('gocart')) {
    $reqvars = '';
    foreach ($_GET AS $k=>$v) $reqvars .= $k.'='.urlencode($v).'&';
    redir($reqvars,"cart.php");
}
// if product id passed in, redirect to order form
if ($pid = $whmcs->get_req_var('pid')) redir("a=add&pid=".(int)$pid,"cart.php");

// if product group id passed in, redirect to product group
if ($gid = $whmcs->get_req_var('gid')) redir("gid=".(int)$gid,"cart.php");

// if register = true, redirect to registration form
if ($whmcs->get_req_var('register')) redir("","register.php");

it's possible gocart isn't being called correctly, but AFAIK, it's use is undocumented (you might need to check with Support on that) - so putting it first should mean that if gocart is in the url, it takes precedence over the other options.

also, you might need to change the filename from a f f.php to something else - I don't know if WHMCS you overwrite the changes to this file during an update.

Link to comment
Share on other sites

2 hours ago, Shobha Patwal said:

I did it also , but there is no change ...

then what happens when your site is using Six and standard_cart?

it would be useful to rule out your custom theme and one page checkout custom orderform being the cause of this.

Link to comment
Share on other sites

3 minutes ago, Shobha Patwal said:

so it can be due to one page checkout form?

I don't know - but i'm testing it successfully on Six & Standard_cart, so if it works for you with S&SC, then it's likely one of the custom themes; if it doesn't work with S&SC, then something else might be going on.

Edited by brian!
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated