-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathresults.php
103 lines (102 loc) · 4.11 KB
/
results.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
<?php
include 'includes/db.php';
include 'functions/functions.php';
include_once 'includes/header.php';
?>
<div id="content">
<div class="container">
<div class="row">
<div class="col-md-12 mt-4">
<nav aria-label="breadcrumb">
<ul class="breadcrumb">
<li class="breadcrumb-item">
<a href="index.php">Home</a>
</li>
<li class="breadcrumb-item active" aria-current="page">Search Result</li>
</ul>
</nav>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="Products">
<?php
if (isset($_GET['search'])) {
$user_keyword = $_GET['user_query'];
$get_products = "select * from products where product_keywords like '%$user_keyword%'";
$run_products = mysqli_query($conn, $get_products);
$count = mysqli_num_rows($run_products);
if ($count == 0) {
echo "
<div class='card mb-4'>
<div class='card-body'>
<h2>No Search Results Found <span style='color:red'>$user_keyword</span></h2>
</div>
</div>
";
} else {
echo "<div class='row'>";
while ($row_products = mysqli_fetch_array($run_products)) {
$pro_id = $row_products['product_id'];
$pro_title = $row_products['product_title'];
$pro_price = $row_products['product_price'];
$pro_img1 = $row_products['product_img1'];
$pro_label = $row_products['product_label'];
$manufacturer_id = $row_products['manufacturer_id'];
$get_manufacturer = "select * from manufacturers where manufacturer_id='$manufacturer_id'";
$run_manufacturer = mysqli_query($conn, $get_manufacturer);
$row_manufacturer = mysqli_fetch_array($run_manufacturer);
$manufacturer_name = $row_manufacturer['manufacturer_title'];
$pro_psp_price = $row_products['product_psp_price'];
$pro_url = $row_products['product_url'];
if ($pro_label == "Sale" or $pro_label == "Gift") {
$product_price = "<del> $$pro_price </del>";
$product_psp_price = "| $$pro_psp_price";
} else {
$product_psp_price = "";
$product_price = "$$pro_price";
}
if ($pro_label == "") {
} else {
$product_label = "
<a class='label sale' href='#' style='color:black;'>
<div class='thelabel'>$pro_label</div>
<div class='label-background'> </div>
</a>
";
}
echo "
<div class='col-md-3 col-sm-6 center-responsive' >
<div class='product' >
<a href='$pro_url' >
<img src='admin_area/product_images/$pro_img1' class='img-fluid' >
</a>
<div class='text' >
<center>
<p class='btn btn-primary'>Manufacturer: $manufacturer_name </p>
</center>
<hr>
<h3><a href='$pro_url' >$pro_title</a></h3>
<p class='price' > $product_price $product_psp_price </p>
<p class='buttons' >
<a href='$pro_url' class='btn btn-secondary' >View details</a>
<a href='$pro_url' class='btn btn-primary'>
<i class='fa fa-shopping-cart'></i> Add to cart
</a>
</p>
</div>
$product_label
</div>
</div>
";
}
}
echo "</div>";
}
?>
</div>
</div>
</div>
</div>
</div>
<?php include_once 'includes/footer.php'; ?>