buycar_form.php
3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
if(!defined('InEmpireCMS'))
{
exit();
}
?>
<?php
$buycar=getcvar('mybuycar');
$record="!";
$field="|";
$totalmoney=0; //商品總金額
$buytype=0; //支付類型:1為金額,0為點數
$totalfen=0; //商品總積分
$buycarr=explode($record,$buycar);
$bcount=count($buycarr);
?>
<table width='100%' border=0 align=center cellpadding=3 cellspacing=1>
<form name=form1 method=post action='../doaction.php'>
<input type=hidden name=enews value=EditBuycar>
<tr class='header'>
<td width='16%' height=23> <div align=center>圖片</div></td>
<td width='29%'> <div align=center>商品名稱</div></td>
<td width='14%'> <div align=center>市場價格</div></td>
<td width='14%'> <div align=center>優惠價格</div></td>
<td width='8%'> <div align=center>數量</div></td>
<td width='14%'> <div align=center>小計</div></td>
<td width='5%'> <div align=center>刪除</div></td>
</tr>
<?php
for($i=0;$i<$bcount-1;$i++)
{
$pr=explode($field,$buycarr[$i]);
$productid=$pr[1];
$fr=explode(",",$pr[1]);
//ID
$classid=(int)$fr[0];
$id=(int)$fr[1];
if(empty($class_r[$classid][tbname]))
{
continue;
}
//屬性
$addatt='';
if($pr[2])
{
$addatt=$pr[2];
}
//數量
$pnum=(int)$pr[3];
if($pnum<1)
{
$pnum=1;
}
//取得產品信息
$productr=$empire->fetch1("select title,tprice,price,isurl,titleurl,classid,id,titlepic,buyfen from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where id='$id' limit 1");
if(!$productr['id']||$productr['classid']!=$classid)
{
continue;
}
//是否全部點數
if(!$productr[buyfen])
{
$buytype=1;
}
$totalfen+=$productr[buyfen]*$pnum;
//產品圖片
if(empty($productr[titlepic]))
{
$productr[titlepic]="../../data/images/notimg.gif";
}
//返回鏈接
$titleurl=sys_ReturnBqTitleLink($productr);
$thistotal=$productr[price]*$pnum;
$totalmoney+=$thistotal;
?>
<tr>
<td align="center"><a href="<?=$titleurl?>" target="_blank"><img src="<?=$productr[titlepic]?>" border=0 width=80 height=80></a></td>
<td align="center"><a href="<?=$titleurl?>" target="_blank"><?=$productr[title]?></a><?=$addatt?' - '.$addatt:''?></td>
<td align="right">¥<?=$productr[tprice]?></td>
<td align="right"><b>¥<?=$productr[price]?></b></td>
<td align="center"><input type="text" name="num[]" value="<?=$pnum?>" size="6"></td>
<td align="right">¥<?=$thistotal?></td>
<td align="center"><input type="checkbox" name="del[]" value="<?=$productid.'|'.$addatt?>"></td>
<input type="hidden" name="productid[]" value="<?=$productid?>">
<input type="hidden" name="addatt[]" value="<?=$addatt?>">
</tr>
<?php
}
?>
<?php
if(!$buytype)//點數付費
{
?>
<tr height="25">
<td colspan="6"><div align="right">合計點數:<strong><?=$totalfen?></strong></div></td>
<td> </td>
</tr>
<?php
}
else
{
?>
<tr height="27">
<td colspan="6"><div align="right">合計:<strong>¥<?=$totalmoney?></strong></div></td>
<td> </td>
</tr>
<?php
}
?>
<tr>
<td colspan="7" height="25"><div align="right">
<a href="../doaction.php?enews=ClearBuycar"><img src="../../data/images/shop/clearbuycar.gif" width=92 height=23 border=0></a>
<input name="imageField" type="image" src="../../data/images/shop/editbuycar.gif" width=135 height=23 border=0>
<a href="javascript:window.close();"><img src="../../data/images/shop/buynext.gif" width=87 height=23 border=0></a>
<a href="../order/"><img src="../../data/images/shop/buycarnext.gif" width=87 height=19 border=0></a>
</div></td>
</tr>
</form>
</table>