-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckout.php
131 lines (102 loc) · 2.56 KB
/
checkout.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php include("securearea.php"); ?>
<?php include("cart.php"); ?>
<?php
class Checkout extends Securearea
{
public $oCart;
function __construct()
{
parent::__construct();
$this->load->helper("url");
$this->oCart = new Cart();
$this->load->library('session');
}
function index()
{
$this->viewCartDetails();
}
public function viewCartDetails()
{
$this->hidecartlist = TRUE;
//load header
$this->loadHeader($this);
//load sidebar
//$this->loadSidebar($this);
//load middle content
$view['obj'] = $this;
$view['cartData'] = $this->oCart->getcurrentcart(TRUE);
$code = $this->input->post('coupon_box');
//echo $code;
$this->load->model("Cart_model");
$heep = $this->Cart_model->getCode($code);
$dis_percent = $heep[0]['discount'];
//echo $dis_percent;
$this->session->set_userdata('discount_percent',$dis_percent);
//if (!isset($_GET['r'])) { echo '<meta http-equiv="refresh" content= "0;URL=?r=1" />'; }
$this->load->view('cart_view',$view);
//print_r($view['cartData']);die;
$this->loadFooter($this);
}
/* public function getPostValue() {
$view['cartData'] = $this->oCart->getcurrentcart(TRUE);
$view['postValue'] = $view['cartData']['couponCode'];
print_r($view['postValue']);
$this->load->view('cart_view',$view);
} */
function printCouponCode($data)
{
$this->db->select('discount');
$this->db->from('_coupons');
$this->db->where('coupon_code',$data);
$query = $this->db->get();
$result = $query->result_array();
// echo "<pre>"; print_r($result[0]['discount']);die;
$coup = $result[0]['discount'];
return $coup;
}
function justatest($data)
{
$this->load->model("order_model");
if($this->order_model->gettestingdata())
{
return TRUE;
}
else
{
return FALSE;
}
}
public function removeItem($row_id)
{
$this->oCart->removeCartItem($row_id);
$this->oCart->getcurrentcart();
// redirect(base_url()."checkout","refresh");
}
function couponCode() {
$couponCode = $this->getCouponCode($_POST);
if($this->oCart->printCouponCode($couponCode))
{
//echo "hello";
$data = $this->oCart->printCouponCode($couponCode);
//echo $data;
//$this->load->view('cart_view', $data);
}
else {
echo "sorry";
}
$this->RefreshCheckoutPage();
}
private function getCouponCode($postData)
{
$couparray = array
(
"coupon" => $postData["coupon_box"],
);
return $couparray;
}
private function RefreshCheckoutPage()
{
redirect(base_url()."checkout","refresh");
}
}
?>