I have a small favour to ask..
As you already know, in Sale > Coupon, there are 2 fields we either leave it blank or enter a number.
This works perfectly -- it defaults to 0 upon saving -- if I leave it blank.
Problem comes for my Advanced Coupons & Sales Promotion extensions with similar codings for above, but when I tried to edit accordingly, it just literally left the field box blank - without defaulting to 0.Uses Per Coupon:
The maximum number of times the coupon can be used by any customer. Leave blank for unlimited
Uses Per Customer:
The maximum number of times the coupon can be used by a single customer. Leave blank for unlimited
Code: Select all
if (isset($this->error['uses_customer'])) {
$this->data['error_uses_customer'] = $this->error['uses_customer'];
} else {
$this->data['error_uses_customer'] = '';
}
if (isset($this->error['uses_total'])) {
$this->data['error_uses_total'] = $this->error['uses_total'];
} else {
$this->data['error_uses_total'] = '';
}
.
.
.
/* Old code
if (isset($this->request->post['uses_total'])) {
$this->data['uses_total'] = $this->request->post['uses_total'];
} elseif (isset($sales_promotion_info)) {
$this->data['uses_total'] = $sales_promotion_info['uses_total'];
} else {
$this->data['uses_total'] = 1;
}
*/
if (isset($this->request->post['uses_total'])) {
$this->data['uses_total'] = $this->request->post['uses_total'];
} elseif (!empty($sales_promotion_info)) {
$this->data['uses_total'] = $sales_promotion_info['uses_total'];
} else {
$this->data['uses_total'] = 1;
}
/* Old code
if (isset($this->request->post['uses_customer'])) {
$this->data['uses_customer'] = $this->request->post['uses_customer'];
} elseif (isset($sales_promotion_info)) {
$this->data['uses_customer'] = $sales_promotion_info['uses_customer'];
} else {
$this->data['uses_customer'] = 1;
}
*/
if (isset($this->request->post['uses_customer'])) {
$this->data['uses_customer'] = $this->request->post['uses_customer'];
} elseif (!empty($sales_promotion_info)) {
$this->data['uses_customer'] = $sales_promotion_info['uses_customer'];
} else {
$this->data['uses_customer'] = 1;
}
Previously there is validation to ensure a number is entered here, have since hidden that code.
Code: Select all
/* Removed Code
if (!is_numeric($this->request->post['uses_total'])) {
$this->error['uses_total'] = $this->language->get('error_uses_total');
}
if (!is_numeric($this->request->post['uses_customer'])) {
$this->error['uses_customer'] = $this->language->get('error_uses_customer');
}
*/