发现科汛商城中订单下了以后无法修改价格,很不方便,自己修改了一下,测试了一下,能用了
如图:
由于不是很精通ASP,所以写的东西不一定完整,下面把过程写出来,精通ASP的大侠看看哪里有漏洞的,修改一下。
第一步,先修改/admin/KS.ShopOder.asp
要修改的地方:
Do While Not RSI.Eof
If Conn.execute("select title from ks_product where id=" & rsi("proid")).eof Then
OrderDetailStr=OrderDetailStr & " <tr valign='middle' class='tdbg' height='20'>"
OrderDetailStr=OrderDetailStr & " <td colspan='9'>该商品已被删除!</td>"
OrderDetailStr=OrderDetailStr & " </tr>"
Else
Dim TaxMoney
Dim TaxRate:TaxRate=KS.Setting(65)
If KS.Setting(64)=1 Or rs("NeedInvoice")=0 Then TaxMoney=1 Else TaxMoney=1+TaxRate/100
OrderDetailStr=OrderDetailStr & " <tr valign='middle' class='tdbg' height='20'>"
OrderDetailStr=OrderDetailStr & " <td width='*'><a href='" & DomainStr & "Shop/ShowInfo.asp?ID=" & RSi("proid") & "' target='_blank'>" & Conn.execute("select title from ks_product where id=" & rsi("proid"))(0) & "</a></td> "
OrderDetailStr=OrderDetailStr & " <td width='45' align=center>"& Conn.execute("select unit from ks_product where id=" & rsi("proid"))(0) & "</td> <td width='55' align='center'>" & rsi("amount") &"</td> "
OrderDetailStr=OrderDetailStr & " <td width='25' align='center'>" & formatnumber(rsi("price_original"),2) & "</td> "
OrderDetailStr=OrderDetailStr & " <td width='65' align='center'>" & formatnumber(rsi("price"),2) & "</td> "
OrderDetailStr=OrderDetailStr & " <td width='165' align='center'><form method='POST' action='fixprice.asp'><input type='hidden' name='OrderID' value='" & RSi("OrderID") & "' /><input type='hidden' name='id' value='" & RSi("id") & "' /><input type='hidden' name='Discount_Payment' value='" & rs("Discount_Payment") & "' /><input type='hidden' name='Charge_Deliver' value='" & rs("Charge_Deliver") & "' /><input type='hidden' name='TaxMoney' value='" & TaxMoney & "' /><input type='text' name='realprice' size='10' value='" & formatnumber(rsi("realprice"),2) & "'><input type='submit' value='修改价格' name='B3'></form></td> "
OrderDetailStr=OrderDetailStr & " <td width='85' align='right'>" & formatnumber(rsi("realprice")*rsi("amount"),2) & "</td> "
OrderDetailStr=OrderDetailStr & " <td width='65' align=center>" & rsi("ServiceTerm") & "</td> "
OrderDetailStr=OrderDetailStr & " <td align=center width='45'>" & rsi("Remark") & "</td> "
OrderDetailStr=OrderDetailStr & " </tr> "
end if
TotalPrice=TotalPrice+ rsi("realprice")*rsi("amount")
rsi.movenext
loop
rsi.close:set rsi=nothing
以上蓝色部分,本来是在下方的,为了能调用TaxMoney的值,就挪到上面去了,应该没问题的吧。。。
然后就是红色部分,把价格放在文本框里面,方便修改,同时把需要的数值传递过去。
第二步:建立一个处理数据的文件:fixprice.asp
<!--#include file="../Conn.asp"-->
<!--#include file="../KS_Cls/Kesion.CommonCls.asp"-->
<!--#include file="../KS_Cls/Kesion.Label.CommonCls.asp"-->
<!--#include file="../KS_Cls/Kesion.AdministratorCls.asp"-->
<!--#include file="Include/Session.asp"-->
<%
dim OrderID,RealPrice,id,Discount_Payment,Charge_Deliver,Tax,MoneyGoods
MoneyGoods=0
ID=Request.form("ID")
OrderID=Request.form("OrderID")
Discount_Payment=Request.form("Discount_Payment")
Charge_Deliver=Request.form("Charge_Deliver")
TaxMoney=Request.form("TaxMoney")
RealPrice=Request.form("RealPrice")
Set RS=Server.CreateObject("Adodb.RecordSet")
RS.Open "Select * From KS_orderitem Where ID="& ID &"",Conn,1,3
IF RS.Eof And RS.Bof Then
Response.End
Else
RS("RealPrice")=RealPrice
RS("TotalPrice")=formatnumber(RealPrice*RS("Amount"),2)
RS.Update
end if
RS.Close:Set RS=Nothing
Set RS=Server.CreateObject("Adodb.RecordSet")
RS.Open "Select * From KS_orderitem Where OrderID='"& OrderID &"'",Conn,3,1
Do while not RS.Eof
MoneyGoods=MoneyGoods+RS("RealPrice")*RS("Amount")
RS.Movenext
Loop
RS.Close:Set RS=Nothing
Set RS=Server.CreateObject("Adodb.RecordSet")
RS.Open "Select * From KS_order Where OrderID='"& OrderID &"'",Conn,1,3
IF RS.Eof And RS.Bof Then
Response.End
Else
RS("MoneyGoods")=MoneyGoods
RS("MoneyTotal")=formatnumber((MoneyGoods*Discount_Payment/100+Charge_Deliver)*TaxMoney,2)
RS.Update
end if
RS.Close:Set RS=Nothing
Response.redirect(request.servervariables("http_referer"))
%>
把这个文件放在/Admin文件夹下面就可以了
我已经把这两个文件打包了,需要的直接下载然后解压到/ADMIN文件夹下面覆盖就可以(最好先备份 ,虽然我测试没问题,但是我不敢保证的)
希望这个功能对需要用到这个功能的朋友有一点帮助。
ps:fixprice.asp在处理数据的前并没有对数据类型进行判断,不过如果传递的价格不是数字的话,数据也处理不了,只能退回。本人很懒,就没写判断数据的语句了,如果需要,自己写一个或者上网找一下,加进去就行了
以下内容只有回复后才可以浏览,请先登录!