-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcategory.php
75 lines (42 loc) · 1.47 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
<?php include_once __DIR__ . "/assets/php/app.php" ?>
<?php
chechkSiteVisibilityStatusAndRedirect($dbConn);
chechkNumberOfProductsANdCategoriesAndDisplayMessage( $dbConn );
$site_titile = getSiteName($dbConn)[0];
if ( isset( $_GET["category-slug"] ) && !empty( $_GET["category-slug"] ) )
{
$id = $_GET["category-slug"];
$checkIfRecordExist = chechkIfValueExist($dbConn, 'table_categories', "category_slug", $id);
if ( $checkIfRecordExist != 1 )
{
loadProductNotFoundPage();
exit;
}
$category = getCategoryDetails($dbConn, $id);
$categoryName = $category["category_name"];
$products = getAllProductsWithCategoryName($dbConn, $category["category_slug"]);
$count = count( $products );
if ( $count === 0 )
{
loadProductNotFoundPage();
exit;
}
}
else
{
load404Page();
exit;
}
?>
<?php require_once 'assets/pages/head.php' ?>
<title> Category '<?php echo $categoryName; ?>' - <?php echo $site_titile ?></title>
</head>
<body>
<div class="container-fluid">
<?php require_once 'assets/pages/navigation.php' ?>
<div class="contents container-fluid">
<?php require_once 'assets/pages/sidebar.php' ?>
<?php include_once 'assets/pages/category.php' ?>
</div>
</div>
<?php require_once 'assets/pages/footer.php' ?>