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.
// function somePrefix_ClientAdd($vars)
// This above command link says to chage "somePrefix_ClientAdd" so something else, so I am changing to "liquid_ClientAdd"
$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');
// changing add_hook('ClientAdd', 1, 'somePrefix_ClientAdd'); below with "liquid_ClientAdd"
add_hook('ClientAdd', 1, 'liquid_ClientAdd');