-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview_prod.php
67 lines (64 loc) · 2.23 KB
/
view_prod.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
<?php
include'admin/db_connect.php';
$qry = $conn->query("SELECT * FROM product_list where id = ".$_GET['id'])->fetch_array();
?>
<div class="container-fluid">
<div class="card ">
<img src="assets/img/<?php echo $qry['img_path'] ?>" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title"><?php echo $qry['name'] ?></h5>
<p class="card-text truncate"><?php echo $qry['description'] ?></p>
<div class="form-group">
</div>
<div class="row">
<div class="col-md-2"><label class="control-label">Qty</label></div>
<div class="input-group col-md-7 mb-3">
<div class="input-group-prepend">
<button class="btn btn-outline-secondary" type="button" id="qty-minus"><span class="fa fa-minus"></button>
</div>
<input type="number" readonly value="1" min = 1 class="form-control text-center" name="qty" >
<div class="input-group-prepend">
<button class="btn btn-outline-dark" type="button" id="qty-plus"><span class="fa fa-plus"></span></button>
</div>
</div>
</div>
<div class="text-center">
<button class="btn btn-outline-dark btn-sm btn-block" id="add_to_cart_modal"><i class="fa fa-cart-plus"></i> Add to Cart</button>
</div>
</div>
</div>
</div>
<style>
#uni_modal_right .modal-footer{
display: none;
}
</style>
<script>
$('#qty-minus').click(function(){
var qty = $('input[name="qty"]').val();
if(qty == 1){
return false;
}else{
$('input[name="qty"]').val(parseInt(qty) -1);
}
})
$('#qty-plus').click(function(){
var qty = $('input[name="qty"]').val();
$('input[name="qty"]').val(parseInt(qty) +1);
})
$('#add_to_cart_modal').click(function(){
start_load()
$.ajax({
url:'admin/ajax.php?action=add_to_cart',
method:'POST',
data:{pid:'<?php echo $_GET['id'] ?>',qty:$('[name="qty"]').val()},
success:function(resp){
if(resp == 1 )
alert_toast("Order successfully added to cart");
$('.item_count').html(parseInt($('.item_count').html()) + parseInt($('[name="qty"]').val()))
$('.modal').modal('hide')
end_load()
}
})
})
</script>