-
Notifications
You must be signed in to change notification settings - Fork 0
/
pageproductbyori.php
130 lines (129 loc) · 7.81 KB
/
pageproductbyori.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
<?php include 'inc/header.php'; ?>
<?php
if (!isset($_GET['originID']) || empty($_GET['originID'])) {
echo "<script>window.location = 'index.php'</script>";
} else {
$checkProduct = $product->get_product_by_origin($_GET['originID']);
if ($checkProduct) {
$originID = $_GET['originID'];
} else {
echo "<script>window.location = '404.php'</script>";
}
}
if (isset($_GET['page'])) {
$get_page = $_GET['page'];
} else {
$get_page = '';
}
if ($get_page == '' || $get_page == 1) {
$page = 0;
} else {
$page = $get_page * 15 - 15;
}
?>
<div id="page-search">
<div class="container">
<div class="page-search-inner">
<h2 class="page-search-result-header">
<svg viewBox="0 0 18 24" class="shopee-svg-icon icon-hint-bulb"><g transform="translate(-355 -149)"><g transform="translate(355 149)"><g fill-rule="nonzero" transform="translate(5.4 19.155556)"><path d="m1.08489412 1.77777778h5.1879153c.51164401 0 .92641344-.39796911.92641344-.88888889s-.41476943-.88888889-.92641344-.88888889h-5.1879153c-.51164402 0-.92641345.39796911-.92641345.88888889s.41476943.88888889.92641345.88888889z"></path><g transform="translate(1.9 2.666667)"><path d="m .75 1.77777778h2.1c.41421356 0 .75-.39796911.75-.88888889s-.33578644-.88888889-.75-.88888889h-2.1c-.41421356 0-.75.39796911-.75.88888889s.33578644.88888889.75.88888889z"></path></g></g><path d="m8.1 8.77777718v4.66666782c0 .4295545.40294373.7777772.9.7777772s.9-.3482227.9-.7777772v-4.66666782c0-.42955447-.40294373-.77777718-.9-.77777718s-.9.34822271-.9.77777718z" fill-rule="nonzero"></path><path d="m8.1 5.33333333v.88889432c0 .49091978.40294373.88888889.9.88888889s.9-.39796911.9-.88888889v-.88889432c0-.49091977-.40294373-.88888889-.9-.88888889s-.9.39796912-.9.88888889z" fill-rule="nonzero"></path><path d="m8.80092773 0c-4.86181776 0-8.80092773 3.97866667-8.80092773 8.88888889 0 1.69422221.47617651 3.26933331 1.295126 4.61333331l2.50316913 3.9768889c.30201078.4782222.84303623.7697778 1.42482388.7697778h7.17785139c.7077799 0 1.3618277-.368 1.7027479-.9617778l2.3252977-4.0213333c.7411308-1.2888889 1.1728395-2.7786667 1.1728395-4.37688891 0-4.91022222-3.9409628-8.88888889-8.80092777-8.88888889m0 1.77777778c3.82979317 0 6.94810087 3.18933333 6.94810087 7.11111111 0 1.24444441-.3168334 2.43022221-.9393833 3.51466671l-2.3252977 4.0213333c-.0166754.0284444-.0481735.0462222-.0833772.0462222h-7.07224026l-2.43461454-3.8648889c-.68184029-1.12-1.04128871-2.4053333-1.04128871-3.71733331 0-3.92177778 3.11645483-7.11111111 6.94810084-7.11111111"></path></g></g></svg>
Kết quả tìm kiếm cho xuất xứ '<span><?php echo $checkProduct->fetch_assoc()['originName']; ?></span>'
</h2>
<div class="page-search-sort-bar">
<label>Sắp xếp theo</label>
<div class="page-search-sort-by-options">
<a href="#" class="page-search-sort-by-options__option page-search-sort-by-options__option--selected">Liên Quan</a>
<a href="#" class="page-search-sort-by-options__option">Mới Nhất</a>
<a href="#" class="page-search-sort-by-options__option">Bán Chạy</a>
<div class="select-with-status">
<div class="select-with-status__holder">
<span>Giá</span>
<span><i class="fas fa-chevron-down"></i></span>
<div class="select-with-status__dropdown">
<a href="#">Giá: Thấp đến Cao</a>
<a href="#">Giá: Cao đến Thấp</a>
</div>
</div>
</div>
</div>
<div class="page-search-mini-page-controller">
<p><span>1</span>/100</p>
<a href="#" class="disabled"><i class="fas fa-chevron-left"></i></a>
<a href="#"><i class="fas fa-chevron-right"></i></a>
</div>
</div>
<ul class="page-search-items">
<?php
$productByOrigin = $product->get_product_by_origin($originID, 15, $page);
if ($productByOrigin) {
while ($result = $productByOrigin->fetch_assoc()) {
?>
<li class="page-search-items__item">
<a href="pageproduct.php?productID=<?php echo $result['productID']; ?>">
<div class="search-item-link">
<div class="search-item-image">
<?php
$image = $productImage->get_image_by_ID($result['productID']);
if ($image) {
?>
<img src="admin/uploads/product/<?php echo $image->fetch_assoc()['productImage']; ?>" alt="image" />
<?php } ?>
</div>
<div class="search-item-detail">
<div class="search-item-detail-name">
<h5><?php echo $result['productName']; ?></h5>
</div>
<div class="search-item-detail-price">
<p class="price"><span>₫</span><?php echo number_format($result['productPrice']); ?></p>
<p class="sole">Đã bán <?php echo number_format($result['productSold']); ?></p>
</div>
</div>
<div class="search-item__sale-notice">
<p><span>30%</span>Giảm</p>
</div>
</div>
<div class="search-item-link--hover">
Xem thông tin sản phẩm
</div>
</a>
</li>
<?php } } ?>
</ul>
<div class="page-search-page-controller">
<a<?php
if ($get_page == '' || $get_page == 1) {
echo ' style="pointer-events: none;"';
} else {
echo ' href="?originID='.$originID.'&page='.($get_page - 1).'"';
}
?>><i class="fas fa-chevron-left"></i></a>
<?php
$pagination = $product->get_product_by_origin($originID);
if ($pagination) {
$a = ceil($pagination->num_rows / 15);
for ($i = 1; $i <= $a; $i++) {
?>
<a href="?originID=<?php echo $originID; ?>&page=<?php echo $i; ?>" <?php
if ($get_page == '' && $i == 1) {
echo 'class="primary"';
} elseif ($i == $get_page) {
echo 'class="primary"';
}
?>><?php echo $i; ?></a>
<?php } ?>
<a<?php
if ($a == 1) {
echo ' style="pointer-events: none;"';
} elseif ($get_page == '') {
echo ' href="?originID='.$originID.'&page='.($get_page + 2).'"';
} elseif ($get_page < $a) {
echo ' href="?originID='.$originID.'&page='.($get_page + 1).'"';
} else {
echo ' style="pointer-events: none;"';
}
?>><i class="fas fa-chevron-right"></i></a>
<?php } ?>
</div>
</div>
</div>
</div>
<?php include 'inc/footer.php'; ?>