From b3f7f13d6b9909c7b6e4a04ccba361967f30127b Mon Sep 17 00:00:00 2001 From: Olusesan Ameye Date: Tue, 31 May 2022 18:55:14 -0400 Subject: [PATCH] fix --- www/application/controllers/Coupons.php | 8 +++++++- www/application/models/Coupon_model.php | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/www/application/controllers/Coupons.php b/www/application/controllers/Coupons.php index 44bcb9b4..46aff196 100644 --- a/www/application/controllers/Coupons.php +++ b/www/application/controllers/Coupons.php @@ -13,9 +13,15 @@ class Coupons extends Users_Controller { public function index(){ + $data = $this->getSessionArray(); + $this->load->model('coupon_model'); + $activeCouponResult = $this->coupon_model->loadMemberActiveCoupons($_SESSION['member_id'] ,$fliters=[]); + $_SESSION['coupon'] = $activeCouponResult->num_rows(); + $data['coupon_table_row'] = $activeCouponResult->result(); + $data['page_title'] ="Coupons"; + $this->renderSecurePage('users/view_coupon', $data); - } } \ No newline at end of file diff --git a/www/application/models/Coupon_model.php b/www/application/models/Coupon_model.php index c0308a68..5825b989 100644 --- a/www/application/models/Coupon_model.php +++ b/www/application/models/Coupon_model.php @@ -8,7 +8,7 @@ function __construct() { public function loadMemberActiveCoupons($member_id,$fliters=[]){ - $sql="SELECT ca.code, ca.amount, ca.added,ca.status + $sql="SELECT id, ca.code, ca.amount, ca.added::date,ca.status FROM coupons_allocation ca WHERE ca.member_id = $member_id ORDER BY ca.id DESC"; $q = $this->db->query($sql); return $q;