Jump to content

using affiliate system with referral codes not cookies


jamiec

Recommended Posts

Hi:

Have system with WHMCS for a few years now, but want to expand my affiliates' abiliy to refer customers to me.

I would like to have an "add affiliate code" in the order form.

 

I have followed Kian's directions from his post:

Kian wrote the directions

https://whmcs.community/topic/290554-using-affiliate-system-with-referral-codes-not-cookies/?tab=comments#comment-1303042

 

but I seem to be hung up somewhere.. I'm pretty sure I did the setup and php file ok.  it shows on the order form, but when processed, it still says "no affiliate", and nothign in affiliate page.

I did not want to message Kian directly (not sure if that is OK on the rules).

Not sure If I should attach the Php file here either, but can PM it if needed.

 

Is there a place/way to loot at a log to see if the php file was even called/triggered?? I could find no place in the post where it said how to "attach" that hook to anything.

 

Thanks in advance,

 

Jamie

 

 

Link to comment
Share on other sites

On 07/03/2019 at 11:39, jamiec said:

I did not want to message Kian directly (not sure if that is OK on the rules).

it would be fine - if he ignores, or doesn't see it, then that's up to him. 🙂

alternatively, just mention him in a post, e.g @Kian and he might get a notification of you doing so.

Link to comment
Share on other sites

On 3/7/2019 at 6:39 AM, jamiec said:

 Is there a place/way to loot at a log to see if the php file was even called/triggered?? I could find no place in the post where it said how to "attach" that hook to anything.

You could use logactivity API call  or logModuleCall function, with the latter being a better choice for debugging as it outputs to utilities  -> logs -> module log which can be disabled for production while keeping the call in place.

Link to comment
Share on other sites

Hi:  @Kian  need a bit if assistance!

Trying to get my "Checkout" to include "Affiliate Code" so affliates don't have to have to point to me from a website, and they can do it by "word or mouth" (or word of text!).. to place orders and have them get credited.

I used your code proposed on a previous posting by you, but I was not successful.  WHMCS stated that it does show the hook activating, but stated that the "redirection code" is not working as expected.  Please find following the code, to see if you could take a quick look and provide some input.

 

It woiuld be greatly appreciated.

 

Jamie


 

<?php

use WHMCS\Cookie;
use WHMCS\Database\Capsule;
// function somePrefix_ClientAdd($vars)
// This above command link says to chage "somePrefix_ClientAdd" so something else, so I am changing to "liquid_ClientAdd"
//
function liquid_ClientAdd($vars)
{
    // Configuration
    $affiliationFieldID         = 332; // ID of Client Custom Field for Affiliation Code
    $partners['278']             = 'LIQUID'; // Affiliation code of partner/client ID 278 (this is mike test)
//  REM'd  to hide other affiliate id's (until end of the rem)
// $partners['40']             = 'DOG'; // Affiliation code of partner/client ID 40
//    $partners['41']             = 'YEP'; // Affiliation code of partner/client ID 41
//    $partners['42']             = 'SAD'; // Affiliation code of partner/client ID 42 
//
//  
    // Do not edit below this line
    if (in_array($vars['customfields'][$affiliationFieldID], $partners))
    {
        $affID = Capsule::table('tblaffiliates')->where('clientid', array_search($vars['customfields'][$affiliationFieldID], $partners))->first(['id']);
        header('Location: *?aff=' . $affID->id . '&gocart=true');
        die();
    }
}
// changing add_hook('ClientAdd', 1, 'somePrefix_ClientAdd'); below with "liquid_ClientAdd"
//
add_hook('ClientAdd', 1, 'liquid_ClientAdd');

 

 

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