
Originally Posted by
zapme1
Running ZC version 1.5.7c
Most times a gift card balance isn't used immediately and the customer looses or deletes the email containing the redemption code!
?? Question:
Is there any way (for an admin) to enter a gift card dollar amount directly into a customers account? Is there a Plugin??
Code:
<?php
if (!empty($_POST['credit-submit'])) {
// update coupon_gv_customer table
$customer_id = $_POST['customers_id'];
$credit = 0;
$credit_check = $db->Execute('SELECT customer_id, amount FROM ' . TABLE_COUPON_GV_CUSTOMER . ' WHERE customer_id = "'. $customer_id . '"');
if($credit_check->RecordCount() < 1) {
$sql_data_array = array('customer_id' => $customer_id, 'amount' => $_POST['amount']);
zen_db_perform(TABLE_COUPON_GV_CUSTOMER, $sql_data_array);
} else {
echo $credit_check->fields['amount'];
$credit = $_POST['amount'] + $credit_check->fields['amount'];
$credit_update = $db->Execute('UPDATE ' . TABLE_COUPON_GV_CUSTOMER . ' SET amount = "' . $credit . '" WHERE customer_id = "' . $customer_id . '"');
}
?>
<form name="credit" method="post">
<div align="center"><strong>Issue a Credit</div><div align="center" id="customers_id">Order #: <?php echo zen_draw_pull_down_menu('customers_id', $credit_array);?><div align="center">Do not give credit for tax or delivery charges<br>$<input id="amount" type="text" name="amount" maxlength="5" placeholder="XX.XX" style="width: 50px;"/><br><input type="submit" name="credit-submit" value="Issue Credit"></div>
</form>
I use this on our website. My credit array is extensive though. You could change that to a simple input text with the customer id. This places a gift certificate directly into their account without it having to come from anywhere. Down side is you better trust anyone on your admin page because it doesn't restrict and doesn't allow you to monitor it other than watching what orders have the gift certificate.
Bookmarks