|
|
|
ช่วยหน่อยนะครับ...คือจะให้ค่า subtotal กับ shipping fee(shipprice) + กันต้องทำไงครับ |
|
|
|
|
|
|
|
คือจะให้ค่า subtotal กับ shipping fee(shipprice) + กันต้องทำไงครับ
ช่วยหน่อยนะครับ นี่โค้ดครับ
<?php require_once('../include/connect.php'); ?>
<?php
// read template
$file = "template_orderreceipt.htm";
$fp = fopen($file,"r");
$data = fread($fp,filesize($file));
$oid = @$_GET["oid"];
if (empty($oid))
alertphp("Please choose orderid","myaccount.php");
//orders
$sql ="select * from orders where oid='$oid'";
$result = mysql_query($sql);
$orders = mysql_fetch_array($result);
//orderdetail
$od_data = "";
$sql ="select * from orderdetail where oid='$oid'";
$result = mysql_query($sql);
$num = mysql_num_rows($result);
for ($i=1; $i<=$num; $i++){
$od = mysql_fetch_array($result);
$od_data .= "<tr><td>$i</td>";
$od_data .= "<td>$od[pname]</td>";
$od_data .= "<td>$od[pprice]</td>";
$od_data .= "<td>$od[pqty]</td>";
$od_data .= "<td>$od[sumtotal]</td></tr>";
}
// Replace
$data = str_replace('{orderid}',$orders[oid],$data);
$data = str_replace('{orderdate}',$orders[odate],$data);
$data = str_replace('{customer}',$orders[cname],$data);
$data = str_replace('{shippingaddress}',$orders[caddress],$data);
$data = str_replace('{orderdetail}',$od_data,$data);
$data = str_replace('{subtotal}',$orders[subtotal],$data);
$data = str_replace('{shipprice}',$orders[shipprice],$data);
$data = str_replace('{vat}',$orders[vatprice],$data);
$data = str_replace('{grandtotal}',$orders[grandtotal],$data);
// show
echo $data;
echo $subtotal;
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Tag : - - - -
|
|
|
|
|
|
Date :
2009-06-14 20:30:54 |
By :
hahaha |
View :
2154 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$data = str_replace('{subtotal}',$orders[subtotal],$data);
$data = str_replace('{shipprice}',$orders[shipprice],$data);
$data = str_replace('{total}', floatval($orders[shipprice])+floatval($orders[shipprice]) ,$data);
แบบนี้มั้ง
|
|
|
|
|
Date :
2009-06-14 21:04:40 |
By :
plakrim |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากครับ
|
|
|
|
|
Date :
2009-06-15 16:07:41 |
By :
hahaha |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|