Validating a coupon

2 posts by 2 authors in: Forums > CMS Builder
Last Post: October 25, 2011   (RSS)

I am able to validate a coupon using some of your existing code from the website membership add on... but while validating the coupon, I need to also make sure the coupon relates to the product detail page it's on.

I know how to do it, but I don't know how to write it. here's the code I have that checks the code for existance.

// validate coupon code
if (!$errorsAndAlerts) {
$count = mysql_select_count_from('coupon_codes', "`code` = '".mysql_escape(@$_REQUEST['couponCode'])."'");

if ($count > 0 && @$_REQUEST['couponCode']) { $errorsAndAlerts .= "Your code has been validated! Please fill out the form below to process your order\n";
$showSignupForm = true; }

else if(!$count > 0 && @$_REQUEST['couponCode']) { $errorsAndAlerts .= "Your code is not valid! Please check the code and try again. If you feel you've gotten this message in error, please contact us.\n"; }


when it checks the code, it also needs to check to make sure it's 'item_reference' matches the detailrecord 'title'

anything you can do would be appreciated.
John Tedesco

Creative Director



JAM Graphics