Zen Follower
- Join Date:
- Aug 2007
- Location:
- Cannon Beach, OR
- Posts:
- 180
- Plugin Contributions:
- 0
Jrox Zen Integration - how do I skip commissions if group discounts apply?
I think my question is an easy one for php guys. I'm definitely not one of those yet, I'm afraid.
I have setup a group discount that my affiliates use to purchase products at my store. The problem is, that I don't want to give them the group discount plus the affiliate commission. Just the group discount. The code that we are given from jrox to put in tpl_footer.php (in the checkout_success override directory), is as follows:
##########################################
## START JAM INTEGRATION WITH ZEN CART ##
## ZC Integration code by DrByte 8/2006 ##
##########################################
if ((int)$orders_id > 0) {
$JAM = $db->Execute("select class, value from " . TABLE_ORDERS_TOTAL . " where orders_id = '".(int)$orders_id."' AND class in ('ot_coupon', 'ot_subtotal', 'ot_group_pricing')");
while (!$JAM->EOF) {
switch ($JAM->fields['class']) {
case 'ot_subtotal':
$order_subtotal = $JAM->fields['value'];
break;
case 'ot_coupon':
$coupon_amount = $JAM->fields['value'];
break;
case 'ot_group_pricing':
$group_pricing_amount = $JAM->fields['value'];
break;
}
$JAM->MoveNext();
}
$commissionable_order = ($order_subtotal - $coupon_amount - $group_pricing_amount);
$commissionable_order = number_format($commissionable_order,2,'.','');
echo "<script language=\"JavaScript\" type=\"text/javascript\" src="/affiliates/sale.php?amount=$commissionable_order&trans_id=$orders_id\"></script></td></tr>
</table>";
}
#######################################
## END JAM INTEGRATION WITH ZEN CART ##
#######################################
Can someone help me with the code modification needed to block the generation of a commission if there is a group discount amount? This has got to be an easy one, something like:
if ($group_pricing_amount == 0)
{
echo "<script language="JavaScript" type="text/javascript" src="/affiliates/sale.php?amount=$commissionable_order&trans_id=$orders_id"></script>
}
But as you can see, I don't know php syntax. Can someone help me with this?