buycar_form.php 3.5 KB

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