| Server IP : 172.67.216.113 / Your IP : 172.71.28.146 [ 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/taladonnuch.com/cart/ |
Upload File : |
<?php include('../include/meta.php');?>
<?php include('../include/head.php');?>
<?php include('../include/menu.php');?>
<div class="container div_main p_top40">
<div class="row">
<div class="col-md-12" align="center">
<div class="text_header">รายการสั่งซื้อของคุณ</div>
<div ><a href="#" class="font_pro_all" style="color:#F00;"> คุณสามมารภเพิ่มจำนาวนสินค้า หรือลดจำนวนสินค้าได้ที่</a> <img src="../image/icon_add.jpg" width="11" height="11"> <img src="../image/icon_delete.jpg" width="11" height="11"></div>
</div>
</div>
</div>
<script>
function focus_item(varis,var1,stock)
{
var var2 = varis;
if(Math.abs(var2) < Math.abs(stock))
{
var num_item = Math.abs(var2);
}
else
{
alert('สินค้ามีจำนวน'+stock+'ชิ้น');
var num_item = Math.abs(var2);
}
var var_price = document.getElementById("pro_price_"+var1).value;
var total = Math.abs(var_price) * num_item;
document.getElementById("pro_item_"+var1).value = num_item;
document.getElementById("pro_item2_"+var1).value = num_item;
total = total.toFixed(2)
//total = total.toLocaleString();
document.getElementById("total_item_"+var1).innerHTML = addCommas(total);
document.getElementById("total_item2_"+var1).innerHTML = addCommas(total);
var totalsum = document.getElementById("total_sum").value;
var sum = Math.abs(totalsum) + Math.abs(var_price) ;
document.getElementById("total_sum").value = sum;
sum = sum.toFixed(2)
document.getElementById("total").innerHTML = addCommas(sum);
document.getElementById("total2").innerHTML = addCommas(sum);
showHint(var1,num_item);
}
function addCommas(nStr)
{
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
function add_item(var1,stock)
{
var var2 = document.getElementById("pro_item_"+var1).value;
var add1 = 1;
//var num_item = Math.abs(var2) + add1;
//alert(stock);
if(Math.abs(var2) < Math.abs(stock))
{
var num_item = Math.abs(var2) + add1;
}
else
{
alert('สินค้ามีจำนวน'+stock+'ชิ้น');
var num_item = Math.abs(var2);
}
var var_price = document.getElementById("pro_price_"+var1).value;
var total = Math.abs(var_price) * num_item;
document.getElementById("pro_item_"+var1).value = num_item;
document.getElementById("pro_item2_"+var1).value = num_item;
total = total.toFixed(2)
//total = total.toLocaleString();
document.getElementById("total_item_"+var1).innerHTML = addCommas(total);
document.getElementById("total_item2_"+var1).innerHTML = addCommas(total);
var totalsum = document.getElementById("total_sum").value;
var sum = Math.abs(totalsum) + Math.abs(var_price) ;
document.getElementById("total_sum").value = sum;
sum = sum.toFixed(2)
document.getElementById("total").innerHTML = addCommas(sum);
document.getElementById("total2").innerHTML = addCommas(sum);
showHint(var1,num_item);
}
function delete_item(var1)
{
var var2 = document.getElementById("pro_item_"+var1).value;
var add1 = 1;
if(var2 > 1)
{
var num_item = Math.abs(var2) - add1;
document.getElementById("pro_item_"+var1).value = num_item;
document.getElementById("pro_item2_"+var1).value = num_item;
var var_price = document.getElementById("pro_price_"+var1).value;
var total = Math.abs(var_price) * num_item;
document.getElementById("pro_item_"+var1).value = num_item;
total = total.toFixed(2)
document.getElementById("total_item_"+var1).innerHTML = addCommas(total);
document.getElementById("total_item2_"+var1).innerHTML = addCommas(total);
var totalsum = document.getElementById("total_sum").value;
var sum = Math.abs(totalsum) - Math.abs(var_price) ;
document.getElementById("total_sum").value = sum;
sum = sum.toFixed(2)
document.getElementById("total").innerHTML = addCommas(sum);
document.getElementById("total2").innerHTML = addCommas(sum);
showHint(var1,num_item);
}
}
function showHint(str,num) {
if (str.length == 0) {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
}
};
xmlhttp.open("GET", "ajax_item.php?id=" + str+'&num='+num, true);
xmlhttp.send();
}
}
function delete_product(var1)
{
document.getElementById("id_pro").value = var1;
document.getElementById("myForm_delete").submit();
}
</script>
<form id="myForm_delete" action="delete_pro.php" method="post">
<input type="hidden" name="id_pro" id="id_pro" value="">
</form>
<div class="container div_main p_top40">
<div class="row">
<div class="col-md-12">
<table width="100%" border="0" class="tb_cart_list tb_com">
<tr align="center">
<td width="15%">รูปสินค้า</td>
<td align="left">ชื่อสินค้า / รหัส</td>
<td width="10%"></td>
<td width="5%">ขนาด</td>
<td width="15%">จำนวน</td>
<td width="10%">ราคารวม</td>
<td width="5%">ลบ</td>
</tr>
<?php
$num = 0;
foreach( $_SESSION["cart"] as $key => $value )
{
$num_mod = $num % 2;
$sql_pro = array('table'=>'product','where'=>"id = '". $_SESSION["cart"][$key]['id']."'");
$view_pro = $view_db->view($sql_pro);
$row_pro = $view_db->q($view_pro);
$sql_pros = array('table'=>'product_size','where'=>"product_id = '". $_SESSION["cart"][$key]['id']."' AND size = '".$_SESSION["cart"][$key]['sz']."'");
$view_pros = $view_db->view($sql_pros);
$row_pros = $view_db->q($view_pros);
?>
<tr align="center" <?php if($num_mod == 1){ ?>class="td_cart_2"<?php }?>>
<td><div class="pro_img_2"><img src="../redbag/product/thumb/<?php echo $row_pro['image']?>" width="85" class="img_res img_nocopy"></div></td>
<td align="left" style="padding:15px;">
<div style="font-weight:bold;"><?php echo $row_pro['name']?></div>
<div style="color:#8b8a8a;">รหัสสินค้า : <?php echo $row_pro['code']?></div>
</td>
<td><input type="hidden"
id="pro_price_<?php echo $key.'_'.$_SESSION["cart"][$key]['id'];?>" value="<?php echo $row_pros['price'] ?>"> <?php echo number_format( $row_pros['price'], 2, '.', '' );?> บาท</td>
<td><?php echo $_SESSION["cart"][$key]['sz'] ?></td>
<td>
<input type="text" onChange="focus_item(this.value,'<?php echo $key.'_'.$_SESSION["cart"][$key]['id'];?>','<?php echo $row_pros['stock']?>')" id="pro_item_<?php echo $key.'_'.$_SESSION["cart"][$key]['id'];?>" value="<?php echo $_SESSION["cart"][$key]['item'];?>"
style="width:30px;">
<img src="../image/icon_add.jpg" width="20" height="20" onClick="add_item('<?php echo $key.'_'.$_SESSION["cart"][$key]['id'];?>','<?php echo $row_pros['stock']?>')" style="cursor:pointer">
<img src="../image/icon_delete.jpg" width="20" height="20" onClick="delete_item('<?php echo $key.'_'.$_SESSION["cart"][$key]['id'];?>')" style="cursor:pointer">
</td>
<td><span id="total_item_<?php echo $key.'_'.$_SESSION["cart"][$key]['id'];?>">
<?php $price = $row_pros['price'] * $_SESSION["cart"][$key]['item'];?>
<?php echo number_format( $price, 2, '.', '' );?></span> บาท</td>
<td><img src="../image/close.png" width="13" height="13" onClick="if(!confirm('ยืนยัน การลบข้อมูล ?')){return false;}else{ delete_product('<?php echo $key.'_'.$_SESSION["cart"][$key]['id']?>') }" style="cursor:pointer"></td>
</tr>
<?php
@$total = @$total + $price;
$num++;
?>
<?php
}
?>
<tr align="right" class="td_cart_2">
<td style="padding:15px;font-weight:bold;" colspan="5">ราคารวมทั้งหมด</td>
<td style="padding:15px;color:#f68236;" align="left">
<input type="hidden" id="total_sum" name="total_sum" value="<?php echo $total ?>">
<span id="total"><?php echo number_format( $total, 2, '.', '' );?></span> บาท
</td>
<td style="padding:15px;"></td>
</tr>
</table>
<table width="100%" border="0" class="tb_cart_list tb_moblie">
<tr align="center">
<td width="15%"></td>
<td align="left"></td>
<td width="10%"></td>
</tr>
<?php
$num = 0;
foreach( $_SESSION["cart"] as $key => $value )
{
$num_mod = $num % 2;
$sql_pro = array('table'=>'product','where'=>"id = '". $_SESSION["cart"][$key]['id']."'");
$view_pro = $view_db->view($sql_pro);
$row_pro = $view_db->q($view_pro);
$sql_pros = array('table'=>'product_size','where'=>"product_id = '". $_SESSION["cart"][$key]['id']."' AND size = '".$_SESSION["cart"][$key]['sz']."'");
$view_pros = $view_db->view($sql_pros);
$row_pros = $view_db->q($view_pros);
?>
<tr align="center" <?php if($num_mod == 1){ ?>class="td_cart_2"<?php }?>>
<td><div class="pro_img_2"><img src="../redbag/product/thumb/<?php echo $row_pro['image']?>" width="85" class="img_res "></div></td>
<td align="left" style="padding-left:5px;">
<div style="font-weight:bold;"><?php echo $row_pro['name']?></div>
<div style="color:#8b8a8a;">รหัสสินค้า : <?php echo $row_pro['code']?></div>
<div style="color:#8b8a8a;">ขนาด : <?php echo $_SESSION["cart"][$key]['sz']?></div>
<div style="color:#8b8a8a;">ราคา : <?php echo $row_pros['price']?> บาท
<input type="hidden" id="pro_price_<?php echo $key.'_'.$_SESSION["cart"][$key]['id'];?>" value="<?php echo $row_pros['price'] ?>">
</div>
</td>
<td>
จำนวน <br>
<input type="text" onChange="focus_item(this.value,'<?php echo $key.'_'.$_SESSION["cart"][$key]['id'];?>','<?php echo $row_pros['stock']?>')" id="pro_item2_<?php echo $key.'_'.$_SESSION["cart"][$key]['id'];?>" value="<?php echo $_SESSION["cart"][$key]['item'];?>" style="width:30%;"> <br>
<img src="../image/icon_add.jpg" width="20" height="20" onClick="add_item('<?php echo $key.'_'.$_SESSION["cart"][$key]['id'];?>','<?php echo $row_pros['stock']?>')" style="cursor:pointer">
<img src="../image/icon_delete.jpg" width="20" height="20" onClick="delete_item('<?php echo $key.'_'.$_SESSION["cart"][$key]['id'];?>')" style="cursor:pointer">
<div style="font-weight:bold;margin-top:25px;" >
<span id="total_item2_<?php echo $key.'_'.$_SESSION["cart"][$key]['id'];?>">
<?php $price = $row_pros['price'] * $_SESSION["cart"][$key]['item'];?>
<?php echo number_format( $price, 2, '.', '' );?></span> บาท
</div>
</td>
<td><img src="../image/close.png" width="13" height="13" onClick="if(!confirm('ยืนยัน การลบข้อมูล ?')){return false;}else{ delete_product('<?php echo $key.'_'.$_SESSION["cart"][$key]['id']?>') }" style="cursor:pointer"></td>
</tr>
<?php
$num++;
}
?>
<tr align="left" class="td_cart_2">
<td style="padding:15px;font-weight:bold;" colspan="2">ราคารวมทั้งหมด</td>
<td style="padding:15px;color:#f68236;width:50%">
<input type="hidden" id="total_sum2" name="total_sum" value="<?php echo $total ?>">
<span id="total2"><?php echo number_format( $total, 2, '.', '' );?></span> บาท
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="container div_main" style="padding-top:60px;">
<div class="row">
<div class="col-md-12" align="center">
<a href="../product/index.php" class="btn btn-default bn_send_mail">เลือกสินค้าเพิ่ม</a>
<a href="../member/login.php" type="button" class="btn btn-default bn_send_mail" style="background-color:#18a206;border:1px solid #18a206;">เข้าสู่ระบบ</a>
<div style="padding-top:60px;"> <img src="../image/icon_graph.png" width="97" height="22"> </div>
<div class="line"></div>
</div>
</div>
</div>
<div class="container div_main p_top40">
<div class="row">
<div class="col-md-12" align="center">
<div align="center">
</div>
<div class="text_header">ที่อยู่จัดส่ง</div>
<div style="text-decoration:underline;"> กรอกรายละเอียดการสั่งซื้อสินค้า <span style="color:#f68236;">(ท่านสามารถสังซื้อโอยไม่ต้องสมัครสมาชิก)</span></div>
</div>
</div>
</div>
<script>
function checkform_shippingaddress()
{
if(document.from_sa.name.value==""){alert("ขออภัยค่ะกรุณากรอก ชื่อ");document.from_sa.name.focus();return false;}
if(!isNaN(document.from_sa.name.value)){alert("ขออภัยค่ะกรุณากรอก ชื่อเป็นตัวหนังสือเท่านั้น");document.from_sa.name.focus();return false;}
if(document.from_sa.lastname.value==""){alert("ขออภัยค่ะกรุณากรอก นามสกุล");document.from_sa.lastname.focus();return false;}
if(!isNaN(document.from_sa.lastname.value)){alert("ขออภัยค่ะกรุณากรอก นามสกุลเป็นตัวหนังสือเท่านั้น");document.from_sa.lastname.focus();return false;}
if(document.from_sa.address.value==""){alert("ขออภัยค่ะกรุณากรอก ที่อยู่ที่ต้องจัดส่ง");document.from_sa.address.focus();return false;}
/*if(document.from_sa.alley.value==""){alert("ขออภัยค่ะกรุณากรอก ซอย");document.from_sa.alley.focus();return false;}*/
/*if(document.from_sa.road.value==""){alert("ขออภัยค่ะกรุณากรอก ถนน");document.from_sa.road.focus();return false;}
if(document.from_sa.zone.value==""){alert("ขออภัยค่ะกรุณากรอก แขวง");document.from_sa.zone.focus();return false;}
if(document.from_sa.area.value==""){alert("ขออภัยค่ะกรุณากรอก เขต");document.from_sa.area.focus();return false;}*/
if(document.from_sa.province.value==""){alert("ขออภัยค่ะกรุณากรอก จังหวัด");document.from_sa.province.focus();return false;}
if(document.from_sa.zip.value==""){alert("ขออภัยค่ะกรุณากรอก รหัสไปรษณี");document.from_sa.zip.focus();return false;}
if(document.from_sa.phone.value==""){alert("ขออภัยค่ะกรุณากรอก เบอร์โทรติดต่อ");document.from_sa.phone.focus();return false;}
if(isNaN(document.from_sa.phone.value)){
alert("ขออภัยค่ะกรุณากรอก เบอร์โทรติดต่อ เป็นตัวเลขเท่านั้น");document.from_sa.phone.focus();return false;
}
if(document.from_sa.mail.value==""){alert("ขออภัยค่ะกรุณากรอก อีเมล");document.from_sa.mail.focus();return false;}
if(document.from_sa.check.checked == false){alert("ขออภัยค่ะกรุณายืนยันข้อมูล ที่อยู่จัดส่ง");document.from_sa.check.focus();return false;}
}
</script>
<div class="container div_main p_top40">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<?php
if($_SESSION["hom_login"] == 1)
{
$sql_m = array('table'=>'member','where'=>"Mid = '".$_SESSION["hom_id"]."'");
$viewid_m = $view_db->view($sql_m);
$row_m = $view_db->q($viewid_m);
}
?>
<form action="cart_confirm.php" method="post" name="from_sa" onSubmit="return checkform_shippingaddress();">
<div class="col-md-12">
<div class="form-group">
<label for="exampleInputEmail1">เลือกวิธีการจัดส่ง</label>
<select class="form-control" style="font-family:Verdana, Geneva, sans-serif" name="shipping">
<?php
$list_sp = array('table'=>'shipping','where'=>'status = 1','order'=> "ORDER BY price 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']?> (<?php echo $row_sp['price']?>)</option><?php
}
?>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="exampleInputPassword1">ชื่อ</label>
<input type="text" class="form-control" id="" name="name" placeholder="" value="<?php echo $row_m['Mfname']; ?>" style="font-family:Verdana, Geneva, sans-serif">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="exampleInputPassword1">นามสกุล</label>
<input type="text" class="form-control" id="" name="lastname" placeholder="" value="<?php echo $row_m['Mlname']; ?>" style="font-family:Verdana, Geneva, sans-serif">
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="exampleInputPassword1">ที่อยู่ที่ต้องจัดส่ง</label>
<textarea name="address" class="form-control" style="font-family:Verdana, Geneva, sans-serif" rows="5" cols="40"><?php echo $row_m['Maddr1']; ?></textarea>
</div>
</div>
<!-- <div class="col-md-6">
<div class="form-group">
<label for="exampleInputPassword1">ซอย</label>
<input type="text" class="form-control" id="" placeholder="" name="alley" style="font-family:Verdana, Geneva, sans-serif">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="exampleInputPassword1">ถนน</label>
<input type="text" class="form-control" id="" placeholder="" name="road" style="font-family:Verdana, Geneva, sans-serif">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="exampleInputPassword1">แขวง</label>
<input type="text" class="form-control" id="" name="zone" placeholder="" style="font-family:Verdana, Geneva, sans-serif">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="exampleInputPassword1">เขต</label>
<input type="text" class="form-control" id="" placeholder="" name="area" style="font-family:Verdana, Geneva, sans-serif">
</div>
</div>-->
<div class="col-md-6">
<div class="form-group">
<label for="exampleInputPassword1">จังหวัด</label><label style="color:#F00;">*</label>
<select class="form-control" style="font-family:Verdana, Geneva, sans-serif" name="province1" required>
<?php
$sql_p = array('table'=>'province','where'=>'status = 0','order'=> "ORDER BY PROVINCE_NAME ASC");
$viewid_p = $view_db->view($sql_p);
$result_p = $view_db->q_re($viewid_p);
while($row_p1 = $view_db->q_ro($result_p))
{
?><option value="<?php echo $row_p1['PROVINCE_ID']?>"><?php echo $row_p1['PROVINCE_NAME']?></option><?php
}
?>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="exampleInputPassword1">รหัสไปรษณี</label>
<input type="text" class="form-control" id="" placeholder="" name="zip" value="<?php echo $row_m['Mzip']; ?>" style="font-family:Verdana, Geneva, sans-serif">
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="exampleInputPassword1">เบอร์โทรติดต่อ</label>
<input type="text" class="form-control" id="" placeholder="" name="phone" value="<?php echo $row_m['Mtel']; ?>" style="font-family:Verdana, Geneva, sans-serif">
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="exampleInputPassword1">อีเมล</label>
<input type="email" class="form-control" id="" placeholder="" name="mail" value="<?php echo $row_m['Memail']; ?>" style="font-family:Verdana, Geneva, sans-serif">
</div>
</div>
<div class="col-md-12">
<div class="form-group" align="center"><br>
<input type="checkbox" value="1" name="check"> ขอรับรองข้อความข้างต้นนี้เป็นความจริง<br>
<button type="submit" class="btn btn-default bn_send_mail">ยืนยันที่อยู่จัดส่ง</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="container div_main">
<div class="row">
<div class="col-md-12" align="center">
<div class="line"></div>
</div>
</div>
</div>
<?php include('../themes/tap_footer.php');?>
<?php include('../themes/footer.php');?>
<?php include('../include/footer_js.php');?>