Gift certificates not posting as redeemed
In site builder version 2.5 or lower, there is a bug that keeps redeemed gift certificates from being noted in the gift certificates area. They still show up in the orders area, but the certificates aren't marked as redeemed in the gift certificates section.
To correct that, use the 2.51 version files or later, or add the code:
// REDEEM CERTIFICATES
if (!empty($voucher) AND $vval > 0)
{
// Get issue number and compare price
$gcissue = substr($voucher, -4);
$gcamt = number_format($vval, 2, '.', '');
$gcquery = "SELECT ID FROM " .$DB_Prefix ."_giftcerts WHERE IssueNum = '$gcissue' AND Amount = '$gcamt'";
$gcresult = mysql_query($gcquery, $dblink);
$gcnum = mysql_num_rows($gcresult);
// Redeem match
if ($gcnum == 1)
{
$gcrow = mysql_fetch_row($gcresult);
$updquery = "UPDATE " .$DB_Prefix ."_giftcerts SET IssueNum='$gcissue', Amount='$gcamt', RedeemedOrder='$id', DateRedeemed='$today' WHERE ID='$gcrow[0]'";
$updresult = mysql_query($updquery, $dblink);
// Send notification email to site owner
$gcrmsg = "The following gift certificate has been redeemed: ";
$gcrmsg .= "Order #: $id ";
$gcrmsg .= "Issue Number: $gcissue ";
$gcrmsg .= "Purchased On: $today ";
$gcrmsg .= "Please check your administration area for details.";
@mail("$adminemail", "Gift Certificate Redeemed", "$gcrmsg", "From: $adminemail Reply-To: $adminemail");
}
}
to the finish.php page in the /go/ folder, just *above* the line:
// UPDATE GIFT CERTIFICATES