-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcategoryitems.php
125 lines (113 loc) · 6.52 KB
/
categoryitems.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
<?php
//page controller
$pageUi='categoryitems';
include_once 'config.php';
?>
<!-- common header -->
<?php include 'commonheader.php'; ?>
<!-- common header -->
<!----------------------------- filters + products ------------------------------------>
<main>
<div class="container border-bottom border-3 p-3 pb-0">
<div class="row ">
<div class="col-10 col-md-auto d-flex flex-row align-items-center text-nowrap me-2 my-3">
<?php if(isset($catId)):
$catObj=new Category($catId);
?>
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="?catid=<?php echo $catId; ?>"><?php echo $catObj->getName(); ?></a></li>
</ol>
</nav>
<?php endif; ?>
<?php if(isset($subId)):
$subObj=new SubCategory($subId);
?>
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="?catid=<?php echo $subObj->getCategory()->getCategoryId(); ?>"><?php echo $subObj->getCategory()->getName(); ?></a></li>
<li class="breadcrumb-item active" aria-current="page"><?php echo $subObj->getName(); ?></li>
</ol>
</nav>
<?php endif; ?>
</div>
<div class="col-10 col-md-3 d-flex flex-row align-items-center text-nowrap me-2 my-3">
<p class="h6 me-2 mb-0">به ترتیب :</p>
<select id="ordercatitem" name="order" id="order" class="form-select form-select">
<option value="all">پیشفرض</option>
<option value="mostexpensive">گران ترین</option>
<option value="cheapest">ارزان ترین</option>
<option value="mostsells">پرفروش ترین</option>
</select>
</div>
<div class="col-10 col-md-3 d-flex flex-row align-items-center text-nowrap my-3">
<div class="form-check form-switch">
<input name="instockcheck" class="form-check-input instockcheck" type="checkbox" id="flexSwitchCheckChecked">
<label class="form-check-label" for="flexSwitchCheckChecked">فقط نمایش کالاهای موجود</label>
</div>
</div>
</div>
</div>
<div class="container-fluid" style="min-height:35vh;">
<div class="row my-1 g-3">
<div class="col">
<div class="container" id="wrapper">
<div class="row row-cols-2 row-cols-md-3 row-cols-lg-5 g-2 g-lg-3 justify-content-end p-3 ">
<?php if($products): ?>
<?php foreach($products as $product):
$productObj=new Product($product['product_id']);
?>
<a href="product.php?pid=<?php echo $productObj->getId()."&slug=".$productObj->getTitle(); ?>" class="text-decoration-none catproitem">
<div class="col">
<div class="card shadow">
<img src="<?php echo $productObj->getImage(); ?>" class="card-img-top" alt="<?php echo $productObj->getImageAlt(); ?>">
<div class="card-body p-1">
<p class="card-title text-center mb-3" style=""><?php echo $productObj->getTitle(); ?></p>
<?php if($productObj->getDiscount()>0): $price=getPriceAfterOff($productObj->getPrice(),$productObj->getDiscount());?>
<?php if($productObj->getInstock()==0): ?>
<p class="ms-1 m-0">ناموجود</p>
<?php else: ?>
<div class="d-flex-flex-column" style="direction:ltr;">
<p class="m-0 text-decoration-line-through"><?php echo number_format($productObj->getPrice()); ?><span class="badge bg-primary me-1"> <?php echo $productObj->getDiscount(); ?>%</span></p>
<div class="d-flex" style="color: coral;">
<p class="ms-1 m-0">تومان</p>
<p class="m-0"><?php echo number_format($price); ?></p>
</div>
</div>
<?php endif; ?>
<?php else: $price=$productObj->getPrice(); ?>
<?php if($productObj->getInstock()==0): ?>
<p class="ms-1 m-0">ناموجود</p>
<?php else: ?>
<div class="d-flex-flex-column" style="direction:ltr;">
<p class="m-0 text-muted">قیمت</p>
<div class="d-flex" style="color: coral;">
<p class="ms-1 m-0">تومان</p>
<p class="m-0"><?php echo number_format($price); ?></p>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
</div>
</a>
<?php endforeach; ?>
<?php else: ?>
<p>محصولی وجود ندارد</p>
<?php endif; ?>
</div>
</div>
</div>
</main>
<!----------------------------- filters + products ------------------------------------>
<!-- common footer -->
<?php include 'commonfooter.php'; ?>
<!-- common footer -->
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous"></script>
<!-- Option 1: Bootstrap Bundle with Popper -->
<!--Filter js -->
<script src="assets/js/filter.js"></script>
</body>
</html>