| Server IP : 104.21.37.246 / Your IP : 172.71.28.145 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home2/cp648411/public_html/simded.com/cart/ |
Upload File : |
<?php
include('../include72/header.php');
include('../themesv2/menu.php');
?>
<?php
// init variables
$min_number = 10;
$max_number = 30;
// generating random numbers
$random_number1 = mt_rand($min_number, $max_number);
$random_number2 = mt_rand($min_number, $max_number);
?>
<div class="bg-3-cover">
<?php include('../themesv2/menu2.php'); ?>
<div class="container pt-3">
<div class="row">
<div class="col-12 text-center">
<p class="HeadText mb-0 fw-bold text-light HeadTextXL ">ตะกร้าสินค้า</p>
</div>
</div>
</div>
<div class="container mt-3 pb-5 text-light">
<div class="row p-2 border-color-sim rounded-pill-end rounded-pill-start text-light text-center fs-4 fw-bold text-spacing-md">
<div class="col-1 bg-color-sim border-color-sim rounded-pill-start2 text-center px-0">
<div class="my-2">
<input type="checkbox" name="" value="" id="checkAll" class="form-check-input pt-2" onclick="checkAll()">
</div>
</div>
<div class="col-3 bg-color-sim border-color-sim">
<p class="my-2">เบอร์ที่สั่งซื้อ</p>
</div>
<div class="col-2 bg-color-sim border-color-sim">
<p class="my-2">ร้านค้า</p>
</div>
<div class="col-2 bg-color-sim border-color-sim">
<p class="my-2">ผลรวม</p>
</div>
<div class="col-2 bg-color-sim border-color-sim">
<p class="my-2">เครือข่าย</p>
</div>
<div class="col-2 bg-color-sim border-color-sim rounded-pill-end2">
<p class="my-2">ราคา/บาท</p>
</div>
</div>
<?php if(count($_SESSION["cart"]) == 0) { ?>
<div class="row px-2 pt-2 pb-0 border-color-sim border-top-0 rounded-bottom-sim " style="margin-top: -20px;">
<div class="col-12 mt-2-box">
<div class="my-2 text-center">
<p>ไม่พบข้อมูล</p>
</div>
</div>
</div>
<?php }else{
$total = 0;
$i=0;
$count_n=count($_SESSION["cart"])-1;
foreach ($_SESSION["cart"] as $key => $value)
{
$list = array('table'=>'phonenumber','where'=>'id = "'.$value.'"','order'=> "ORDER BY id DESC");
$view = $view_db->view($list);
$row = $view_db->q($view);
if(!$row){
$list = array('table'=>'carregistration','where'=>'carregistration = "'.$value.'"','order'=> "ORDER BY id DESC");
$view = $view_db->view($list);
$row = $view_db->q($view);
$phonenumber =$row['carregistration'];
$row_mobilenetwork = '';
$list_shr = array('table'=>'shop','where'=>'id = "'.$row['id_shop'].'" ');
$view_shr = $view_db->view($list_shr);
$row_shr = $view_db->q($view_shr);
}else{
$phonenumber = $Phone_class->format_phonenumber($row['phonenumber'],$row['format']);
$row_mobilenetwork = $actiondata_db->q_one('mobilenetwork','id = "'.$row['mobilenetwork'].'"','image');
$list_shr = array('table'=>'shop','where'=>'id = "'.$row['id_shop'].'" ');
$view_shr = $view_db->view($list_shr);
$row_shr = $view_db->q($view_shr);
$urlshop = $util_class->ck_expired_shop($row_shr['id']);
}
?>
<span id="alert_listcart"></span>
<form name="form1" method="post" enctype="multipart/form-data" action="../include/ajax_delete_product.php">
<div class="row px-2 <?php echo ($i==0)?'pt-2':''; ?> pb-0 border-color-sim border-top-0 text-center fs-5 fw-bold text-spacing-md" style="<?php echo ($i==0)?'margin-top: -20px;':''; ?>">
<div class="col-1 <?php echo ($i==0)?'mt-2-box':''; ?> border-end-sim-box text-center px-0">
<div class="my-2">
<input type="checkbox" name="chk[]" id="chk<?php echo $i; ?>" class="child form-check-input pt-2" value="<?php echo $key;?>" >
</div>
</div>
<div class="col-3 <?php echo ($i==0)?'mt-2-box':''; ?> border-end-sim-box align-items-center d-flex justify-content-center">
<span class="pe-2"><?php echo $phonenumber; ?></span>
</div>
<div class="col-2 <?php echo ($i==0)?'mt-2-box':''; ?> border-end-sim-box align-items-center d-flex justify-content-center">
<a href="<?php echo $Url_shop.$row_shr['codeshop']?>" class="ps-2 text-decoration-none text-light d-flex align-items-center">
<?php echo imgprofile_shop($row_shr['image_profile'],'34'); ?>
<span class="d-none d-md-block ps-2 text-light"><?php echo $row_shr['nameShop'];?></span>
</a>
</div>
<div class="col-2 <?php echo ($i==0)?'mt-2-box':''; ?> border-end-sim-box d-flex align-items-center justify-content-center">
[<?php echo $row['total']?>]
</div>
<div class="col-2 <?php echo ($i==0)?'mt-2-box':''; ?> border-end-sim-box d-flex align-items-center justify-content-center">
<?php if($row_mobilenetwork != ''){ ?>
<img src="<?php echo $upload ?>mobilenetwork/<?php echo $row_mobilenetwork ?>" width="50" class=" img-fluid">
<?php } ?>
</div>
<div class="col-2 d-flex align-items-center justify-content-center">
<?php echo number_format($row['price'])?>
</div>
</div>
<?php
$total = $total + $row['price'];
$i++;
}
}
?>
<?php if(count($_SESSION["cart"]) != 0) { ?>
<div class="row px-2 pb-0 border-color-sim border-top-0 rounded-bottom-sim text-center fs-5 fw-bold"
style="<?php echo ($i==0)?'margin-top: -20px;':''; ?>min-height: 53px">
<div class="col-6 border-end-sim-box text-center">
</div>
<div class="col-4 border-end-sim-box align-items-center d-flex justify-content-center">
<span class="pe-2">ราคารวมทั้งหมด</span>
</div>
<div class="col-2 d-flex align-items-center justify-content-center">
<?php echo number_format($total); ?>
</div>
</div>
<div class="row mt-3">
<div class="col-6">
<button type="submit" class="btn btn-danger-sim px-4 fs-5 fw-bold text-spacing-md">ลบ</button>
</div>
<div class="col-6 text-end">
<button type="button" class="btn btn-primary-sim px-4 fs-5 fw-bold text-spacing-md" onclick="window.location.href='<?php echo $_SERVER['HTTP_REFERER']; ?>'">ย้อนกลับ</button>
</div>
</div>
</form>
<div class="row mt-3 justify-content-end ">
<div class="col-auto">
<a href="#" onclick="delete_product_all()" class="text-danger-sim text-decoration-none fs-5 fw-bold text-spacing-md">ยกเลิกการสั่งซื้อ</a>
</div>
</div>
<?php } ?>
<div class="container">
<div class="row">
<div class="col-12 text-center">
<?php include('../include/ad_google.php'); ?>
</div>
</div>
</div>
</div>
<?php if(count($_SESSION["cart"]) != 0) { ?>
<div class="container border-color-sim rounded-pill-start rounded-pill-end pt-3 py-3 pb-3 fs-4 fw-bold text-spacing-md">
<div class="row">
<div class="col-12">
<p class="HeadText mb-0 text-light">ที่อยู่การจัดส่ง</p>
</div>
</div>
<form action="cart_confirm.php" class="fm_order" method="post" name="fm_order" id="fm_order">
<div class="row text-light">
<div class="col-md-6 mb-3">
<div class="form-group">
<label for="">ชื่อ</label>
<input type="text" class="form-control box-sim1 fs-5" id="" name="name" placeholder="" value="<?php echo $row_m['name']; ?>" style="font-family:Verdana, Geneva, sans-serif">
</div>
</div>
<div class="col-md-6 mb-3">
<div class="form-group">
<label for="">นามสกุล</label>
<input type="text" class="form-control box-sim1 fs-5" id="" name="lastname" placeholder="" value="<?php echo $row_m['lastname']; ?>" style="font-family:Verdana, Geneva, sans-serif">
</div>
</div>
<div class="col-md-12 mb-3">
<div class="form-group">
<label for="">ที่อยู่ที่ต้องจัดส่ง</label>
<textarea name="address" class="form-control fs-5" style="font-family:Verdana, Geneva, sans-serif" rows="5" cols="40"></textarea>
</div>
</div>
<div class="col-md-6 mb-3">
<div class="form-group">
<label for="">จังหวัด</label>
<select class="Drop box-sim1 fs-5 text-spacing-md" name="province" id="province" onchange="" style="margin-top:0px;">
<option value="" disabled selected>กรุณาเลือก</option>
<?php
$list_prv = array('table'=>'province','where'=>'1','order'=> "ORDER BY name='กรุงเทพมหานคร' DESC ,id ASC");
$view_prv = $view_db->view($list_prv);
$result_prv = $view_db->q_re($view_prv);
while($row_prv = $view_db->q_ro($result_prv))
{
?> <option value="<?php echo $row_prv['id'] ?>"><?php echo $row_prv['name'] ?></option> <?php
}
?>
</select>
</div>
</div>
<div class="col-md-6 mb-3">
<div class="form-group">
<label for="">รหัสไปรษณีย์</label>
<input type="text" class="form-control box-sim1 fs-5" id="" placeholder="" name="zip" value="" style="font-family:Verdana, Geneva, sans-serif">
</div>
</div>
<div class="col-md-6 mb-3">
<div class="form-group">
<label for="">เลือกวิธีการจัดส่ง</label>
<select class="form-control box-sim1 fs-5 text-spacing-md" name="shipping">
<?php
$list_sp = array('table'=>'ems_type','where'=>'1','order'=> "ORDER BY id ASC");
$view_sp = $view_db->view($list_sp);
$result_sp = $view_db->q_re($view_sp);
while($row_sp = $view_db->q_ro($result_sp))
{
?><option value="<?php echo $row_sp['id']?>"><?php echo $row_sp['name']?> </option><?php
}
?>
</select>
</div>
</div>
<div class="col-md-6 mb-3">
<div class="form-group">
<label for="">เบอร์โทรติดต่อ</label>
<input type="text" class="form-control fs-5" id="" placeholder="" name="phone" value="<?php echo $row_m['phone']; ?>" style="font-family:Verdana, Geneva, sans-serif">
</div>
</div>
<div class="col-md-6 mb-3">
<div class="form-group">
<label for="">อีเมล</label>
<input type="email" class="form-control box-sim1 fs-4" id="" placeholder="" name="email" value="<?php echo $row_m['email']; ?>" style="font-family:Verdana, Geneva, sans-serif">
</div>
</div>
<div class="col-md-6 mb-3">
<div class="form-group">
<label for="" id="captchaOperation"></label>
<input type="text" class="form-control box-sim1 fs-4" name="captcha" />
</div>
</div>
<div class="col-md-12 mb-3">
<div class="form-group text-spacing-md" align="center">
<input type="checkbox" value="1" name="check"> ขอรับรองข้อความข้างต้นนี้เป็นความจริง<br>
</div>
</div>
</div>
<div class="row justify-content-center">
<div class="col-md-4">
<div class="form-group">
<button type="submit" class="btn btn-danger bn_send_order fs-4 fw-bold text-spacing-md">ยืนยันที่อยู่จัดส่ง</button>
</div>
</div>
</div>
</form>
</div>
<?php } ?>
</div>
<!--/.container-->
<?php
include('../themesv2/footer2.php');
include('../include/footer_js.php');
?>
<script>
function delete_product()
{
for(i=0;i<=<?php echo $count_n; ?>;i++)
{
if(eval("document.form1.chk"+i+".checked")==true)
{
console.log(eval("document.form1.chk"+i+".value"));
}
}
swal({
title: "ยืนยันการลบข้อมูล ?",
text: "คุณจะไม่สามารถกู้ข้อมูลคืนกลับได้ !",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "ยืนยันการลบข้อมูล",
cancelButtonText: "ยกเลิก",
closeOnConfirm: false
},
function(isConfirm){
if (isConfirm) {
swal.close();
testHoldon('sk-rect');
$.ajax({
url: "../include/ajax_delete_product.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: document.form1.chk,
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
testHoldon_cl('sk-circle');
//$("#alert_listcart").html(data);
//console.log(data);
//window.location.href = '../cart/list.php';
}
});
}
});
}
function delete_product_all()
{
swal({
title: "ยืนยันการลบข้อมูล ?",
text: "คุณจะไม่สามารถกู้ข้อมูลคืนกลับได้ !",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "ยืนยันการลบข้อมูล",
cancelButtonText: "ยกเลิก",
closeOnConfirm: false
},
function(isConfirm){
if (isConfirm) {
swal.close();
testHoldon('sk-rect');
$.ajax({
url: "../include/ajax_delete_product_all.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: '',
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
testHoldon_cl('sk-circle');
//$("#alert_listcart").html(data);
window.location.href = '../cart/list.php';
}
});
}
});
}
function checkAll() {
var inputs = document.querySelectorAll('.child');
for (var i = 0; i < inputs.length; i++) {
inputs[i].checked = true;
}
}
</script>