The calculation path

For every order the plugin writes down how it calculated: which rates were in play, which one won and why. This chapter reads that log line by line and describes every branch it can take.

The log

Where it sits

In two places, both with the same content. The text sits in a field you can copy from, so you can paste it into a reply.

In the partner file
Statistics → Orders → context menu of the row → Show log
On the order
Open the order → Commissions tab
Requirement
The setting Log the commission calculation for every order, active out of the box
Heading
Log of the commission calculation

A complete example

Order 10024 from the demo shop, €235.21 of revenue, result €11.76. The partner has a rate of 10 percent but receives 5. Why, is in the log.

calculation commission for order - id: 01a06496e4087167a5d076249c9abfc7 - number: 10024 - tax status: gross - level: 1
-- reading if order is subsequent order
-- -- looking for previous commissioned order for customer
-- -- previous order with redeemable commission found - order number: 10013 - is subsequent order: true
-- is subsequent order: true
-- firing commission calculator pre-calculation event
-- switching by commission type - affiliate commission type: percental
-- -- individual commission disabled by configuration - configuration individualProductCommissionStatus: false
-- -- calculating commission rate
-- -- -- calculating static commission rate - customer commission: null - product commission: null - category commission: null - product stream commission: null - subsequent commission: 5 - affiliate commission: 10 - configuration commissionPriority: default
-- -- -- sorted and filtered rates: Array ( [0] => 5 [1] => 10 )
-- -- -- selecting default/first rate by priority - rate: 5
-- -- commission rate calculated - rate: 5
-- -- calculating commission - order amount: 235.21
-- -- commission calculated - commission: 11.76
-- commission calculated by commission calculator - calculated commission: 11.76
-- firing commission calculator event
-- commission possibly re-calculated due to fired event - calculated commission: 11.76
-- calculated commission: 11.76

The indentation with dashes carries the nesting: the deeper the line, the further inside the process. The top level are the steps, the second their sub-steps.

The sequence, step by step

Stop 1: the partner's own order

If buyer and partner are the same customer and commission for own orders is switched off, the calculation ends immediately at zero. The log then reads self commission disabled by configuration followed by calculated commission: 0.0.

Setting
Partners receive commission for their own orders
Out of the box
active, so their own order counts
Careful
The comparison runs over the customer account. If a partner orders as a guest, this brake does not apply

Step 2: is it a follow-up order?

The plugin looks for an earlier order with a redeemable commission for the same customer. If it finds one, it notes the order number and sets the case to true.

Found
previous order with redeemable commission found - order number: 10013
Not found
no previous order with redeemable commission found - is subsequent order: false
Guest account
customer is guest account - is subsequent order: false. For guests there is no follow-up order

Stop 2: follow-up orders switched off

If the order is a follow-up order and follow-up orders do not earn a commission, the calculation ends here at zero. This is the setting that turns the commission into a one-off bonus per customer won.

Log
commission for subsequent order disabled by configuration
Result
calculated commission: 0.0
Out of the box
Follow-up orders count

Step 3: branch by commission type

switching by commission type - affiliate commission type: percental. From here a different calculator runs depending on the type, and the log lines below differ.

percental
A percentage of the order amount
absolutePerOrder
A fixed amount per order
absolutePerPiece
A fixed amount per item, so multiplied by the quantity

The rate

One switch for four sources

The rates on customer, product, category and dynamic product group hang on a single setting, not on four. While it is off, the calculation skips all four and records it: individual commission disabled by configuration - configuration individualProductCommissionStatus: false.

Setting
Activate individual commission for customers, categories, products and dynamic product groups
Out of the box
off
Consequence
Without it, only the follow-up rate and the partner rate remain

The fixed order

All candidates are collected in an order wired into the code. Rates that are not set appear as null in the log and then drop out; the order of the rest is preserved.

1. Customer
A rate for one particular referred customer
2. Product
A rate on the single article
3. Category
A rate on a category
4. Dynamic product group
A rate on a product group
5. Follow-up order
This partner's own rate for follow-up orders
6. Partner
The partner's base rate. It stands last

