Not saved coupon history. Therefore coupon limitations do not work.
To fix this issue, open file
system/tastyigniter/models/Orders_model.php
see lines 464-466:
[php]if ( ! empty($cart_contents['coupon'])) {
$this->addOrderCoupon($order_id, $order_info['customer_id'], $cart_contents['coupon']);
}[/php]
should be
[php]if ( ! empty($cart_contents['totals']['coupon'])) {
$this->addOrderCoupon($order_id, $order_info['customer_id'], $cart_contents['totals']['coupon']);
}[/php]
and lines 618-638:
[php]public function addOrderCoupon($order_id, $customer_id, $coupon) {
if (is_array($coupon) AND is_numeric($coupon['discount'])) {
$this->db->where('order_id', $order_id);
$this->db->delete('coupons_history');
$this->load->model('Coupons_model');
$temp_coupon = $this->Coupons_model->getCouponByCode($coupon['code']);
$this->db->set('order_id', $order_id);
$this->db->set('customer_id', empty($customer_id) ? '0' : $customer_id);
$this->db->set('coupon_id', $temp_coupon['coupon_id']);
$this->db->set('code', $temp_coupon['code']);
$this->db->set('amount', '-' . $coupon['discount']);
$this->db->set('date_used', mdate('%Y-%m-%d %H:%i:%s', time()));
if ($this->db->insert('coupons_history')) {
return $this->db->insert_id();
}
}
}[/php]
should be
[php]public function addOrderCoupon($order_id, $customer_id, $coupon) {
if (is_array($coupon) AND is_numeric($coupon['amount'])) {
$this->db->where('order_id', $order_id);
$this->db->delete('coupons_history');
$this->load->model('Coupons_model');
$temp_coupon = $this->Coupons_model->getCouponByCode($coupon['code']);
$this->db->set('order_id', $order_id);
$this->db->set('customer_id', empty($customer_id) ? '0' : $customer_id);
$this->db->set('coupon_id', $temp_coupon['coupon_id']);
$this->db->set('code', $temp_coupon['code']);
$this->db->set('min_total', $temp_coupon['min_total']);
$this->db->set('amount', '-' . $coupon['amount']);
$this->db->set('date_used', mdate('%Y-%m-%d %H:%i:%s', time()));
if ($this->db->insert('coupons_history')) {
return $this->db->insert_id();
}
}
}[/php]