-
Notifications
You must be signed in to change notification settings - Fork 3
/
category.php
144 lines (122 loc) · 4.04 KB
/
category.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
<?php
include 'connection.php';
include 'Vars.php';
include 'common/shopName.php';
?>
<!DOCTYPE html>
<html>
<head>
<?php
include 'common/head.php';
?>
<link rel="stylesheet" type="text/css" href="Style/category.css">
<style type="text/css">
</style>
</head>
<body>
<?php
include 'common/header.php';
?>
<section id="main-content">
<div class="jumbotron">
<div class="container text-center">
<h1 class="display-2"> Categories </h1>
<strong><h4 class="mark"> We will not provide you what you want, but what you should have </h4></strong>
</div>
</div>
<?php
$x = $_SESSION['id'];
$sql = "SELECT * FROM category WHERE owner = '$x' ";
// echo $sql;
$cats = $con->query("SELECT * FROM category WHERE owner = '$x' ;");
while ($row = $cats->fetch_assoc()) {
$htm = "";
$htm .= '<div class="cat row alert alert-success" style="text-align: center; align-items: center; display: block">';
$htm .= '<div style="margin:auto;" class= >';
$htm .= '<div class=" bullet" style="background: url('."'".$row['pic_loc']."'".'); background-repeat: no-repeat; background-size: 100% 100%; background-position: center; "> </div>';
$htm .= '<div class=" name"> '.$row['name'].' </div>';
$htm .= '</div>';
echo $htm;
$sql = "SELECT `id`, `name`, `rate`, `category`, `pic_loc`, `description` FROM `product` WHERE `category` ='".$row['name']."' and owner = '".$_SESSION['id']."';";
// echo $sql;
$pros = $con->query("SELECT `id`, `name`, `rate`, `category`, `pic_loc`, `description` FROM `product` WHERE `category` ='".$row['name']."' and owner = '".$_SESSION['id']."';");
if ($pros->num_rows == 0) {
echo "</div>";
continue;
}
echo '<div class="all_pro row" style="display: none;">';
while ($col = $pros->fetch_assoc()) {
$htm = "";
$htm .= '<div class="row product">';
$htm .= '<div class="pic col-1" style="background: url('."'".$col['pic_loc']."'".'); background-repeat: no-repeat; background-size: 100% 100%; background-position: center; ">';
$htm .= '</div>';
$htm .= '<div class="title col-3">';
$htm .= $col['name'];
$htm .= '</div> ';
$htm .= '<div class="description col-3">';
$htm .= $col['description'];
$htm .= '</div>';
$htm .= '<div class="rate col-3">';
$htm .= $col['rate'];
$htm .= '</div>';
$htm .= '</div>';
echo $htm;
}
$htm = "";
$htm .= "</div>";
$htm .= "</div>";
echo $htm;
}
?>
<?php
/*
<div class="cat row alert alert-success">
<div class=" bullet" style="background: url();"> </div>
<div class=" name"> name1 </div>
<div class="all_pro" style="display: none;">
<div class=" col-sm-12 product">
<div class="pic" style="background: url(); background-repeat: no-repeat; background-size: 100% 100%; background-position: center;">
pic 1
</div>
<div class="title">
title 1
</div>
<div class="description">
descr 1
</div>
<div class="rate">
price 1
</div>
</div>
<div class="product col-sm-12"> </div>
<div class="product col-sm-12"> </div>
<div class="product col-sm-12"> </div>
</div>
</div>
<div class="cat row alert alert-success">
<div class="bullet "> </div>
<div class="name "> name1 </div>
</div>
*/
?>
</section>
<?php
include 'common/footer.php';
?>
<script src="Javascript/category.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var x=1;
$(".cat").click(function(){
if (x%2) {
$(this).children(".all_pro").slideDown(100);
}
else{
$(this).children(".all_pro").slideUp(1000);
}
x++;
});
});
</script>
</body>
</html>