Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

Version 1 Next »

Resetting Affiliate Totals

There isĀ affil:OnResetStatistics event, that is executed on each page. The event checks for any affiliate records, where affiliate plan period is over and resets their totals:

  • total items count, from orders associated with particular affiliate
  • order total amounts, from orders associated with particular affiliate

Instead I recommend doing that in Scheduled Task once per day at 00:00.

Calculating Affiliate Commissions

Right now affiliate commission calculations happens real-time when order is approved.

This has 2 implications:

  • ridiculously complex commission calculation code (we need to recalculate commissions for each past order in current affiliate plan period on every new approved order)
  • affiliate gets commissions from orders, that were first approved, but then declined

To solve above issues I propose to move commission calculation code from "order approval method" to "affiliate statistics reset method".

Pros:

  • administrator/affiliate don't see any intermediate commissions that might be different once affiliate plan period is over
  • actual commission % (from affiliate plan) is determined once per period, which reduces error factor greatly

Cons:

  • until affiliate plan period is over nobody knows what is earned by each affiliate, because we only see that a particular order has affiliate association and nothing more

Related Tasks

  • No labels