Hello,
At the moment I am working on some changes to Affiliate statistics. Say, I have some products in my store The first one cost 39.99 and is eligible to the Affiliate program.
This logic might be used in a file components/com_hikashop/views/affiliate/tmpl/sales.php to show how much money the reseller is going to get based on a order_full_price looks like this:
if ($row->order_full_price == 39.9900){
echo '£20.00';
}
elseif ($row->order_full_price == 79.9800){
echo '£40.00';
}
The second one cost 24.99 and is also eligible to the Affiliate program. For this one this logic will work:
elseif($row->order_full_price == 24.9900){
echo '£10.00';
}
elseif($row->order_full_price == 49.9800){
echo '£20.00';
}
else
echo 'No rule for this!';
and so on...
As you understand the major problem here is if the product price will change or there will be another product within the order which will make the order_full_price different from predefined ones, all the calculations will be wrong.
So... I am looking to make calculations based on product_id + order_product_quantity + order_product_price (which are stored in different tables _hikashop_order_product and _hikashop_order) and ideally the discount value to be deducted from predefined payout figure (20.00 or 40.00 as shown in the first example) if the reseller gave the discount code to the customer and is happy to get the discount code value deducted form his profit.
Please advise how can I accomplish the task.