forked from hammadshahir/PHP-MySQL-ecommerce-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sidebar-category.php
63 lines (60 loc) · 3.68 KB
/
sidebar-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
<h3><?php echo LANG_VALUE_49; ?></h3>
<div id="left" class="span3">
<ul id="menu-group-1" class="nav menu">
<?php
$i=0;
$statement = $pdo->prepare("SELECT * FROM tbl_top_category WHERE show_on_menu=1");
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
$i++;
?>
<li class="cat-level-1 deeper parent">
<a class="" href="product-category.php?id=<?php echo $row['tcat_id']; ?>&type=top-category">
<span data-toggle="collapse" data-parent="#menu-group-1" href="#cat-lvl1-id-<?php echo $i; ?>" class="sign"><i class="fa fa-plus"></i></span>
<span class="lbl"><?php echo $row['tcat_name']; ?></span>
</a>
<ul class="children nav-child unstyled small collapse" id="cat-lvl1-id-<?php echo $i; ?>">
<?php
$j=0;
$statement1 = $pdo->prepare("SELECT * FROM tbl_mid_category WHERE tcat_id=?");
$statement1->execute(array($row['tcat_id']));
$result1 = $statement1->fetchAll(PDO::FETCH_ASSOC);
foreach ($result1 as $row1) {
$j++;
?>
<li class="deeper parent">
<a class="" href="product-category.php?id=<?php echo $row1['mcat_id']; ?>&type=mid-category">
<span data-toggle="collapse" data-parent="#menu-group-1" href="#cat-lvl2-id-<?php echo $i.$j; ?>" class="sign"><i class="fa fa-plus"></i></span>
<span class="lbl lbl1"><?php echo $row1['mcat_name']; ?></span>
</a>
<ul class="children nav-child unstyled small collapse" id="cat-lvl2-id-<?php echo $i.$j; ?>">
<?php
$k=0;
$statement2 = $pdo->prepare("SELECT * FROM tbl_end_category WHERE mcat_id=?");
$statement2->execute(array($row1['mcat_id']));
$result2 = $statement2->fetchAll(PDO::FETCH_ASSOC);
foreach ($result2 as $row2) {
$k++;
?>
<li class="item-<?php echo $i.$j.$k; ?>">
<a class="" href="product-category.php?id=<?php echo $row2['ecat_id']; ?>&type=end-category">
<span class="sign"></span>
<span class="lbl lbl1"><?php echo $row2['ecat_name']; ?></span>
</a>
</li>
<?php
}
?>
</ul>
</li>
<?php
}
?>
</ul>
</li>
<?php
}
?>
</ul>
</div>