I need customised commissions based on the user. The way I have it set up, the users have a profile field which contains their commission level.
We can achieve this with your module by adding a hook, to line 614 of paypal_affiliates.module
//Get the Commission to pay for this level
$commission = round(paypal_affiliates_get_commission($level, $amount), 2);
foreach (module_implements('paypal_affiliates_commission') as $module) {
$hook = $module . '_paypal_affiliates_commission';
$hook($commission, $level, $amount, $aAccount);
}
This lets any other contrib modules play with the commission, my function for example:
/**
* Implements hook_paypal_affiliates_commission().
*
* Works out a custom commission value based on the users profile
*/
function example_paypal_affiliates_commission(&$commission, $level, $amount, $account) {
profile_load_profile($account);
if (!empty($account->profile_commission)) {
$commissions = explode(',', $account->profile_commission);
$commission = ($commissions[$level-1]/100)*$amount;
}
}
This is a pretty lightweight change to your module but opens up a whole array of customisations, any chance it could be included in the next version?








Aidan,
I love it, I'll add it in to the next release.
Sincerely,
Leighton Whiting