Page 1 of 1

HELP Needed! - Adding discount calculation to affiliates commission?

Posted: Thu Sep 05, 2019 1:25 am
by claud9
Hello,
I just figured out that Opencart (vers 2) doesn't calculate the discount coupon when applying the affiliate commission...
So for example, if the item price is $100 and the customer applies a discount coupon of $20, the affiliate commission is calculated on $100 and not $80!

How can I change this?
I found this solution but is related to OC 1.5 and also It is not indicated where is located the file that I have to modify..?
viewtopic.php?t=122279
Thanks in advance for any help!

Re: HELP Needed! - Adding discount calculation to affiliates commission?

Posted: Thu Sep 05, 2019 2:55 pm
by xxvirusxx
claud9 wrote:
Thu Sep 05, 2019 1:25 am
It is not indicated where is located the file that I have to modify..?
catalog/controller/checkout/confirm.php

And try this code

Code: Select all

$aff_total = $total;
foreach($taxes as $_v) {
  $aff_total -= $_v;
}
$order_data['commission'] = ($aff_total / 100) * $affiliate_info['commission']; 

Re: HELP Needed! - Adding discount calculation to affiliates commission?

Posted: Thu Sep 05, 2019 9:20 pm
by claud9
Hi, Thanks for the help!

In this old post (related to OC 1.5) they indicate this modification as working:

$data['commission'] = ($total / 100) * $affiliate_info['commission'];

Do you It is better "$total" or "$aff_total" as you have indicated?

Thanks