-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
193 lines (157 loc) · 5.72 KB
/
index.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?php session_start();
//----------------------------------------------
require_once("includes/error.php");
require_once("includes/header.php");
require_once("includes/paging.php");
require_once("dbclass/Dbpdo.class.php");
require_once("functions/misc.php");
require_once("functions/cart.php");
require_once("classes/clsinput.php");
//----------------------------------------------
//THE FOLLOWING TWO ITEMS CONTROL THE PAGING :
$paging = true;
$pagesize = 10; //The size of a page in row numbers
//*************************************************
$startrow = 0; //The row to begin display from (normally 0)
$pageno = 1; //The number of the page to be displayed for the first page (normally 1)
//----------------------------------------------
//----------------------------------------------
if ($paging == true) {
if (isset($_GET['page'])) {
$pageno = $_GET['page'];
if (!is_numeric($pageno)) {exit;}
$startrow = ($pageno - 1) * $pagesize;
} else {
$pageno = 1;
$startrow = 0;
}
}
//----------------------------------------------
$submitAction = input::get('action');
$submitRecid = input::get('recid');
$_SESSION['from'] = curPageURL();
//$submitFromURL = input::get('from');
$submitFromURL = "";
if ($submitAction == "add") {
if ( checkrecid($submitRecid) != 0 ) {
$physical = 1; //is always physical in this case
add($submitRecid, $submitFromURL, $physical);
}
}
//-----------------------------------------
//Find number of items in the cart
if ( isset($_SESSION['session_cart']) ){
$numberincart = count($_SESSION['session_cart']);
}else{
$numberincart = 0;
}
?>
<?php
require_once("includes/menu.php");
?>
<div class="container">
<div class="shoppingproducts">
<div class="row">
<div class="col-md-12">
<h2>Fast Shopping Cart</h2>
</div>
</div>
<div class="row">
<div class="col-md-12">
<p>
<span class="basket-setting"><?php echo($numberincart); ?><a href="viewcart.php"> Basket</a> <i class="fa fa-shopping-basket fa-1x" aria-hidden="true"></i></span>
<br/>
</p>
</div>
</div>
<div class="row">
<div class="col-md-12">
<img src="assets/shopping_cart.png" alt="Shopping cart image" class="img-fluid" />
</div>
</div>
<div class="row">
<div class="col-md-12">
<hr>
</div>
</div>
<?php
//Retrieve all product items
$productdetails = publishedproducts($paging, $startrow, $pagesize);
$totalrowcount = count( publishedproducts(false, "", "") );
?>
<div class="row">
<div class="col-md-12">
<hr>
<?php
if ($paging == true && $totalrowcount > 0)
{
echo(displaypaging($pagesize, $startrow, $pageno, $totalrowcount));
}
?>
</div>
</div>
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-4">
<?php
if ($totalrowcount == 0)
{
echo("No records found");
}
?>
</div>
<div class="col-md-4">
</div>
</div>
<div class="row row-eq-height">
<?php
foreach( $productdetails as $d_row ) {
$recid = $d_row["recid"];
?>
<div class="col-sm-6 col-md-4 col-lg-3">
<h2>
<a href="detail.php?recid=<?php echo($recid); ?>" class="product"><?php echo($d_row['item_name']); ?></a>
</h2>
<img src="<?php echo( $d_row['item_image'] ); ?>"
class="img-fluid img-thumbnail rounded"
style="max-width:100%; height:auto; padding-top:15px;border: none;"
alt="<?php echo($d_row['item_title']); ?>"
width="150" />
<p class="cost"><?php echo($d_row['currency']); ?><?php echo($d_row['mc_gross']); ?></p>
<p>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="recid" value="<?php echo($recid); ?>" />
<input type="hidden" name="action" value="add" />
<input type="hidden" name="from" value="<?php echo ($_SERVER['PHP_SELF']); ?>" />
<button type="submit" class="btn btn-info">Add to cart</button>
</form>
</p>
<?php echo( $d_row['item_description'] ); ?>
<p><a href="detail.php?recid=<?php echo($d_row['recid']); ?>" class="product">See more...</a></p>
</div>
<?php
}
?>
</div>
<div class="row">
<div class="col-md-12">
<?php
if ($paging == true && $totalrowcount > 0)
{
echo(displaypaging($pagesize, $startrow, $pageno, $totalrowcount));
}
?>
<hr>
</div>
</div>
</div> <!-- End shoppingproducts -->
<?php
require_once("includes/copyright.php");
?>
</div> <!-- End container -->
<?php
require_once("includes/footer.php");
?>