Page 1 of 1
adding discount calculation to affiliates commission
Posted: Tue Mar 25, 2014 5:05 pm
by gamersoutlet
Hi guys,
Would appreciate your help here.
I'm trying to have my affiliate commission affected by the discounts/vouchers of the products in the cart. I have changed:
$data['commission'] = ($subtotal / 100) * $affiliate_info['commission'];
to
$data['commission'] = ($total / 100) * $affiliate_info['commission'];
Which worked great until I encountered my issue: the VAT calculation is also added to the total value. Now I would like to subtract the VAT value from the calculation but I cannot seem to find the correct value for this.
Any suggestions?
Re: adding discount calculation to affiliates commission
Posted: Tue Mar 25, 2014 7:22 pm
by ocmta
Code: Select all
$aff_total = $total;
foreach($taxes as $_v) {
$aff_total -= $_v;
}
$data['commission'] = ($aff_total / 100) * $affiliate_info['commission'];
Re: adding discount calculation to affiliates commission
Posted: Tue Mar 25, 2014 7:42 pm
by gamersoutlet
worked like a charm ocmta, thank you very much

Re: adding discount calculation to affiliates commission
Posted: Wed Jul 30, 2014 11:05 pm
by gamersoutlet
ocmta wrote:Code: Select all
$aff_total = $total;
foreach($taxes as $_v) {
$aff_total -= $_v;
}
$data['commission'] = ($aff_total / 100) * $affiliate_info['commission'];
Hi,
I'm now facing a new issue. I've added payment method fees to my cart and the affiliate commission is counting them in.
When trying to solve this, I've added the following code:
Code: Select all
if ($affiliate_info) {
$data['affiliate_id'] = $affiliate_info['affiliate_id'];
// $data['commission'] = ($subtotal / 100) * $affiliate_info['commission'];
$aff_total = $total;
foreach($taxes as $_v) {
$aff_total -= $_v;
}
$payment_fee = $aff_total - $subtotal;
$aff_total -= $payment_fee;
$data['commission'] = ($aff_total / 100) * $affiliate_info['commission'];
} else {
$data['affiliate_id'] = 0;
$data['commission'] = 0;
}
} else {
$data['affiliate_id'] = 0;
$data['commission'] = 0;
}
But for some reason this still not working. Any suggestion on what is wrong?
Re: adding discount calculation to affiliates commission
Posted: Thu Jul 31, 2014 1:26 am
by ocmta
Code: Select all
$payment_fee = $aff_total - $subtotal;
$aff_total -= $payment_fee;
is equal to:
So you're calculating commission from $subtotal again now.
Re: adding discount calculation to affiliates commission
Posted: Thu Jul 31, 2014 2:40 pm
by gamersoutlet
ocmta wrote:Code: Select all
$payment_fee = $aff_total - $subtotal;
$aff_total -= $payment_fee;
is equal to:
So you're calculating commission from $subtotal again now.
hmm I see. So how the code need to be changed in order to:
Have the affiliate commission calculated with discount(if exist) or VAT but without any additional payment fees?
Re: adding discount calculation to affiliates commission
Posted: Thu Jul 31, 2014 3:00 pm
by ocmta
I guess it depends on what exactly is this fee. There must be some way to find its value and subtract it.
Re: adding discount calculation to affiliates commission
Posted: Thu Sep 05, 2019 2:27 am
by claud9
Hello,
where is located the file to be modified?