查看文件: index_shoppingcar.php
大小: 12.93 KB
类型: application/octet-stream
<?php require_once('./Connections/BE2.php'); ?> <?php if (!isset($_SESSION)){ session_start(); } if(! isset($_SESSION['login_memid']) || $_SESSION['login_memid']=='0'){ ?> <script>alert('請記的先登入');location.href = '/';</script> <? exit; } ?> <? if ( isset($_GET["delid"]) ) { $delSQL = sprintf("delete from order_tmp where ccid='%s' AND p_sess='%s'",$_GET["delid"],session_id()); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($delSQL, $BE2) or die(mysql_error()); } else if ( isset($_GET["addcount"]) ) { $upSQL = sprintf("update order_tmp Set p_count='%s' where ccid='%s' AND p_sess='%s'",$_GET["addcount"],session_id()); mysql_select_db($database_BE2, $BE2); $Result1 = mysql_query($upSQL, $BE2) or die(mysql_error()); } $colname_Rt2 = session_id() ;// $_SESSION['login_memid']; mysql_select_db($database_BE2, $BE2); $query_Rt2 = sprintf("SELECT a.*,b.p_title,c.company_title FROM order_tmp as a,product_data as b,company as c WHERE a.mem_auto=b.mem_auto AND b.company_num=c.coid AND a.p_sess= '%s' ORDER BY a.ccid DESC",$colname_Rt2); $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $totalRows_Rt2 = mysql_num_rows($Rt2); mysql_select_db($database_BE2, $BE2); $query_Rtn = sprintf("SELECT a.*,b.* FROM member as a,address as b WHERE a.mem_auto='%s' AND a.mem_address=b.address_id",$_SESSION['login_memid']); $Rtn = mysql_query($query_Rtn, $BE2) or die(mysql_error()); $row_Rtn = mysql_fetch_assoc($Rtn); $address=$row_Rtn['county'].$row_Rtn['district'].$row_Rtn['street'].$row_Rtn['mem_address2']."號"; if ($row_Rtn['mem_address3']<>""){ $address .= $row_Rtn['mem_address3']."樓"; } if($_SERVER["REMOTE_ADDR"]=="220.130.43.118"){ echo $query_Rt2."<br>"; } ?> <script type="text/javascript" charset="utf-8"> function MM_total(targ,selObj,restore){ //v3.0 var url="ajax_update_order.php"; $.post(url,{"ccid":targ,"pcount":selObj.options[selObj.selectedIndex].value}, function(data){ if (data) { location.reload(); } }); } </script> <? if($totalRows_Rt2>0){ ?> <div class="container g-pt-80 g-pb-70"> <div id="stepFormSteps"> <!-- Shopping Cart --> <div id="step1" class="active"> <div class="row"> <div class="col-md-12 g-mb-30"> <!-- Products Block --> <div class="g-overflow-x-scroll g-overflow-x-visible--lg"> <form name="form5" method="post" action="/shopcart.html"> <table class="text-center w-100"> <thead class="h6 g-brd-bottom g-brd-gray-light-v3 g-color-black text-uppercase"> <tr> <th class="g-font-weight-400 text-left g-pb-20">商品</th> <th class="g-font-weight-400 g-width-130 g-pb-20">價格</th> <th class="g-font-weight-400 g-width-50 g-pb-20">數量</th> <th class="g-font-weight-400 g-width-130 g-pb-20">總計</th> <th></th> </tr> </thead> <tbody> <?php $p1=0; $p2=0; //sum $order_express=0; $coid=0; //tab $coid_count=0; $coid_total=$totalRows_Rt2; do { if($order_express==0){ $order_express= $row_Rt2['p_express']; } ?> <? if($row_Rt2['coid']<>$coid){ ?> <tr class="g-brd-bottom g-brd-gray-light-v3"> <td colspan="5" class="text-left" ><input name="coidname<?= $coid_count?>" id="coidname<?= $coid_count ?>" type="checkbox" value="<?= $row_Rt2['coid']?>" /> 店舖 : <?= $row_Rt2['company_title']?></td> </tr> <? $coid=$row_Rt2['coid']; $coid_count++; } ?> <tr class="g-brd-bottom g-brd-gray-light-v3"> <td class="text-left g-py-25"> <img class="d-inline-block g-width-60 mr-4" src="/admin/upload_image/" alt=""> <div class="d-inline-block align-middle"> <h4 class="h6 g-color-black"><?= $row_Rt2['p_title'];?></h4> </div> </td> <td class="g-color-gray-dark-v2 g-font-size-16"><?= $row_Rt2['p_money'];?></td> <td> <select class="custom-select mr-sm-3 mb-3 mb-lg-0" name="p_count" id="p_count" onChange="MM_total('<?= $row_Rt2['ccid'];?>',this,0)"> <? for($i=1;$i<101;$i++){ ?> <option value="<?= $i ?>" <?= $row_Rt2['p_count']==$i?"selected":"" ;?> ><?= $i ?></option> <? }?> </select> </td> <? $p1=$row_Rt2['p_count']*$row_Rt2['p_money']; $p2+=$p1; ?> <td class="g-color-gray-dark-v2 g-font-size-16"> <?= $p1;?></td> <td class="g-color-gray-dark-v2 g-font-size-16"> <a href="#" onclick="if(window.confirm('確定刪除'))location.href='/shoppingcar.html?delid=<?= $row_Rt2['ccid']?>';"><i class="mt-auto fa fa-trash"></i></a> </td> </tr> <?php } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); ?> </tbody> </table> </form> </div> <!-- End Products Block --> <form action="/ordercar.html" method="post" name="form1"> <input name="order_moneyALL" id="order_moneyALL" type="hidden" value="<?= $p2 ?>"> <table class="table table-bordered g-mt-20"> <tr> <td width="217"> <div class="row"> <div class="col-md-3"> <label>商品總金額:$<font size="4"><?= $p2 ?></font></label> </div> <div class="col-md-2"> <label>運費:$<font size="4" color="#336633"><?= $order_express ?></font></label> <input name="order_express" id="order_express" type="hidden" value="<?= $order_express ?>"> </div> <div class="col-md-3"> <? $p2=$p2+$order_express; ?> <input name="pay_money" id="pay_money" type="hidden" value="<?= $p2 ?>"> <label>結帳總金額:$<font size="4" color="#0000FF"><?= $p2 ?></font></label> </div> </div> </td> </tr> </table> <table class="table table-bordered g-mt-20"> <tr> <td><font size="3" color="#000">寄件人資料</font></td> </tr> <tr> <td> <div class="row"> <div class="col-md-3"> <label>姓名</label> <input name="mem_name" id="mem_name" type="text" class="form-control" value="<?= $row_Rtn['mem_name'] ?>" required> </div> <div class="col-md-3"> <label>手機</label> <input name="mem_mobile" id="mem_mobile" type="text" class="form-control" value="<?= $row_Rtn['mem_mobile'] ?>" required> </div> <div class="col-md-6"> <label>信箱</label> <input name="mem_mail" id="mem_mail" type="text" class="form-control" value="<?= $row_Rtn['mem_mail'] ?>" required> </div> <div class="col-md-12"> <label>地址</label> <input name="mem_address" id="mem_address" type="text" class="form-control" value="<?= $address ?>" required> </div> </div> </td> </tr> <script language="JavaScript"> <!-- function checkall() { document.getElementById("mem_name2").value = document.getElementById("mem_name").value; document.getElementById("mem_mobile2").value = document.getElementById("mem_mobile").value; document.getElementById("mem_address2").value = document.getElementById("mem_address").value; document.getElementById("mem_mail2").value = document.getElementById("mem_mail").value; } function showfp() { fp2.style.display = ''; } function showfp2() { fp2.style.display = 'none'; } function showfp3() { fp3.style.display = ''; } function showfp31() { fp3.style.display = 'none'; } //--> </script> <tr> <td><font size="3" color="#000" class="g-mr-20">收件人資料</font> <label><input type="checkbox" name="s1" value="1" onChange="checkall()"><i></i> 同寄件人資料</label></td> </tr> <tr> <td> <div class="row"> <div class="col-md-3"> <label>姓名</label> <input name="mem_name2" id="mem_name2" type="text" class="form-control" required> </div> <div class="col-md-3"> <label>手機</label> <input name="mem_mobile2" id="mem_mobile2" type="text" class="form-control" required> </div> <div class="col-md-6"> <label>信箱</label> <input name="mem_mail2" id="mem_mail2" type="text" class="form-control" required> </div> <div class="col-md-12"> <label>地址</label> <input name="mem_address2" id="mem_address2" type="text" class="form-control" required> </div> </div> </td> </tr> <tr> <td> <div class="row"> <div class="col-md-12"> <label><font size="3" color="#000">發票資料</font></label><br> <label class="radio"><input type="radio" name="order_invoice" value="二聯式" onClick="javascript:showfp2()" checked><i></i> 二聯式</label> <label class="radio"><input type="radio" name="order_invoice" value="三聯式" onClick="javascript:showfp()"><i></i> 三聯式</label> </div> </div> </td> </tr> <tr id="fp2" style="display:none"> <td> <div class="row"> <div class="col-md-6"> <label>抬頭</label> <input name="order_invoice2" id="order_invoice2" type="text" class="form-control"> </div> <div class="col-md-6"> <label>統編</label> <input name="order_invoice3" id="order_invoice3" type="text" class="form-control"> </div> </div> </td> </tr> <tr> <td> <div class="row"> <div class="col-md-12"> <label><font size="3" color="#000">適合收件時間</font></label><br> <label class="radio"><input type="radio" name="order_time" value="白天9:00~18:00" required><i></i> 白天9:00~18:00</label><br> <label class="radio"><input type="radio" name="order_time" value="晚上18:00~21:00"><i></i> 晚上18:00~21:00</label> </div> </div> </td> </tr> <tr> <td> <div class="row"> <div class="col-md-12"> <label><font size="3" color="#000">付款方式</font></label><br> <label><input type="radio" name="order_pay" value="1" onClick="javascript:showfp3()" checked><i></i> 信用卡線上刷卡</label><br> <label><input type="radio" name="order_pay" value="2" onClick="javascript:showfp3()"><i></i> 超商取貨付款</label><br> <label><input type="radio" name="order_pay" value="3" onClick="javascript:showfp31()"><i></i> 臨櫃匯款</label><br> <p> 國泰世華銀行-八德分行<br> 戶名:天空商城有限公司<br> 帳號:077-03-500322-6 </p> <label><input type="radio" name="order_pay" value="4" onClick="javascript:showfp31()"><i></i> ATM轉帳</label><br> <p> 銀行代號:013,帳號:077-03-500322-6 </p> </div> <div class="col-md-3"> <label>輸入卡片末5碼</label> <input name="atm_code" id="atm_code" type="text" class="form-control"> </div> <input name="order_pay2" id="order_pay2" type="hidden" value=""> <input name="paytoesafe" id="paytoesafe" type="hidden" value="pay" /> <div class="col-md-12" id="fp3"> <label><font size="3" color="#000">分期期數:不分期</font></label><br> <img class="img-fluid" src="/images/28bank.jpg" alt="skybni"> </div> </div> </td> </tr> <tr> <td> <div class="row"> <div class="col-md-12"> <label><font size="3" color="#000">備註留言</font></label> <textarea id="mem_note" name="mem_note" rows="4" class="form-control"></textarea> </div> </div> </td> </tr> <tr> <td><input type="submit" name="Submit" value="確認購買資訊進入線上付款" class="btn u-btn-blue g-font-size-18 g-py-15 mb-4 g-color-white"></td> </tr> </table> </form> </div> </div> </div> <!-- End Shopping Cart --> </div> </div> <? } ?> <?php mysql_free_result($Rt2); mysql_free_result($Rtn); ?>
保存
取消
返回文件列表