-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshop.php
198 lines (191 loc) · 6.99 KB
/
shop.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
193
194
195
196
197
198
<?php
$pageTitle = 'Shop';
include('includes/templates/header.php');
$query = isset($_GET['category']) ? "WHERE categories.name = '$_GET[category]'" : '';
$products = $product->getData(
"SELECT items.*,
categories.name AS category_name
FROM items
INNER JOIN categories ON categories.id = items.category_id
$query LIMIT 9;
"
);
// shuffle($products);
if (!isset($cartIds)) {
if (isset($_SESSION['userId'])) {
$cartIds = $cart->getCartIds($product->getData("SELECT * FROM cart WHERE user_id=$_SESSION[userId]"));
} else {
$cartIds = array_keys($_SESSION['cart']);
}
}
?>
<!-- Breadcrumb Section Begin -->
<div class="breacrumb-section">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="breadcrumb-text">
<a href="index.php"><i class="fa fa-home"></i> Home</a>
<span>Shop</span>
</div>
</div>
</div>
</div>
</div>
<!-- Breadcrumb Section Begin -->
<!-- Product Shop Section Begin -->
<section class="product-shop spad">
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-6 col-sm-8 order-2 order-lg-1 produts-sidebar-filter">
<div class="filter-widget">
<h4 class="fw-title">Categories</h4>
<ul class="filter-catagories">
<?php foreach ($categories as $cat) : ?>
<li><a href="#"><?= $cat['name']; ?></a></li>
<?php endforeach; ?>
</ul>
</div>
<div class="filter-widget">
<h4 class="fw-title">Brand</h4>
<div class="fw-brand-check">
<div class="bc-item">
<label for="bc-calvin">
Asus
<input type="checkbox" id="bc-calvin">
<span class="checkmark"></span>
</label>
</div>
<div class="bc-item">
<label for="bc-diesel">
Lenovo
<input type="checkbox" id="bc-diesel">
<span class="checkmark"></span>
</label>
</div>
<div class="bc-item">
<label for="bc-polo">
Logitech
<input type="checkbox" id="bc-polo">
<span class="checkmark"></span>
</label>
</div>
<div class="bc-item">
<label for="bc-tommy">
Dell
<input type="checkbox" id="bc-tommy">
<span class="checkmark"></span>
</label>
</div>
</div>
</div>
<div class="filter-widget">
<h4 class="fw-title">Price</h4>
<div class="filter-range-wrap">
<div class="range-slider">
<div class="price-input">
<input type="text" id="minamount">
<input type="text" id="maxamount">
<input type="hidden" id="hidden-min-price" />
<input type="hidden" id="hidden-max-price" />
</div>
</div>
<div class="price-range ui-slider ui-corner-all ui-slider-horizontal ui-widget ui-widget-content" data-min="10" data-max="5000">
<div class="ui-slider-range ui-corner-all ui-widget-header"></div>
<span tabindex="0" class="ui-slider-handle ui-corner-all ui-state-default"></span>
<span tabindex="0" class="ui-slider-handle ui-corner-all ui-state-default"></span>
</div>
</div>
<a href="#" class="filter-btn">Filter</a>
</div>
<div class="filter-widget">
<h4 class="fw-title">Tags</h4>
<div class="fw-tags">
<a href="#">Laptops</a>
<a href="#">Desktops</a>
<a href="#">Mice</a>
<a href="#">Keyboards</a>
<a href="#">Chairs</a>
<a href="#">Smartphones</a>
<a href="#">Consoles</a>
</div>
</div>
</div>
<div class="col-lg-9 order-1 order-lg-2">
<div class="product-show-option">
<div class="row">
<div class="col-lg-7 col-md-7">
<div class="select-option">
<select class="sorting">
<option value="">Default Sorting</option>
</select>
<select class="p-show">
<option value="">Show:</option>
</select>
</div>
</div>
<div class="col-lg-5 col-md-5 text-right">
<p>Show 01- 09 Of 36 Product</p>
</div>
</div>
</div>
<div class="product-list">
<div class="row">
<?php foreach ($products as $item) : ?>
<div class="col-lg-4 col-sm-6">
<div class="product-item">
<div class="pi-pic">
<a href="product.php?item_id=<?= $item['id']; ?>">
<img src="uploads/itemImages/<?= $item['image']; ?>" alt="" />
</a>
<div class="sale pp-sale">Sale</div>
<div class="icon">
<i class="icon_heart_alt"></i>
</div>
<ul>
<li class="w-icon active">
<?php if (in_array($item['id'], $cartIds)) : ?>
<button class="icon_bag_green" disabled><i class="icon_bag_alt"></i></button>
<?php else : ?>
<button type="button" class="bag-icon" data-itemid="<?= $item['id']; ?>" data-userid="<?= $_SESSION['userId'] ?? ''; ?>"><i class="icon_bag_alt"></i></button>
<?php endif; ?>
</li>
<li class="quick-view"><a href="#">+ Quick View</a></li>
<li class="w-icon">
<a href="#"><i class="fa fa-random"></i></a>
</li>
</ul>
</div>
<div class="pi-text">
<div class="catagory-name"><?= $item['category_name']; ?></div>
<a href="product.php?item_id=<?= $item['id']; ?>">
<h5><?= $item['name']; ?></h5>
</a>
<div class="product-price">
$<?= number_format($item['price'], 2); ?>
<span>
<?php
$price = (float) $item['price'];
$result = $price + ($price * 30 / 100);
echo '&' . number_format($result, 2);
?>
</span>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<div class="loading-more">
<i class="icon_loading"></i>
<a href="#">
Loading More
</a>
</div>
</div>
</div>
</div>
</section>
<!-- Product Shop Section End -->
<?php include('includes/templates/footer.php'); ?>