
Originally Posted by
Ajeh
If the Store Owner marks the Discount Coupon as Inactive by deleting it, then it is flagged deleted ...
If it just expires, that is not being marked as Deleted, just as not being usable ... if the Store Owner changes the expiration date, then the Discount Coupon is valid ... to this is purely a Store Owner choice to mark the Discount Coupon as Deleted ...
Once the Store Owner marks the Discount Coupon as Deleted, there is NOT an option to Un-delete the Discount Coupon by the Store Owner. This is when the database would need to be hacked ...
Hi Linda,
Because I needed to be able to reactivate discount coupons from admin, I made a few simple changes to do the job.
In ZC1.5.4 admin/coupon_admin.php around line 112:
PHP Code:
//jpda: bof toggle coupon_active instead of setting to 'N' always
// get current status
$ca_sql = $db->Execute("select coupon_active from " .TABLE_COUPONS . " where coupon_id = '" . $_GET['cid'] . "'");
$new_coupon_active = ($ca_sql->fields['coupon_active'] == 'N') ? '"Y"' : '"N"';
// $messageStack->add_session('$ca_sql=' . $ca_sql->fields['coupon_active'], 'caution');
[COLOR="#FF0000"] $db->Execute("update " . TABLE_COUPONS . "
set coupon_active = $new_coupon_active
where coupon_id='".$_GET['cid']."'");
[/COLOR] $messageStack->add_session(($new_coupon_active == '"N"') ? SUCCESS_COUPON_DISABLED : 'Success! Discount Coupon was set to Active ...!', 'success');
// replacing
// $db->Execute("update " . TABLE_COUPONS . "
// set coupon_active = 'N'
// where coupon_id='".$_GET['cid']."'");
// $messageStack->add_session(SUCCESS_COUPON_DISABLED, 'success');
// replacing
//jpda: eof toggle coupon_active instead of setting to 'N' always
Now the delete button will toggle the status. Need to make some changes to the button texts and add some language defines etc., but it works.
Questions:
Is this acceptable?
Could the code at $ca_sql be done easier?
On the side, not really related to the subject, the selection character '*' to display all discount coupons does not work, I replaced it by 'A'. The '*' is still present in the ZC1.5.5 version.
Background:
A client of mine is using the Autoresponder+ mod, which sends emails to customers, asking them to write a review. The email contains an active discount coupon. Thus, the customer might use the coupon and forget all about the review.
I change the mod to send an inactive discount coupon, my client needs to be able to reactivate the coupon when the review arrives.
Thanks in advance,
jpda
Bookmarks