How to add a special sale bonus to special affiliate

Lets say you have a close friend in your affiliate system and you want to pay him special commissions - not based on total cost. You can do this by the sale tracking code and some PHP coding. Or there is another case  when you have a gallery shop, where you pay some commissions to the affiliates, but also to authors of the paintings...

How to do it
Let's say, you have an affiliate Phill, with referral ID of phil007 and affiliate ID of 53s5er28. You want to give him for each sale 5$  + his commission.
First, you will have to add a code to the order confirmation page - hidden field (in example the name is "affCookieInfoId") where the affiliate ID will be sent from the script below. This form should send this data to thank you page:
<script id="pap_x2s6df8d" src="https://www.yoursite.com/affiliate/scripts/salejs.php" type="text/javascript">
</script>
<script type="text/javascript">
PostAffTracker.writeAffiliateToCustomField('affCookieInfoId');
</script>
Then this code needs to be in the thank you page:
<script id="pap_x2s6df8d" src="https://www.yoursite.com/affiliate/scripts/salejs.php" type="text/javascript">
</script>
<script type="text/javascript">
<?php if ($_POST['affCookieInfoId'] == '53s5er28') {
?>
var bonus = PostAffTracker.createSale();
bonus.setCustomCommission('5');
bonus.setOrderID('phill_bonus');
<?php
}
?>

var sale = PostAffTracker.createSale();
sale.setTotalCost('120.50');
sale.setOrderID('ORD_12345XYZ');
sale.setProductID('test product');

PostAffTracker.register();
</script>


 
×