-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewProductSizes.php
109 lines (95 loc) · 3.67 KB
/
viewProductSizes.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
<div >
<h2>Product Sizes Item</h2>
<table class="table ">
<thead>
<tr>
<th class="text-center">S.N.</th>
<th class="text-center">Product Name</th>
<th class="text-center">Size</th>
<th class="text-center">Stock Quantity</th>
<th class="text-center" colspan="2">Action</th>
</tr>
</thead>
<?php
include_once "./dbconnect.php";
$sql="SELECT * from product_size_variation v, products p, sizes s WHERE p.products_id=v.products_id AND v.size_id=s.size_id ";
$result=$conn-> query($sql);
$count=1;
if ($result-> num_rows > 0){
while ($row=$result-> fetch_assoc()) {
?>
<tr>
<td><?=$count?></td>
<td><?=$row["product_title"]?></td>
<td><?=$row["size_name"]?></td>
<td><?=$row["quantity_in_stock"]?></td>
<td><button class="btn btn-primary" style="height:40px" onclick="variationEditForm('<?=$row['variation_id']?>')">Edit</button></td>
<td><button class="btn btn-danger" style="height:40px" onclick="variationDelete('<?=$row['variation_id']?>')">Delete</button></td>
</tr>
<?php
$count=$count+1;
}
}
?>
</table>
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-secondary" style="height:40px" data-toggle="modal" data-target="#myModal">
Add Size Variation
</button>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">New Product Size Variation</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<form enctype='multipart/form-data' action="./addVariationController.php" method="POST">
<div class="form-group">
<label>Product:</label>
<select name="product" >
<option disabled selected>Select product</option>
<?php
$sql="SELECT * from products";
$result = $conn-> query($sql);
if ($result-> num_rows > 0){
while($row = $result-> fetch_assoc()){
echo"<option value='".$row['products_id']."'>".$row['product_title'] ."</option>";
}
}
?>
</select>
</div>
<div class="form-group">
<label>Size:</label>
<select name="size" >
<option disabled selected>Select size</option>
<?php
$sql="SELECT * from sizes";
$result = $conn-> query($sql);
if ($result-> num_rows > 0){
while($row = $result-> fetch_assoc()){
echo"<option value='".$row['size_id']."'>".$row['size_name'] ."</option>";
}
}
?>
</select>
</div>
<div class="form-group">
<label for="qty">Stock Quantity:</label>
<input type="number" class="form-control" name="qty" required>
</div>
<div class="form-group">
<button type="submit" class="btn btn-secondary" name="upload" style="height:40px">Add Variation</button>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" style="height:40px">Close</button>
</div>
</div>
</div>
</div>
</div>