Post by Astron » Sun Mar 31, 2013 3:21 am

This solution works fine for orders from the front-end when the affiliate code is used.
grgr wrote:You can give this a go...

Edit ../catalog/controller/checkout/confirm.php

change:

Code: Select all

				if ($affiliate_info) {
					$data['affiliate_id'] = $affiliate_info['affiliate_id']; 
					$data['commission'] = ($total / 100) * $affiliate_info['commission']; 
to:

Code: Select all

				$subtotal = $this->cart->getSubTotal();
				
				if ($affiliate_info) {
					$data['affiliate_id'] = $affiliate_info['affiliate_id']; 
					$data['commission'] = ($subtotal / 100) * $affiliate_info['commission']; 
If the affiliate code is not used and you want to link the affiliate from the admin, the commision is still calculated from the total instead of the subtotal.

I've found

Code: Select all

				if ($affiliate_info) {
					$data['affiliate_id'] = $affiliate_info['affiliate_id']; 
					$data['commission'] = ($total / 100) * $affiliate_info['commission']; 
twice in admin/model/sale/order.php, but this

Code: Select all

				$subtotal = $this->cart->getSubTotal();
obviously won't work.

Can anyone show how to call om the subtotal in admin/model/sale/order.php?

Thanks

Newbie

Posts

Joined
Sat Nov 10, 2012 7:37 pm

Post by butte » Sun Mar 31, 2013 5:31 am

Ideally, a percentage commission should be on purchase SUBtotal exclusive of ALL of shipping (which may be taxable or untaxable), handling fees (ditto), and tax(es), alike, in one stroke (with the probable exception of VAT unless it can be "reverse engineered" for the purpose of calculating commissions). An alternative fixed (value rather than rate) commission would avoid the problem. That in turn is something to consider, since just as realtors everywhere enjoy percentage commissions which they may not "earn" and some realtors offer accordingly fixed value commissions, the actual work that goes into a commission often doesn't have much to do (hourly or otherwise) with the prices, and the usual justification is that they contributed to or rarely even filled the bucket. In another industry where hush-hush is a rule and salaries often beg the mind to wonder, what, pray tell, do banks or card transaction processors actually do (measured in equipment, utility bills, human time, electrons commanded to and fro, whatever) that is in any sensible manner worth more money for processing a golf ball or box of crackers than for processing a case of rare caviar or a brand new Bentley, or is in any event worth more than a flat dime, let alone when the program authors don't see any of it, and let alone when the nightly float of pooled monies already provides income with fairly many zeroes and commas in it? Most of us have long since noticed that waitresses tend to be uppity if not tipped for taxes, and actually don't do much more for an expensive meal than for a modest one except in the finest restaurants; nifty charade, except when they overdo it and net a literal two-cents-worth that transaction processors and banks have clout to outmaneuver. Ordinary affiliates accruing ordinary commissions are not unreasonable to suppose may often, even more often than not, warrant not percentage rates but fixed fees, notwithstanding that moreover in some jurisdictions (globally) there may well apply a formal distinction between even mandatorily severable sales and income taxes. And that is an entirely reasonable development matter to consider.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by Astron » Tue Apr 02, 2013 7:24 pm

And this is helpfull because...?

Newbie

Posts

Joined
Sat Nov 10, 2012 7:37 pm

Post by butte » Wed Apr 03, 2013 8:39 am

Some of us do not pay percentage commissions or do not pay only percentage commissions, some of us would likely like to see both alternatives be settable rather than not using unsettable affiliates, there are ample examples to show problem or point that will apply in yet other contexts (even without any imagination or ingenuity to transfer them to there), muddying commissions with sales taxes invites having to keep track of paperwork that should be avoidable, and in some places in the world muddying sales with income taxes or taxabilities invites other paperwork that must be avoidable. Those are matters that are quite reasonably given thought toward perhaps tucking something appropriate in when that may be convenient to accommodate in development.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by Astron » Thu Apr 04, 2013 4:56 pm

I can agree with you, but in my case we use a percentage.
Does nobody have an idea on how to use the subtotal instead of the total of an order when applying commission from the back-end

Newbie

Posts

Joined
Sat Nov 10, 2012 7:37 pm

Post by butte » Fri Apr 05, 2013 10:53 am

It may reside in changing something as brief as subtotal this "cart" to "order" for getSubTotal, or in something less brief along the lines of changing latter getSubTotal to new getExtensionsTotal derived directly from the Prices and Quantities, separately from Subtotal or Total,. That would seem to provide a way to keep taxes out of commissions (before dragging them or anything else into the fray), from an order when no cart remains.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by ajie.kurniyawan » Tue Oct 22, 2013 4:28 pm

matts118 wrote:Hi.

This works great, but could somebody also please tell me how to also minus any coupons from the amount calculated for the affiliate. I have been trying for ages, but don't seem to be able to do it.

Many Thanks

I just using my instinc and it works greatt!!! LOL :laugh:
Edit this file : catalog/controller/checkout/confirm.php
find :

Code: Select all

$data['commission'] = ($subtotal / 100) * $affiliate_info['commission']; 
and replace to :

Code: Select all

$data['commission'] = ($total / 100) * $affiliate_info['commission']; 
Just change $subtotal to $total, subtotal is product price and total is total of product price after adding other costs such as shipping or discounted cuts.
O0


Posts

Joined
Wed Oct 16, 2013 2:20 am

Post by butte » Tue Oct 22, 2013 9:17 pm

The first post in the thread asks, "Is there a way to avoid commison being paid for the the shipping cost?"

The second thread in the post comments, "Commission should only be paid on the base price of goods and not on any ancillary charges (shipping, taxes, handling, etc.) added to the base price."

Two pages followed in that vein.

Instinc[t] suddenly diverted us from that thread of thought to now, "Just change $subtotal to $total, subtotal is product price and total is total of product price after adding other costs such as shipping or discounted cuts."

So much for instinct. Try reason instead. Leave instinct to animal basics.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am
Who is online

Users browsing this forum: No registered users and 15 guests