function onValidateCoupon(Am_Event $e) { $batch = $e->getCouponBatch(); $coupon = $e->getCoupon(); $user = $e->getUser(); if ($user && $batch->aff_id && $batch->aff_id == $user->pk()) { $e->addReturn(___("You can't use your affiliate coupon code")); } if ($user && $coupon->aff_id && $coupon->aff_id == $user->pk()) { $e->addReturn(___("You can't use your affiliate coupon code")); } }