Update on the above:
//--------------------------------------------------------------------------
// POST Affiliate Pro code === EC ON 2ND MAY 2006 ===
// The code below will get the order_id and total value of recent order
// from the database and displays invisible image that registers the sale
// for affiliate (if some affiliate referred this visitor)
//--------------------------------------------------------------------------
$q = "SELECT * FROM #__{vm}_orders WHERE order_id='$order_id'";
$db->query( $q );
$pap_order_total = $db->f( 'order_subtotal' ) - $db->f( 'coupon_discount' );
$q = "SELECT * FROM #__{vm}_order_item WHERE order_id='$order_id'";
$db->query( $q );
$pap_product_id = $db->f( 'product_id' );
$img = '<img src="
http://YOURDOMAIN.COM/affiliate/'.
'scripts/sale.php?TotalCost='.$pap_order_total.'&OrderID='.$order_id.'&ProductID='
.$pap_product_id.'" width=1 height=1>';
print $img;
echo $img;
//--------------------------------------------------------------------------
// POST Affiliate Pro code === END OF CUSTOMISATION ===
//--------------------------------------------------------------------------
This one has a difference in the calculation:
- In the first post, the commission would eb calculated on the order subtotal
- In the second version, it is based on order subtotal - coupon discount
If you are combining couponing and affiliatiion, this is a more logical way to reward affiliates, as you're paying them on the value of what they've acutally sold (ie without additional discounts they may have granted).
FE