-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcheckout.php
executable file
·172 lines (149 loc) · 7.15 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
require("admin/bootstrap.php");
include( dirname(__FILE__) . SYSPATH_CONNECTION );
include( dirname(__FILE__) . SYSPATH_LANG );
include("includes/Sql/sql.class.php");
include("includes/_url.php");
$array_empresa = GenericSql::getEmpresa($database);
include_once $_SERVER['DOCUMENT_ROOT'] . $_SESSION['path'] . '/login/globals.php';
include CLASSES . '/User.php';
$user = $_SESSION['user'];
// If your page calls session_start() be sure to include jcart.php before session_start();
include_once('jcart/jcart.php');
session_start();
if (isset($_SESSION['CHECKOUT_ADD_CUSTOMER']) && $_SESSION['CHECKOUT_ADD_CUSTOMER'] == 1 && isset($_SESSION['IDCUSTOMER']) && isset($_SESSION['MSGOK']))
{
if ($_SESSION['MSGOK']==1)
{
$msg_reg_customer = '
<center>
<div class="alert-message success" style="width:92%;">
<p><strong> '.LBL_WARNING.' </strong> ' . MSG_CUSTOMER_REGISTER_SUCCESS . ' </p>
</div>
</center>';
}
// unset session from customer register
unset( $_SESSION['MSGOK'] );
unset( $_SESSION['CHECKOUT_ADD_CUSTOMER']);
//unset( $_SESSION['IDCUSTOMER'] );
}
// Clean up the cart
if ($_GET['done'] == 1)
{
$jcart->empty_cart();
GenericSql::Redirect($sec=3, $file="menu");
die( '<center><small>redirecionando ..</small><img src="images/loading.gif"></center>' );
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?=$array_empresa['nome_fantasia'];?> :: Checkout</title>
<link rel="stylesheet" type="text/css" media="screen, projection" href="style.css" />
<link rel="stylesheet" type="text/css" media="screen, projection" href="jcart/css/jcart.css" />
<script type="text/javascript" src="jcart/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="scripts/jquery.curvycorners.min.js"></script>
<link href="stylesheet/stylesheet.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="scripts/jquery-ui-1.8.4.custom.min.js"></script>
<link href="scripts/jqueryui/css/redmond/jquery-ui-1.8.4.custom.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="scripts/thickbox.js"></script>
<link href="scripts/thickbox.css" rel="stylesheet" type="text/css" />
</head>
<body>
<center>
<table border="0" cellspacing="0" cellpadding="0" align="center" width="990" class="table bg">
<tr>
<td>
<div id="wrapper">
<div id="content">
<img border=0 src="images/logo/<?php echo $array_empresa['0']['logotipo'];?>" />
<?php if (empty($_SESSION['PCS']['order_id'])) { ?>
<address>
<div>
<?php echo $array_empresa['0']['endereco'];?>, <?php echo $array_empresa['0']['numero'];?>, <?php echo $array_empresa['0']['bairro'];?>, CEP: <?php echo $array_empresa['0']['cep'];?> </div>
<div>
<?=LBL_DELIVERY_TIME;?> <?php echo $array_empresa['0']['abre'];?> - <?php echo $array_empresa['0']['fecha'];?></div>
</address>
<center><div style="background-color:#dcdcdc; height:1px; overflow:hidden; width:900px; margin-top:20px; margin-bottom:10px;" class="table bg"></div></center>
<?php } ?>
<!-- process checkout -->
<!-- Step 1 - The Cart the follow steps are in the jcart.php file -->
<?php
// Verify if has an active login or new customer registered (it creates a session IDCUSTOMER)
// $_SESSION["user"] needs to be creatd in login.php
// $_SESSION['IDCUSTOMER'] needs to be unset somewhere!
if (isset($_SESSION["user"]) || isset($_SESSION['IDCUSTOMER']) || isset($_SESSION['USER_EMAIL']))
{
echo $msg_reg_customer; ?>
<!-- <h2><img src="images/icons/check-alt.png" /> 1 <?=LBL_YOUR_ORDER;?> </h2><hr /> -->
<div id="jcart"><?php $jcart->display_cart();?></div> <?
#echo '<pre>DEBUG<br />';
#var_dump($_SESSION['jcart']);
#echo '</pre>';
#echo $subTotal = $jcart->subtotal;
}
// If checkout from personal chef service (PCS), then just need PayPal and Moip buttons to finish payment
elseif ( !empty( $_SESSION['PCS']['order_id'] ))
{
echo '<div id="jcart">' . $jcart->display_cart() . '</div>';
}
else
{
echo '<div style="height:200px; overflow:hidden;"></div>';
// Warning
echo '
<center>
<div class="alert-message success" style="width:96%;">
<p><strong> '.LBL_WARNING.' </strong> '. MSG_CUSTOMER_REGISTER_LOGIN_NEEDED .' </p>
</div>
</center>';
// Show only Customer Register and Keep Buying buttons
echo '<div style="width: 100%;">
<div style="width: 30%; padding: 1px; float: left;">
<form action="customer-registration?add=1" method="post">
<input type="submit" name="add" value="← ' . LBL_CUSTOMER_BTN_REGISTER . '" id="jcart-paypal-checkout" />
</form>
</div>
<div style="width: 23%; padding: 1px; float: left;">
<form action="log-in" method="post">
<input type="submit" value="← ' . LBL_CUSTOMER_BTN_LOGIN . '" id="jcart-paypal-checkout" />
</form>
</div>
<div style="width: 20%; padding: 1px; float: left;">
<form action="menu" method="post">
<input type="submit" value="← ' . LBL_CUSTOMER_BTN_BUY . '" id="jcart-paypal-checkout" />
</form>
</div>
</div> ';
}
?>
<!-- Step 1 -->
<!-- process checkout -->
</div>
<div class="clear"></div>
</div>
</td>
</tr>
<script type="text/javascript" src="jcart/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="jcart/js/jcart.min.js"></script>
<?php if ( empty( $_SESSION['PCS']['order_id'] )) { ?>
<tr>
<td>
<div style="background-color:#dcdcdc; height:1px; overflow:hidden; width:990px; margin-top:20px; margin-bottom:10px;" class="table bg"></div>
</td>
</tr>
<tr><td colspan=6> </td></tr>
<tr><td colspan=6> </td></tr>
<tr>
<td colspan=6>
<!-- footer -->
<?php require("_footer.inc.php"); ?>
<!-- footer -->
</td>
</tr>
<?php } ?>
</table>
</center>
</body>
</html>