0 then
applied=true
Discount=couponamount
If discount> GetSess("ordertotal") then
discount=GetSess("ordertotal")
end if
else
If not isnull(couponpercent) then
applied=true
Totalamount=GetSess("ordertotal")
discount=Totalamount*couponPercent
If discount>totalamount then
discount=totalamount
end if
end if
end if
Setsess "coupondiscount", discount
end sub
'
Sub ApplyDiscount (prodquantity, prodprice)
dim discount, coupondiscount, totalprice
CouponDiscount=GetSess("couponDiscount")
If isnull(couponpercent) then
couponpercent=0
end if
If couponpercent<>0 then
Totalprice=ProdPrice*ProdQuantity
Discount=TotalPrice*couponpercent
else
If isnull(couponamount) then
couponamount=0
end if
If couponamount>prodprice then
couponamount=prodprice
end if
Discount=couponamount*prodQuantity
If discount> GetSess("ordertotal") then
discount=GetSess("ordertotal")
end if
end if
Coupondiscount=couponDiscount+discount
Setsess "coupondiscount", coupondiscount
end sub
%>
<%
'*******************************************************
' Version 5.00 Coupon Validation
' Jan 5, 2003
'*******************************************************
dim sAction, Coupon
ShopPageHeader
Saction=Request("Action")
if sAction="" then
Saction=Request("Action.x")
end if
If saction="" then
AddCouponForm
else
HandleAction
If Serror="" then
WriteInfoMessage
else
addCouponForm
end if
end if
ShopPageTrailer
'
Sub AddCouponForm
if sError<> "" then
shopwriteerror sError
Serror=""
end if
coupon=Getsess("Coupon")
%>
<%
shopwriteheader getlang("LangCustCouponPrompt")
response.write "
"
Response.Write("")
end sub
Sub HandleAction
dim rc
coupon=request("coupon")
if coupon="" then
Serror= getlang("LangCouponMissing")
exit sub
end if
LocateCoupon coupon, rc, serror
if Serror="" then
SetSess "coupon",coupon
end if
end sub
Sub WriteInfoMessage
Response.write largeinfofont & getlang("LangCouponAccepted") & largeinfoend & "
"
end sub
%>