In the example, [0] => 5 and [1] => 10 remain after filtering: the follow-up rate in front of the partner rate.

The priority decides

Only now does the setting Priority for several commission rates pick which of the remaining rates wins.

Highest priority
The first rate in the order. Log: selecting default/first rate by priority
Highest commission rate
The largest value. Log: selecting highest rate by priority
Lowest commission rate
The smallest value. Log: selecting lowest rate by priority
Out of the box
Highest priority

The most common mix-up. "Highest priority" means the position in the order, not the size of the rate. That is exactly why the partner gets 5 instead of 10 in the example: the follow-up rate stands in front of the partner rate. Whoever really wants the largest value every time chooses "Highest commission rate".

Two more priorities, one level deeper

If a product sits in several categories or in several dynamic product groups, there are several candidates inside that one source. Two settings of their own resolve it before the value enters the big order.

Priority for commissions from categories
Lowest or highest commission. Out of the box highest
Priority for commissions from dynamic product groups
Lowest or highest. Out of the box highest
Relationship
They act before the priority for several commission rates, not instead of it

The amount

From the rate to the euro

calculating commission - order amount: 235.21 and below it commission calculated - commission: 11.76. The order amount is the net goods value excluding shipping; the tax status from the header line determines how it is established.

The example
5 % of 235.21 = 11.7605, rounded to 11.76
Foreign currency
Converted into the shop's default currency
Shipping
Does not count

Two events for your own code

One event fires before the calculation and one after. The log records both and states the value again afterwards, so it stays visible whether a listener changed it.

Before
firing commission calculator pre-calculation event
After
firing commission calculator event
Check
commission possibly re-calculated due to fired event - calculated commission: …
What for
Your own rules, without changing the plugin

Everything on this page is generated straight from the plugin configuration. When a setting changes in the plugin, this page changes with it.

← Back to the manual

Common questions

Can I retrace how a commission came about?

Yes, completely. The plugin writes a log of the calculation onto every order, line by line, with every intermediate value. You open it in the partner file under Statistics, Orders through the context menu of the row with "Show log", and equally on the order itself in the Commissions tab. It answers not only how much, but why.

In which order are the commission rates checked?

In a fixed order wired into the code: customer, product, category, dynamic product group, follow-up order, partner. Rates that are not set drop out, and the order of the rest is preserved. Only then does the Priority setting decide which of them wins.

What does the priority "Highest priority" mean?

It means the position in the order, not the size of the rate. The first rate that is set in the fixed order wins, so in case of doubt the customer rate, and the partner rate last. Whoever really wants the largest value chooses "Highest commission rate". This mix-up is the most common source of error during setup.

Why does a partner get less than their own rate?

Because another rate stood in front of it. With a follow-up rate of 5 percent and a partner rate of 10, the priority "Highest priority" picks the 5 as soon as the order has been recognised as a follow-up order. The log shows exactly that step.

When does an order count as a follow-up order?

When an earlier order with a redeemable commission already exists for the same customer. The plugin looks for one and writes the order number it found into the log. Guest accounts are excluded: for them an order is never a follow-up order.

When is the commission zero?

The calculation stops immediately at two points. First, when the buyer and the partner are the same customer and commission for own orders is switched off. Second, when it is a follow-up order and commission for follow-up orders is switched off. Both stops appear in the log with their reason.

Are the rates on product and category active out of the box?

No. A single switch, "Activate individual commission for customers, categories, products and dynamic product groups", releases all four together and is off out of the box. While it is off, the calculation skips those four sources entirely and the log records that.

What happens when a product sits in several categories?

Then a second priority applies, separately for categories and for dynamic product groups. Both stand at "Highest commission" out of the box. They resolve the conflict inside one source before the resulting value enters the big order.

Can I step into the calculation?

Yes, through two events. One fires before the calculation, one after; the log records both and states the value again after the second one. Your own code can change the commission that way without touching the plugin.

Where is the log stored?

On the order, as long as the setting "Log the commission calculation for every order" is active. It is on out of the box. Without it, a question can only be answered by guessing, so it should stay on.