|
|
|
ช่วยดูหน่อยคับ ไม่รู้ว่าเขียนผิดตรงใหน ช่วยดูหน่อยคับ ไม่รู้ว่าเขียนผิดตรงใหน |
|
|
|
|
|
|
|
ช่วยระบุอีกนิดได้ไหมครับ ว่ารู้สึกผิดตรงไหน???
|
|
|
|
|
Date :
2014-01-11 14:58:30 |
By :
{Cyberman} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
จาก code ต้องเขียนไง code1 ไป code2
code1
Code (PHP)
<?
session_start();
//เช็คตะกร้า
include('process/connect.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?
//ตกแต่ง
$sqlDecoration="SELECT * FROM decoration";
$resultDecoration=mysql_query($sqlDecoration)or die(mysql_error());
$rowDecoration=mysql_fetch_array($resultDecoration);
//ข้อมูลร้าน
$sqlSetting="SELECT * FROM setting";
$resultSetting=mysql_query($sqlSetting)or die(mysql_error());
$rowSetting=mysql_fetch_array($resultSetting);
//ส่วนเสริม
$sqlPlus="SELECT * FROM plus";
$resultPlus=mysql_query($sqlPlus)or die(mysql_error());
$rowPlus=mysql_fetch_array($resultPlus);
?>
<link rel="shortcut icon" href="image/<?=$rowDecoration['favicon']?>"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta http-equiv="content-language" content="th"/>
<meta name="robots" content="noodp, noydir"/>
<?=$rowSetting['stats_meta']?>
<?=$rowSetting['google_analytics']?>
<?
//เช็คตะกร้า
if(!isset($_SESSION['cart'])){echo"<script>window.location='ตะกร้าสินค้า.html';</script>";exit;}
?>
<title>ข้อมูลการจัดส่ง | <?=$rowSetting['title']?></title>
<meta name="description" content="<?=$rowSetting['description']?>"/>
<?
if(empty($keyword)){echo"<meta name='keywords' content='$rowSetting[keyword]'/>";}
else if(!empty($keyword)){echo"<meta name='keywords' content='$keyword'/>";}
?>
<meta name="author" content="<?=$rowSetting['author']?>"/>
<link href="css/design.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="js/scrolltopcontrol.js"></script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<style type="text/css">
#background{<? if($rowDecoration['background_image']!=""){echo"background-image:url(image/$rowDecoration[background_image]);";}?>
background-color:<?=$rowDecoration['background_color']?>;
background-attachment:<?=$rowDecoration['attachment']?>;
background-repeat:<?=$rowDecoration['repeat']?>;
background-position:<?=$rowDecoration['horizontal_position']." ".$rowDecoration['vertical_position']?>;}
</style>
</head>
<body id="background">
<? if(isset($_SESSION['member'])){$member=$_SESSION['member'];}?>
<div id="nav">
<div>
<a href="<?=$rowSetting['website_name']?>" class="logo" title="<?=$rowSetting['title']?>"><img src="<?=$rowSetting['website_name']."/"?>image/<?=$rowDecoration['logo']?>" alt="<?=$rowSetting['title']?>" title="<?=$rowSetting['title']?>"/></a>
<?
//เมนูข้างบนบน
include('MenuTop.php');
?>
<div style="clear:both;"></div>
</div>
</div>
<div id="content">
<?
include ('sidebar.php');
?>
<div id="section">
<form action="คำสั่งซื้อ.html" method="post" name="order">
<table class="box" width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<th style="text-align:left;">เลือกวิธีการจัดส่ง</th>
</tr>
<tr>
<td>
<?
$cart=$_SESSION['cart'];
?>
<table class="list" width="100%" border="0" align="center" cellpadding="5" cellspacing="1">
<tr>
<th width="100" align="center">ภาพสินค้า</th>
<th align="center">รายการสินค้า</th>
<th width="65" align="center">ราคา</th>
<th width="65" align="center">จำนวน</th>
<th width="75" align="center">ราคารวม</th>
</tr>
<?
$i=0;
$sum=0;
$quantity=0;
foreach($cart as $id=>$item){
?>
<tr>
<td align="center">
<a href="สินค้า-<?=$item['id']."-".rewrite_url($item['name'])?>.html" target="_blank"><img src="product/<?=$item['image']?>" width="90" border="0"/></a> </td>
<td align="center"><?=$item['name']?><br/><?=$item['option']?></td>
<td align="center"><?=number_format($item['price'])?></td>
<td align="center"><?=$item['amount']?></td>
<td align="right"><?=number_format($item["price"]*$item["amount"])?></td>
</tr>
<?
$sum+=$item['price']*$item['amount'];
$quantity+=$item['amount'];
$i++;
}
?>
<tr>
<td colspan="4" align="right" style="background:#fafafa;">ราคารวม (บาท)</td>
<td style="font-size:16px;background:#fafafa;" align="right"><input name="sum" type="hidden" value="<?=$sum?>"/><?=number_format($sum)?></td>
</tr>
<tr>
<td colspan="5" align="right" style="background:#fafafa;">เลือกวิธีจัดส่ง
<select name="shipping">
<?
$sqlShipping="SELECT * FROM shipping";
$resultShipping=mysql_query($sqlShipping)or die(mysql_error());
$numShipping=mysql_num_rows($resultShipping);
for($i=1;$i<=$numShipping;$i++){$rowShipping=mysql_fetch_array($resultShipping);
?>
<option value="<?=$rowShipping['id']?>"><?=$rowShipping['option']?> <? if($rowShipping['price']>0){echo $rowShipping['price'].'บาท';}?></option>
<?
}
?>
</select>
</td>
</tr>
</table>
<div align="center" style="padding:15px 0 0 0;">
<input type="button" onclick="window.location='ตะกร้าสินค้า.html'" value="กลับไปแก้ไข"/>
</div>
</td>
</tr>
</table>
<?
if(isset($_SESSION['member'])){
$sqlMember="SELECT * FROM member WHERE username='$member'";
$resultMember=mysql_query($sqlMember)or die(mysql_error());
$rowMember=mysql_fetch_array($resultMember);
$fullname=$rowMember['fullname'];
$address=$rowMember['address'];
$zipcode=$rowMember['zipcode'];
$tel=$rowMember['tel'];
$email=$rowMember['email'];
}
else{
$fullname="";
$address="";
$tel="";
$zipcode="";
$email="";
}
?>
<table class="box" width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<th style="text-align:left;">ข้อมูลในการจัดส่ง</th>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="120">ชื่อ -นามสกุล ผู้รับ</td>
<td><input type="text" name="fullname" required value="<?=$fullname?>" style="width:200px;"/></td>
</tr>
<tr>
<td>ที่อยู่</td>
<td><textarea name="address" rows="5" required style="width:300px;max-width:500px;"><?=$address?></textarea></td>
</tr>
<tr>
<td>รหัสไปรษณีย์</td>
<td><input type="text" name="zipcode" required value="<?=$zipcode?>" style="width:60px;"/></td>
</tr>
<tr>
<td>เบอร์ติดต่อ</td>
<td><input type="text" name="tel" value="<?=$tel?>" style="width:200px;"/></td>
</tr>
<tr>
<td>อีเมล์</td>
<td><input type="text" name="email" required value="<?=$email?>" style="width:200px;"/></td>
</tr>
<tr>
<td>หมายเหตุ</td>
<td><textarea name="note" rows="5" style="width:300px;max-width:500px;"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="ยืนยันการสั่งซื้อ"/></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</div>
<?
if($rowPlus['html_2']!=""){
?>
<div id="section">
<div class="html2"><?=$rowPlus['html_2']?></div>
</div>
<?
}
?>
<div style="clear:both;"></div>
</div>
<div class="footer">
<div style="float:left;">
<h1><?=$rowSetting['title']?></h1>
</div>
<div style="float:right;">
<?=$rowSetting['tel']?> <?=$rowSetting['email']?>
</div>
<br/>
<hr/>
<div>
<?
//เมนูข้างล่าง
include('MenuBelow.php');
?>
<a href="<?=$rowSetting['website_name']?>" title="<?=$rowSetting['title']?>"><img src="<?=$rowSetting['website_name']."/"?>image/<?=$rowDecoration['logo']?>" alt="<?=$rowSetting['title']?>" title="<?=$rowSetting['title']?>"/></a>
</div>
</div>
<div class="stats" style="display:<?=$rowSetting['stats_display']?>;text-align:center">
<?=$rowSetting['stats_script']?>
</div>
<?
function rewrite_url($url="url"){
$url=strtolower(str_replace(" ","_",$url));
$url=strtolower(preg_replace('~[^a-z0-9ก-๙\.\-\_]~iu','',$url));
return $url;
}
mysql_close($conn);
?>
</body>
</html>
<script type="text/javascript">
(function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0];
if(d.getElementById(id))return;
js=d.createElement(s);js.id=id;
js.src="//connect.facebook.net/th_TH/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document,'script','facebook-jssdk'))
</script>
code2
Code (PHP)
<?
session_start();
include('process/connect.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?
//ตกแต่ง
$sqlDecoration="SELECT * FROM decoration";
$resultDecoration=mysql_query($sqlDecoration)or die(mysql_error());
$rowDecoration=mysql_fetch_array($resultDecoration);
//ข้อมูลร้าน
$sqlSetting="SELECT * FROM setting";
$resultSetting=mysql_query($sqlSetting)or die(mysql_error());
$rowSetting=mysql_fetch_array($resultSetting);
//ส่วนเสริม
$sqlPlus="SELECT * FROM plus";
$resultPlus=mysql_query($sqlPlus)or die(mysql_error());
$rowPlus=mysql_fetch_array($resultPlus);
?>
<link rel="shortcut icon" href="image/<?=$rowDecoration['favicon']?>"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta http-equiv="content-language" content="th"/>
<meta name="robots" content="noodp, noydir"/>
<?=$rowSetting['stats_meta']?>
<?=$rowSetting['google_analytics']?>
<?
//เช็คตะกร้า
if(!isset($_SESSION['cart'])){echo"<script>window.location='ตะกร้าสินค้า.html';</script>";exit;}
//เช็คค่า
if($_REQUEST['fullname']==""||$_REQUEST['address']==""||$_REQUEST['zipcode']==""||$_REQUEST['email']==""){
echo"<script>alert('ยังกรอกข้อมูลไม่ครบ');window.location='จัดส่ง.html';</script>";exit;
}
else if(!filter_var($_REQUEST['email'], FILTER_VALIDATE_EMAIL)){echo"<script>alert('รูปแบบอีเมลล์ผิด');history.back();</script>";exit();}
//สมาชิก
if(empty($_SESSION['member'])){
$member_id=0;
$fullname=$_REQUEST['fullname'];
}
else{
$member=$_SESSION['member'];
$sqlMember="SELECT * FROM member WHERE username='$member'";
$resultMember=mysql_query($sqlMember)or die(mysql_error());
$rowMember=mysql_fetch_array($resultMember);
$member_id=$rowMember['id'];
$fullname=$rowMember['fullname'];
}
//จัดส่ง
$shipping=$_REQUEST['shipping'];
$sqlShipping="SELECT * FROM shipping WHERE id=$shipping";
$resultShipping=mysql_query($sqlShipping)or die(mysql_error());
$rowShipping=mysql_fetch_array($resultShipping);
$shipping_price=$rowShipping['price'];
$shipping_option=$rowShipping['option'];
//รับค่า
$cart=$_SESSION['cart'];
$address=$_REQUEST['address'];
$zipcode=$_REQUEST['zipcode'];
$email=$_REQUEST['email'];
$tel=$_REQUEST['tel'];
$note=$_REQUEST['note'];
$sum=$_REQUEST['sum'];
$shipping=$_REQUEST['shipping'];
$total=$sum+$shipping_price;
//คำสั่งซื้อ
$sql="INSERT INTO `order`(member_id, fullname, address, zipcode, email, tel, total, shipping_option, shipping_price, status, note, insert_date, last_update) VALUES($member_id,'$_REQUEST[fullname]',\"$address\",'$zipcode', '$email', '$tel', $total, \"$shipping_option\", $shipping_price, 'ยังไม่ชำระเงิน', \"$note\" ,now(), now())";
mysql_query($sql)or die(mysql_error());
//คืนค่าไอดี
$order_id=mysql_insert_id();
//รายละเอียดคำสั่งซื้อ
foreach($cart as $id=>$item){
$sql="INSERT INTO order_detail(order_id, product_image, product_id, product_name, option_name, product_price, amount) VALUES($order_id, '$item[image]', $item[id], \"$item[name]\", \"$item[option]\", $item[price], $item[amount])";
mysql_query($sql)or die(mysql_error());
}
//ชำระเงิน
$sqlPayment="SELECT * FROM bank";
$resultPayment=mysql_query($sqlPayment)or die(mysql_error());
$numPayment=mysql_num_rows($resultPayment);
?>
<title>คำสั่งซื้อ | <?=$rowSetting['title']?></title>
<meta name="description" content="<?=$rowSetting['description']?>"/>
<?
if(empty($keyword)){echo"<meta name='keywords' content='$rowSetting[keyword]'/>";}
else if(!empty($keyword)){echo"<meta name='keywords' content='$keyword'/>";}
?>
<meta name="author" content="<?=$rowSetting['author']?>"/>
<link href="css/design.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="js/scrolltopcontrol.js"></script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<style type="text/css">
#background{<? if($rowDecoration['background_image']!=""){echo"background-image:url(image/$rowDecoration[background_image]);";}?>
background-color:<?=$rowDecoration['background_color']?>;
background-attachment:<?=$rowDecoration['attachment']?>;
background-repeat:<?=$rowDecoration['repeat']?>;
background-position:<?=$rowDecoration['horizontal_position']." ".$rowDecoration['vertical_position']?>;}
</style>
</head>
<body id="background">
<? if(isset($_SESSION['member'])){$member=$_SESSION['member'];}?>
<div id="nav">
<div>
<a href="<?=$rowSetting['website_name']?>" class="logo" title="<?=$rowSetting['title']?>"><img src="<?=$rowSetting['website_name']."/"?>image/<?=$rowDecoration['logo']?>" alt="<?=$rowSetting['title']?>" title="<?=$rowSetting['title']?>"/></a>
<?
//เมนูข้างบนบน
include('MenuTop.php');
?>
<div style="clear:both;"></div>
</div>
</div>
<div id="content">
<?
include ('sidebar.php');
?>
<div id="section">
<table class="box" width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<th style="text-align:left;">รายละเอียดคำสั่งซื้อ</th>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="120">รหัสคำสั่งซื้อ</td>
<td><?=$order_id?></td>
</tr>
<tr>
<td width="100">ชื่อ -นามสกุล ผู้รับ</td>
<td><?=$_REQUEST['fullname']?></td>
</tr>
<tr>
<td>ที่อยู่</td>
<td><?=$address?></td>
</tr>
<tr>
<td>รหัสไปรษณีย์</td>
<td><?=$zipcode?></td>
</tr>
<tr>
<td>เบอร์ติดต่อ</td>
<td><?=$tel?></td>
</tr>
<tr>
<td>อีเมล์</td>
<td><?=$email?></td>
</tr>
<tr>
<td>หมายเหตุ</td>
<td><? if($note==""){echo"-";}else{echo $note;}?></td>
</tr>
</table>
<hr />
<?
$cart=$_SESSION['cart'];
?>
<table class="list" style="margin-top:20px;" width="100%" border="0" align="center" cellpadding="5" cellspacing="1">
<tr>
<th width="100" align="center">ภาพสินค้า</th>
<th align="center" class="list">รายการสินค้า</th>
<th width="65" align="center">ราคา</th>
<th width="65" align="center">จำนวน</th>
<th width="75" align="center">ราคารวม</th>
</tr>
<?
$i=0;
$sum=0;
$quantity=0;
foreach($cart as $id=>$item){
?>
<tr>
<td align="center">
<a href="สินค้า-<?=$item['id']."-".rewrite_url($item['name'])?>.html" target="_blank"><img src="product/<?=$item['image']?>" width="90" border="0"/></a></td>
<td align="center"><?=$item['name']?><br/><?=$item['option']?></td>
<td align="center"><?=number_format($item['price'])?></td>
<td align="center"><?=$item['amount']?></td>
<td align="right"><?=number_format($item['price']*$item['amount'])?></td>
</tr>
<?
$sum+=$item['price']*$item['amount'];
$quantity+=$item['amount'];
$i++;
}
?>
<tr>
<td colspan="4" align="right" style="background:#fafafa;"><?=$shipping_option?></td>
<td align="right" style="background:#fafafa;"><?=number_format($shipping_price)?></td>
</tr>
<tr>
<td colspan="4" align="right" style="background:#fafafa;">ราคารวมทั้งหมด (บาท)</td>
<td style="font-size:16px;background:#fafafa;" align="right">
<input type="hidden" name="total" id="<?=$sum+$shipping_price?>"/>
<?=number_format($sum+$shipping_price)?>
</td>
</tr>
</table>
<div align="center" style="padding:15px 0 0 0;">
<input type="button" onclick="window.location='<?=$rowSetting['website_name']?>'" value="กลับไปหน้าหลัก" />
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<?
if($rowPlus['html_2']!=""){
?>
<div id="section">
<div class="html2"><?=$rowPlus['html_2']?></div>
</div>
<?
}
?>
<div style="clear:both;"></div>
</div>
<div class="footer">
<div style="float:left;">
<h1><?=$rowSetting['title']?></h1>
</div>
<div style="float:right;">
<?=$rowSetting['tel']?> <?=$rowSetting['email']?>
</div>
<br/>
<hr/>
<div>
<?
//เมนูข้างล่าง
include('MenuBelow.php');
?>
<a href="<?=$rowSetting['website_name']?>" title="<?=$rowSetting['title']?>"><img src="<?=$rowSetting['website_name']."/"?>image/<?=$rowDecoration['logo']?>" alt="<?=$rowSetting['title']?>" title="<?=$rowSetting['title']?>"/></a>
</div>
</div>
<div class="stats" style="display:<?=$rowSetting['stats_display']?>;text-align:center">
<?=$rowSetting['stats_script']?>
</div>
<?
function rewrite_url($url="url"){
$url=strtolower(str_replace(" ","_",$url));
$url=strtolower(preg_replace('~[^a-z0-9ก-๙\.\-\_]~iu','',$url));
return $url;
}
mysql_close($conn);
?>
</body>
</html>
<script type="text/javascript">
(function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0];
if(d.getElementById(id))return;
js=d.createElement(s);js.id=id;
js.src="//connect.facebook.net/th_TH/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document,'script','facebook-jssdk'))
</script>
<?
//ข้อความ
$header="MIME-Version: 1.0\r\n";
$header.="Content-type: text/html; charset=utf-8\r\n";
$header.="From: $rowSetting[shop_name] <$rowSetting[email]>\r\n";
$header.="Reply-To: $rowSetting[email]";
$subject="รายละเอียดคำสั่งซื้อสินค้าจาก $rowSetting[shop_name]";
$message="เรียนคุณ $_POST[fullname]<br/>";
$message.="คุณได้ทำการสั่งซื้อสินค้าจาก $rowSetting[shop_name] โดยมีรายละเอียดดังนี้<br/><br/>";
$message.="<b>รหัสคำสั่งซื้อ $order_id</b><br/><br/>";
$message.="
<table bgcolor='#e5e5e5' width='100%' border='0' align='center' cellpadding='5' cellspacing='1'>
<tr>
<th width='90' bgcolor='#fafafa'>ภาพสินค้า</th>
<th bgcolor='#fafafa'>รายการสินค้า</th>
<th width='65' bgcolor='#fafafa'>ราคา</th>
<th width='65' bgcolor='#fafafa'>จำนวน</th>
<th width='75' bgcolor='#fafafa'>ราคารวม</th>
</tr>
";
$i=1;
$sum=0;
$quantity=0;
foreach($cart as $id=>$item){
$price=number_format($item['price']);
$amount=number_format($item['amount']);
$sum_list=number_format($item['price']*$item['amount']);
$message.="
<tr>
<td bgcolor='#fff'><img src='$rowSetting[website_name]/product/$item[image]' width='90' border='0'/></td>
<td align='center' bgcolor='#fff'>$item[name]<br/>$item[option]</td>
<td align='center' bgcolor='#fff'>$price</td>
<td align='center' bgcolor='#fff'>$amount</td>
<td align='right' bgcolor='#fff'>$sum_list</td>
</tr>";
$quantity+=$item['amount'];
$sum+=$item['price']*$item['amount'];
$total=number_format($sum+$shipping_price);
$i++;
}
$message.="
<tr>
<td colspan='4' align='right' bgcolor='#fff'>$shipping_option</td>
<td align='right' bgcolor='#fff'>$shipping_price</td>
</tr>
<tr>
<td colspan='4' align='right' bgcolor='#fff'>ราคารวมทั้งหมด (บาท)</td>
<td style='font-weight:bold' align='right' bgcolor='#fff'>$total</td>
</tr>
</table><br/><br/>
";
//จัดส่ง
$message.="<b>ข้อมูลในการจัดส่ง</b><br/><br/>";
$message.="
<table bgcolor='#e5e5e5' width='100%' border='0' align='center' cellpadding='5' cellspacing='1'>
<tr>
<th width='150' align='left' bgcolor='#fafafa'>ชื่อ-นามสกุล ผู้รับ</th>
<td align='left' bgcolor='#fff'>$fullname</td>
</tr>
<tr>
<th align='left' bgcolor='#fafafa'>ที่อยู่ในการจัดส่ง</th>
<td align='left' bgcolor='#fff'>$address $zipcode</td>
</tr>
<tr>
<th align='left' bgcolor='#fafafa'>เบอร์ติดต่อ</th>
<td align='left' bgcolor='#fff'>$tel</td>
</tr>
<tr>
<th align='left' bgcolor='#fafafa'>หมายเหตุ</th>
<td align='left' bgcolor='#fff'>$note</td>
</tr>
</table><br/><br/>
";
//ชำระเงิน
$message.="<b>วิธีการชำระเงิน</b><br/>";
$message.="สามารถชำระเงินโดยโอนเข้าบัญชีธนาคารของร้านดังต่อไปนี้<br/><br/>";
$message.="
<table bgcolor='#e5e5e5' width='100%' border='0' align='center' cellpadding='5' cellspacing='1'>
<tr>
<th width='120' bgcolor='#fafafa'>ธนาคาร</th>
<th bgcolor='#fafafa'>ชื่อบัญชี</th>
<th width='120' bgcolor='#fafafa'>เลขที่บัญชี</th>
<th width='120' bgcolor='#fafafa'>สาขา</th>
</tr>
";
for($i=1;$i<=$numPayment;$i++){
$rowPayment=mysql_fetch_array($resultPayment);
$message.="
<tr>
<td align='center' bgcolor='#fff'>$rowPayment[name]</td>
<td align='center' bgcolor='#fff'>$rowPayment[account_name]</td>
<td align='center' bgcolor='#fff'>$rowPayment[account_number]</td>
<td align='center' bgcolor='#fff'>$rowPayment[branch]</td>
</tr>
";
}
$message.="</table><br/><br/>";
$message.="<a href='$rowSetting[website_name]/payment.php?order_id=$order_id' target='_blank'>คลิกที่นี่</a> เพื่อแจ้งการชำระเงิน<br/><br/>";
$message.="ขอขอบคุณที่อุดหนุนและใช้บริการกับเรา<br/>";
$message.="$rowSetting[shop_name]";
//ส่งเมล์
mail($email, $subject, $message, $header);
//อีเมล์ผู้ขาย
$header="MIME-Version: 1.0\r\n";
$header.="Content-type: text/html; charset=utf-8\r\n";
$header.="From: $fullname <$email>\r\n";
$header.="Reply-To: $email";
$subject="มีรายการคำสั่งซื้อใหม่จาก $rowSetting[shop_name]";
$message="มีรายการคำสั่งซื้อใหม่จากคุณ $_POST[fullname] โดยมีรายละเอียดดังนี้<br/><br/>";
$message.="<strong>รหัสคำสั่งซื้อ $order_id</strong><br/><br/>";
$message.="
<table bgcolor='#e5e5e5' width='100%' border='0' align='center' cellpadding='5' cellspacing='1'>
<tr>
<th width='90' bgcolor='#fafafa'>ภาพสินค้า</th>
<th bgcolor='#fafafa'>รายการสินค้า</th>
<th width='65' bgcolor='#fafafa'>ราคา</th>
<th width='65' bgcolor='#fafafa'>จำนวน</th>
<th width='75' bgcolor='#fafafa'>ราคารวม</th>
</tr>
";
$i=1;
$sum=0;
$quantity=0;
foreach($cart as $id=>$item){
$price=number_format($item['price']);
$amount=number_format($item['amount']);
$sum_list=number_format($item['price']*$item['amount']);
$message.="
<tr>
<td bgcolor='#fff'><img src='$rowSetting[website_name]/product/$item[image]' width='90' border='0'/></td>
<td align='center' bgcolor='#fff'>$item[name]<br/>$item[option]</td>
<td align='center' bgcolor='#fff'>$price</td>
<td align='center' bgcolor='#fff'>$amount</td>
<td align='right' bgcolor='#fff'>$sum_list</td>
</tr>";
$quantity+=$item['amount'];
$sum+=$item['price']*$item['amount'];
$total=number_format($sum+$shipping_price);
$i++;
}
$message.="
<tr>
<td colspan='4' align='right' bgcolor='#fff'>$shipping_option</td>
<td align='right' bgcolor='#fff'>$shipping_price</td>
</tr>
<tr>
<td colspan='4' align='right' bgcolor='#fff'>ราคารวมทั้งหมด (บาท)</td>
<td style='font-weight:bold' align='right' bgcolor='#fff'>$total</td>
</tr>
</table><br/><br/>
";
//จัดส่ง
$message.="<strong>ข้อมูลในการจัดส่ง</strong><br/><br/>";
$message.="
<table bgcolor='#e5e5e5' width='100%' border='0' align='center' cellpadding='5' cellspacing='1'>
<tr>
<th width='150' align='left' bgcolor='#fafafa'>ชื่อ-นามสกุล ผู้รับ</th>
<td align='left' bgcolor='#fff'>$fullname</td>
</tr>
<tr>
<th align='left' bgcolor='#fafafa'>ที่อยู่ในการจัดส่ง</th>
<td align='left' bgcolor='#fff'>$address $zipcode</td>
</tr>
<tr>
<th align='left' bgcolor='#fafafa'>เบอร์ติดต่อ</th>
<td align='left' bgcolor='#fff'>$tel</td>
</tr>
<tr>
<th align='left' bgcolor='#fafafa'>หมายเหตุ</th>
<td align='left' bgcolor='#fff'>$note</td>
</tr>
</table><br/><br/>
";
$message.="จัดการคำสั่งซื้อได้ที่ระบบหลังร้าน <a href='$rowSetting[website_name]/admin' target='_blank'>คลิกที่นี่</a>";
mail($rowSetting['email'], $subject, $message, $header);
//ยกเลิกเซสชัน
unset($_SESSION['cart']);
?>
|
|
|
|
|
Date :
2014-01-11 20:00:21 |
By :
oooo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|