fixed coupon bugs

fix add and edit bug
This commit is contained in:
Focuslinkstech 2024-12-25 10:20:29 +01:00
parent 2dc50c3637
commit cf6f89b3f2
2 changed files with 6 additions and 6 deletions

View File

@ -39,7 +39,7 @@ switch ($action) {
$type = _post('type', ''); $type = _post('type', '');
$value = floatval(_post('value', '')); $value = floatval(_post('value', ''));
$description = _post('description', ''); $description = _post('description', '');
$max_usage = _post('max_usage', ''); $max_usage = _post('max_usage', '0');
$min_order_amount = _post('min_order_amount', ''); $min_order_amount = _post('min_order_amount', '');
$max_discount_amount = intval(_post('max_discount_amount', '')); $max_discount_amount = intval(_post('max_discount_amount', ''));
$status = _post('status', 'active'); $status = _post('status', 'active');
@ -59,8 +59,8 @@ switch ($action) {
if (empty($description)) { if (empty($description)) {
$error[] = Lang::T('Coupon Description is required'); $error[] = Lang::T('Coupon Description is required');
} }
if (empty($max_usage)) { if ($max_usage < 0) {
$error[] = Lang::T('Coupon Maximum Usage is required'); $error[] = Lang::T('Coupon Maximum Usage must be greater than or equal to 0');
} }
if (empty($min_order_amount)) { if (empty($min_order_amount)) {
$error[] = Lang::T('Coupon Minimum Order Amount is required'); $error[] = Lang::T('Coupon Minimum Order Amount is required');
@ -170,8 +170,8 @@ switch ($action) {
if (empty($description)) { if (empty($description)) {
$error[] = Lang::T('Coupon description is required'); $error[] = Lang::T('Coupon description is required');
} }
if (empty($max_usage)) { if ($max_usage < 0) {
$error[] = Lang::T('Coupon maximum usage is required'); $error[] = Lang::T('Coupon Maximum Usage must be greater than or equal to 0');
} }
if (empty($min_order_amount)) { if (empty($min_order_amount)) {
$error[] = Lang::T('Coupon minimum order amount is required'); $error[] = Lang::T('Coupon minimum order amount is required');

View File

@ -56,7 +56,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Max Usage')}</label> <label class="col-md-2 control-label">{Lang::T('Max Usage')}</label>
<div class="col-md-6"> <div class="col-md-6">
<input type="number" class="form-control" name="max_usage" value="0" required> <input type="number" class="form-control" name="max_usage" value="0" required placeholder="0 is Unlimited">
<p class="help-block"><small>{Lang::T('Maximum number of times this coupon can be used 0 is Unlimited')}</small></p> <p class="help-block"><small>{Lang::T('Maximum number of times this coupon can be used 0 is Unlimited')}</small></p>
</div> </div>
</div> </div>