Post by gamersoutlet » Tue Mar 25, 2014 5:05 pm

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?
Last edited by gamersoutlet on Wed Jul 30, 2014 11:05 pm, edited 2 times in total.

New member

Posts

Joined
Thu Dec 12, 2013 3:12 pm

Post by ocmta » Tue Mar 25, 2014 7:22 pm

Code: Select all

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

Extensions for affiliates (openCart 1, 2, 3):
Advanced Multi Level Affiliate System
Customer and Affiliate Accounts Combined into one Account
Affiliate Tracking with Coupons
Discount for Referred Customers - Order Total
Type Tracking Code
Mass Pay
Affiliate Transactions for openCart 3
Affiliate Pack X - all modules with 40% discount


Active Member

Posts

Joined
Mon Mar 12, 2012 11:21 am


Post by gamersoutlet » Tue Mar 25, 2014 7:42 pm

worked like a charm ocmta, thank you very much :)

New member

Posts

Joined
Thu Dec 12, 2013 3:12 pm

Post by gamersoutlet » Wed Jul 30, 2014 11:05 pm

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?

New member

Posts

Joined
Thu Dec 12, 2013 3:12 pm

Post by ocmta » Thu Jul 31, 2014 1:26 am

Code: Select all

$payment_fee = $aff_total - $subtotal;
$aff_total -= $payment_fee;
is equal to:

Code: Select all

$aff_total = $subtotal;
So you're calculating commission from $subtotal again now.

Extensions for affiliates (openCart 1, 2, 3):
Advanced Multi Level Affiliate System
Customer and Affiliate Accounts Combined into one Account
Affiliate Tracking with Coupons
Discount for Referred Customers - Order Total
Type Tracking Code
Mass Pay
Affiliate Transactions for openCart 3
Affiliate Pack X - all modules with 40% discount


Active Member

Posts

Joined
Mon Mar 12, 2012 11:21 am


Post by gamersoutlet » Thu Jul 31, 2014 2:40 pm

ocmta wrote:

Code: Select all

$payment_fee = $aff_total - $subtotal;
$aff_total -= $payment_fee;
is equal to:

Code: Select all

$aff_total = $subtotal;
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?

New member

Posts

Joined
Thu Dec 12, 2013 3:12 pm

Post by ocmta » Thu Jul 31, 2014 3:00 pm

I guess it depends on what exactly is this fee. There must be some way to find its value and subtract it.

Extensions for affiliates (openCart 1, 2, 3):
Advanced Multi Level Affiliate System
Customer and Affiliate Accounts Combined into one Account
Affiliate Tracking with Coupons
Discount for Referred Customers - Order Total
Type Tracking Code
Mass Pay
Affiliate Transactions for openCart 3
Affiliate Pack X - all modules with 40% discount


Active Member

Posts

Joined
Mon Mar 12, 2012 11:21 am


Post by claud9 » Thu Sep 05, 2019 2:27 am

Hello,
where is located the file to be modified?

New member

Posts

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

Users browsing this forum: Majestic-12 [Bot] and 78 guests