Post by claud9 » Thu Sep 05, 2019 1:25 am

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!

New member

Posts

Joined
Wed Aug 31, 2016 12:54 am

Post by xxvirusxx » Thu Sep 05, 2019 2:55 pm

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']; 

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by claud9 » Thu Sep 05, 2019 9:20 pm

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

New member

Posts

Joined
Wed Aug 31, 2016 12:54 am
Who is online

Users browsing this forum: No registered users and 19 guests