<% 'This code is copyright (c) Internet Business Solutions SL, all rights reserved. 'The contents of this file are protect under law as the intellectual property 'of Internet Business Solutions SL. Any use, reproduction, disclosure or copying 'of any kind without the express and written permission of Internet Business 'Solutions SL is forbidden. 'Author: Vince Reid, vince@virtualred.net Dim sSQL,rs,alldata,quantity,grandtotal,netnav,bExists,cartID,cartEmpty,index,index2,rowcounter,objItem,totShipOptions,cpnmessage,totaldiscounts,numhomecountries,nonhomecountries,blockmultipurchase Dim demomode,data1,data2,success,errormsg,shipping,totalgoods,orderid,sXML,destZip,allzones,stateTax,countryTaxRate,stateTaxRate,countryID,somethingToShip,taxfreegoods,uspsmethods,freeshipamnt,pzFSA Dim iTotItems,international,checkIntOptions,shipMethod,shipArr,shipcountry,intShipping(5,20),havematch,dHighest(10),dHighWeight,dTotalWeight,dTotalWeightOz,thePQuantity,thePWeight,numfirstclass,firstclasscost cartEmpty=False isInStock=true tempOutOfStock=false if dateadjust="" then dateadjust=0 netnav = true if instr(Request.ServerVariables("HTTP_USER_AGENT"), "compatible") > 0 OR instr(Request.ServerVariables("HTTP_USER_AGENT"), "Gecko") > 0 then netnav = false function atb(size) if netnav then atb = CInt(size / 2 + 1) else atb = size end if end function WSP = "" OWSP = "" nodiscounts=false success=True : checkIntOptions=False : alldata = "" : shipMethod = "" : shipping = 0 iTotItems = 0 : iWeight = 0 : countryTaxRate=0 : stateTaxRate=0 : countryTax=0 stateTax=0 : stateAbbrev="" : international = "" : thePQuantity = 0 : thePWeight = 0 totalquantity = 0 : statetaxfree = 0 : countrytaxfree = 0 : shipfreegoods = 0 : totalgoods = 0 somethingToShip = false : freeshippingapplied = false : freeshipamnt = 0 : rowcounter = 0 gotcpncode=false : isstandardship = false : numshipoptions=0 : homecountry = false cpncode = Trim(replace(request.form("cpncode"),"'","")) paypalexpress=FALSE payerid = request.form("payerid") token = request("token") ppexpresscancel=FALSE if trim(Request.form("sessionid"))<>"" then thesessionid=trim(Request.form("sessionid")) else thesessionid=Session.SessionID theid = Replace(Trim(Request.Form("id")),"'","") Set rs = Server.CreateObject("ADODB.RecordSet") Set rs2 = Server.CreateObject("ADODB.RecordSet") Set rs3 = Server.CreateObject("ADODB.RecordSet") Set cnn=Server.CreateObject("ADODB.Connection") cnn.open sDSN alreadygotadmin = getadminsettings() origShipType=shipType if (alternateratesups<>"" OR alternateratesusps<>"" OR alternateratesweightbased<>"" OR alternateratescanadapost<>"") then alternaterates = TRUE else alternaterates = FALSE if request.form("altrates")<>"" then altrate=int(request.form("altrates")) if alternateratesups<>"" AND altrate=4 then shipType=4 if alternateratesusps<>"" AND altrate=3 then shipType=3 if alternateratesweightbased<>"" AND altrate=2 then shipType=2 if alternateratescanadapost<>"" AND altrate=6 then shipType=6 end if ordPayProvider = replace(trim(request.form("payprovider")),"'","") if ordPayProvider<>"" then execute("handling = handling + handlingcharge" & ordPayProvider) if Session("clientUser")<>"" then if (Session("clientActions") AND 8) = 8 then WSP = "pWholesalePrice AS " if wholesaleoptionpricediff=TRUE then OWSP = "optWholesalePriceDiff AS " if nowholesalediscounts=true then nodiscounts=true end if if (Session("clientActions") AND 16) = 16 then Session.LCID = 1033 WSP = Session("clientPercentDiscount") & "*pPrice AS " if wholesaleoptionpricediff=TRUE then OWSP = Session("clientPercentDiscount") & "*optPriceDiff AS " if nowholesalediscounts=true then nodiscounts=true Session.LCID = saveLCID end if end if if Session("couponapply")<>"" then cnn.Execute("UPDATE coupons SET cpnNumAvail=cpnNumAvail+1 WHERE cpnID IN (0" & Session("couponapply")&")") Session("couponapply")="" end if Function show_states(tstate) Dim foundmatch foundmatch=false response.write "" if IsArray(allstates) then for rowcounter=0 to UBOUND(allstates,2) response.write ""&vbCrLf next end if show_states=foundmatch End Function Sub show_countries(tcountry) if IsArray(allcountries) then for rowcounter=0 to UBOUND(allcountries,2) response.write ""&vbCrLf next end if End Sub function checkuserblock(thepayprov) multipurchaseblocked=FALSE if thepayprov<>"7" AND thepayprov <> "13" then theip = trim(replace(left(request.servervariables("REMOTE_HOST"), 48), "'", "")) if theip = "" then theip = "none" if blockmultipurchase<>"" then cnn.Execute("DELETE FROM multibuyblock WHERE lastaccess<" & datedelim & VSUSDateTime(Now()-1) & datedelim) sSQL = "SELECT ssdenyid,sstimesaccess FROM multibuyblock WHERE ssdenyip = '" & theip & "'" rs.Open sSQL,cnn,0,1 if NOT rs.EOF then cnn.Execute("UPDATE multibuyblock SET sstimesaccess=sstimesaccess+1,lastaccess=" & datedelim & VSUSDateTime(Now()) & datedelim & " WHERE ssdenyid=" & rs("ssdenyid")) if rs("sstimesaccess") >= blockmultipurchase then multipurchaseblocked=TRUE else cnn.Execute("INSERT INTO multibuyblock (ssdenyip,lastaccess) VALUES ('" & theip & "'," & datedelim & VSUSDateTime(Now()) & datedelim & ")") end if rs.Close end if if theip = "none" then sSQL = "SELECT TOP 1 dcid FROM ipblocking" else sSQL = "SELECT dcid FROM ipblocking WHERE (dcip1=" & ip2long(theip) & " AND dcip2=0) OR (dcip1 <= " & ip2long(theip) & " AND " & ip2long(theip) & " <= dcip2 AND dcip2 <> 0)" end if rs.Open sSQL,cnn,0,1 if NOT rs.EOF then multipurchaseblocked = TRUE rs.Close end if checkuserblock = multipurchaseblocked end function sub checkpricebreaks(cpbpid,origprice) newprice="" sSQL = "SELECT SUM(cartQuantity) AS totquant FROM cart WHERE cartCompleted=0 AND cartSessionID="&Session.SessionID&" AND cartProdID='"&replace(cpbpid,"'","''")&"'" rs2.Open sSQL,cnn,0,1 if IsNull(rs2("totquant")) then thetotquant=0 else thetotquant = rs2("totquant") rs2.Close sSQL="SELECT "&WSP&"pPrice FROM pricebreaks WHERE "&thetotquant&">=pbQuantity AND pbProdID='"&replace(cpbpid,"'","''")&"' ORDER BY " & IIfVr(WSP="","pPrice",replace(WSP," AS ","")) rs2.Open sSQL,cnn,0,1 if NOT rs2.EOF then thepricebreak = rs2("pPrice") else thepricebreak = origprice end if rs2.Close Session.LCID = 1033 sSQL = "UPDATE cart SET cartProdPrice="&FormatNumber(thepricebreak,4,-1,0,0)&" WHERE cartCompleted=0 AND cartSessionID="&Session.SessionID&" AND cartProdID='"&replace(cpbpid,"'","''")&"'" Session.LCID = saveLCID cnn.Execute(sSQL) end sub function multShipWeight(theweight, themul) multShipWeight = (theweight*themul)/100.0 end function sub subtaxesfordiscounts(theExemptions, discAmount) if (theExemptions AND 1)=1 then statetaxfree = statetaxfree - discAmount if (theExemptions AND 2)=2 then countrytaxfree = countrytaxfree - discAmount if (theExemptions AND 4)=4 then shipfreegoods = shipfreegoods - discAmount end sub sub addadiscount(resset, groupdiscount, dscamount, subcpns, cdcpncode, statetaxhandback, countrytaxhandback, theexemptions, thetax) totaldiscounts = totaldiscounts + dscamount if groupdiscount then statetaxfree = statetaxfree - (dscamount * statetaxhandback) countrytaxfree = countrytaxfree - (dscamount * countrytaxhandback) else call subtaxesfordiscounts(theexemptions, dscamount) if perproducttaxrate then countryTax = countryTax - ((dscamount * thetax) / 100.0) end if if InStr(cpnmessage,"
" & resset("cpnName") & "
")=0 then cpnmessage = cpnmessage & resset("cpnName") & "
" if subcpns then Set theres = cnn.Execute("SELECT cpnID FROM coupons WHERE cpnNumAvail>0 AND cpnNumAvail<30000000 AND cpnID=" & resset("cpnID")) if NOT theres.EOF then Session("couponapply") = Session("couponapply") & "," & resset("cpnID") cnn.Execute("UPDATE coupons SET cpnNumAvail=cpnNumAvail-1 WHERE cpnNumAvail>0 AND cpnNumAvail<30000000 AND cpnID=" & resset("cpnID")) end if if cdcpncode<>"" AND LCase(Trim(resset("cpnNumber")))=LCase(cdcpncode) then gotcpncode=true end sub function timesapply(taquant,tathresh,tamaxquant,tamaxthresh,taquantrepeat,tathreshrepeat) if taquantrepeat=0 AND tathreshrepeat=0 then tatimesapply = 1.0 elseif tamaxquant=0 then tatimesapply = Int((tathresh-tamaxthresh) / tathreshrepeat)+1 elseif tamaxthresh=0 then tatimesapply = Int((taquant-tamaxquant) / taquantrepeat)+1 else ta1 = Int((taquant-tamaxquant) / taquantrepeat)+1 ta2 = Int((tathresh-tamaxthresh) / tathreshrepeat)+1 if ta2 < ta1 then tatimesapply = ta2 else tatimesapply = ta1 end if timesapply = tatimesapply end function sub calculatediscounts(cdgndtot, subcpns, cdcpncode) totaldiscounts = 0 cpnmessage = "
" cdtotquant = 0 if cdgndtot=0 then statetaxhandback = 0.0 countrytaxhandback = 0.0 else statetaxhandback = 1.0 - ((cdgndtot - statetaxfree) / cdgndtot) countrytaxhandback = 1.0 - ((cdgndtot - countrytaxfree) / cdgndtot) end if if NOT nodiscounts then Session.LCID = 1033 cdalldata = "" sSQL = "SELECT cartProdID,SUM(cartProdPrice*cartQuantity),SUM(cartQuantity),pSection,COUNT(cartProdID),pExemptions,pTax FROM products INNER JOIN cart ON cart.cartProdID=products.pID WHERE cartCompleted=0 AND cartSessionID="&thesessionid&" GROUP BY cartProdID,pSection,pExemptions,pTax" rs2.Open sSQL,cnn,0,1 if NOT (rs2.EOF OR rs2.BOF) then cdalldata=rs2.getrows rs2.Close if IsArray(cdalldata) then For index=0 to UBOUND(cdalldata,2) sSQL = "SELECT SUM(coPriceDiff*cartQuantity) AS totOpts FROM cart LEFT OUTER JOIN cartoptions ON cart.cartID=cartoptions.coCartID WHERE cartCompleted=0 AND cartSessionID="&thesessionid&" AND cartProdID='" & replace(cdalldata(0,index), "'", "''") & "'" rs2.Open sSQL,cnn,0,1 if NOT IsNull(rs2("totOpts")) then cdalldata(1,index) = cdalldata(1,index) + rs2("totOpts") rs2.Close cdtotquant = cdtotquant + cdalldata(2,index) topcpnids = cdalldata(3,index) thetopts = cdalldata(3,index) if isnull(cdalldata(6,index)) then cdalldata(6,index) = countryTaxRate if NOT IsNull(thetopts) then for cpnindex=0 to 10 if thetopts=0 then exit for else sSQL = "SELECT topSection FROM sections WHERE sectionID=" & thetopts rs.Open sSQL,cnn,0,1 if NOT rs.EOF then thetopts = rs("topSection") topcpnids = topcpnids & "," & thetopts else rs.Close exit for end if rs.Close end if next end if tdt = Date() sSQL = "SELECT DISTINCT cpnID,cpnDiscount,cpnType,cpnNumber,cpnName,cpnThreshold,cpnQuantity,cpnThresholdRepeat,cpnQuantityRepeat FROM coupons LEFT OUTER JOIN cpnassign ON coupons.cpnID=cpnassign.cpaCpnID WHERE cpnNumAvail>0 AND cpnEndDate>="&datedelim&VSUSDate(tdt)&datedelim&" AND (cpnIsCoupon=0" if cdcpncode<>"" then sSQL = sSQL & " OR (cpnIsCoupon=1 AND cpnNumber='"&cdcpncode&"')" sSQL = sSQL & ") AND cpnThreshold<="&cdalldata(1,index)&" AND (cpnThresholdMax>"&cdalldata(1,index)&" OR cpnThresholdMax=0) AND cpnQuantity<="&cdalldata(2,index)&" AND (cpnQuantityMax>"&cdalldata(2,index)&" OR cpnQuantityMax=0) AND (cpnSitewide=0 OR cpnSitewide=2) AND " sSQL = sSQL & "(cpnSitewide=2 OR (cpaType=2 AND cpaAssignment='"&cdalldata(0,index)&"') " sSQL = sSQL & "OR (cpaType=1 AND cpaAssignment IN ('"&Replace(topcpnids,",","','")&"')))" rs2.Open sSQL,cnn,0,1 do while NOT rs2.EOF if rs2("cpnType")=1 then ' Flat Rate Discount thedisc = cDbl(rs2("cpnDiscount")) * timesapply(cdalldata(2,index),cdalldata(1,index),rs2("cpnQuantity"),rs2("cpnThreshold"),rs2("cpnQuantityRepeat"),rs2("cpnThresholdRepeat")) if cdalldata(1,index) < thedisc then thedisc = cdalldata(1,index) call addadiscount(rs2, false, thedisc, subcpns, cdcpncode, statetaxhandback, countrytaxhandback, cdalldata(5,index), cdalldata(6,index)) elseif rs2("cpnType")=2 then ' Percentage Discount call addadiscount(rs2, false, ((cDbl(rs2("cpnDiscount")) * cDbl(cdalldata(1,index))) / 100.0), subcpns, cdcpncode, statetaxhandback, countrytaxhandback, cdalldata(5,index), cdalldata(6,index)) end if rs2.MoveNext loop rs2.Close Next end if tdt = Date() sSQL = "SELECT DISTINCT cpnID,cpnDiscount,cpnType,cpnNumber,cpnName,cpnSitewide,cpnThreshold,cpnThresholdMax,cpnQuantity,cpnQuantityMax,cpnThresholdRepeat,cpnQuantityRepeat FROM coupons WHERE cpnNumAvail>0 AND cpnEndDate>="&datedelim&VSUSDate(tdt)&datedelim&" AND (cpnIsCoupon=0" if cdcpncode<>"" then sSQL = sSQL & " OR (cpnIsCoupon=1 AND cpnNumber='"&cdcpncode&"')" sSQL = sSQL & ") AND cpnThreshold<="&cdgndtot&" AND cpnQuantity<="&cdtotquant&" AND (cpnSitewide=1 OR cpnSitewide=3) AND (cpnType=1 OR cpnType=2)" rs.Open sSQL,cnn,0,1 do while NOT rs.EOF totquant = 0 totprice = 0 if rs("cpnSitewide")=3 then sSQL = "SELECT cpaAssignment FROM cpnassign WHERE cpaType=1 AND cpacpnID=" & rs("cpnID") rs2.Open sSQL,cnn,0,1 secids = "" addcomma = "" do while NOT rs2.EOF secids = secids & addcomma & rs2("cpaAssignment") addcomma = "," rs2.MoveNext loop rs2.Close if NOT (secids = "") then secids = getsectionids(secids, false) sSQL = "SELECT SUM(cartProdPrice*cartQuantity) AS totPrice,SUM(cartQuantity) AS totQuant FROM products INNER JOIN cart ON cart.cartProdID=products.pID WHERE cartCompleted=0 AND cartSessionID="&thesessionid&" AND products.pSection IN (" & secids & ")" rs2.Open sSQL,cnn,0,1 if IsNull(rs2("totPrice")) then totprice = 0 else totprice = rs2("totPrice") if IsNull(rs2("totQuant")) then totquant = 0 else totquant = rs2("totQuant") rs2.Close if mysqlserver=true then sSQL = "SELECT SUM(coPriceDiff*cartQuantity) AS optPrDiff FROM products INNER JOIN cart ON cart.cartProdID=products.pID LEFT OUTER JOIN cartoptions ON cart.cartID=cartoptions.coCartID WHERE cartCompleted=0 AND cartSessionID="&thesessionid&" AND products.pSection IN (" & secids & ")" else sSQL = "SELECT SUM(coPriceDiff*cartQuantity) AS optPrDiff FROM products INNER JOIN (cart LEFT OUTER JOIN cartoptions ON cart.cartID=cartoptions.coCartID) ON cart.cartProdID=products.pID WHERE cartCompleted=0 AND cartSessionID="&thesessionid&" AND products.pSection IN (" & secids & ")" end if rs2.Open sSQL,cnn,0,1 if NOT IsNull(rs2("optPrDiff")) then totprice = totprice + rs2("optPrDiff") rs2.Close end if else totquant = cdtotquant totprice = cdgndtot end if if totquant > 0 AND rs("cpnThreshold") <= totprice AND (rs("cpnThresholdMax") > totprice OR rs("cpnThresholdMax")=0) AND rs("cpnQuantity") <= totquant AND (rs("cpnQuantityMax") > totquant OR rs("cpnQuantityMax")=0) then if rs("cpnType")=1 then ' Flat Rate Discount thedisc = cDbl(rs("cpnDiscount")) * timesapply(totquant,totprice,rs("cpnQuantity"),rs("cpnThreshold"),rs("cpnQuantityRepeat"),rs("cpnThresholdRepeat")) if totprice < thedisc then thedisc = totprice elseif rs("cpnType")=2 then ' Percentage Discount thedisc = ((cDbl(rs("cpnDiscount")) * cDbl(totprice)) / 100.0) end if call addadiscount(rs, true, thedisc, subcpns, cdcpncode, statetaxhandback, countrytaxhandback, 3, 0) if perproducttaxrate AND cdgndtot > 0 then if IsArray(cdalldata) then for index=0 to UBOUND(cdalldata,2) if rs("cpnType")=1 then ' Flat Rate Discount applicdisc = thedisc / (cdtotquant / cdalldata(2,index)) elseif rs("cpnType")=2 then ' Percentage Discount applicdisc = thedisc / (cdgndtot / cdalldata(1,index)) end if if (cdalldata(5,index) AND 2)<>2 then countryTax = countryTax - ((applicdisc * cdalldata(6,index)) / 100.0) next end if end if end if rs.MoveNext loop rs.Close Session.LCID = saveLCID end if if statetaxfree < 0 then statetaxfree = 0 if countrytaxfree < 0 then countrytaxfree = 0 totaldiscounts = vsround(totaldiscounts, 2) end sub sub calculateshippingdiscounts(subcpns) freeshipamnt = 0 if NOT nodiscounts then Session.LCID = 1033 tdt = Date() sSQL = "SELECT cpnID,cpnName,cpnNumber,cpnDiscount,cpnThreshold,cpnCntry FROM coupons WHERE cpnType=0 AND cpnSitewide=1 AND cpnNumAvail>0 AND cpnThreshold<="&totalgoods&" AND (cpnThresholdMax>"&totalgoods&" OR cpnThresholdMax=0) AND cpnQuantity<="&totalquantity&" AND (cpnQuantityMax>"&totalquantity&" OR cpnQuantityMax=0) AND cpnEndDate>="&datedelim&VSUSDate(tdt)&datedelim&" AND (cpnIsCoupon=0 OR (cpnIsCoupon=1 AND cpnNumber='"&cpncode&"'))" rs.Open sSQL,cnn,0,1 do while NOT rs.EOF if freeshipapplies OR Int(rs("cpnCntry"))=0 then if cpncode<>"" AND LCase(Trim(rs("cpnNumber")))=LCase(cpncode) then gotcpncode=true if isstandardship then if InStr(cpnmessage,"
" & rs("cpnName") & "
")=0 then cpnmessage = cpnmessage & rs("cpnName") & "
" freeshipamnt = shipping if subcpns then Set theres = cnn.Execute("SELECT cpnID FROM coupons WHERE cpnNumAvail>0 AND cpnNumAvail<30000000 AND cpnID=" & rs("cpnID")) if NOT theres.EOF then Session("couponapply") = Session("couponapply") & "," & rs("cpnID") cnn.Execute("UPDATE coupons SET cpnNumAvail=cpnNumAvail-1 WHERE cpnNumAvail>0 AND cpnNumAvail<30000000 AND cpnID=" & rs("cpnID")) end if end if freeshippingapplied = true end if rs.MoveNext loop rs.Close Session.LCID = saveLCID end if if freeshipamnt > shipping then freeshipamnt = shipping end sub sub initshippingmethods() for i=0 to UBOUND(intShipping,2) intShipping(0,i)="" intShipping(1,i)="" intShipping(2,i)=0 intShipping(3,i)=false next if shipcountry <> origCountry then international = "Intl" willpickuptext = "" end if if shipType=2 OR shipType=5 then ' Weight / Price based shipping allzones="" zoneid=0 if splitUSZones AND shiphomecountry then sSQL = "SELECT pzID,pzMultiShipping,pzFSA,pzMethodName1,pzMethodName2,pzMethodName3,pzMethodName4,pzMethodName5 FROM states INNER JOIN postalzones ON postalzones.pzID=states.stateZone WHERE stateName='"&Replace(shipstate,"'","''")&"'" else sSQL = "SELECT pzID,pzMultiShipping,pzFSA,pzMethodName1,pzMethodName2,pzMethodName3,pzMethodName4,pzMethodName5 FROM countries INNER JOIN postalzones ON postalzones.pzID=countries.countryZone WHERE countryName='"&Replace(shipcountry,"'","''")&"'" end if rs.Open sSQL,cnn,0,1 if NOT (rs.EOF OR rs.BOF) then zoneid=rs("pzID") numshipoptions=rs("pzMultiShipping") pzFSA = rs("pzFSA") for index3=0 to numshipoptions intShipping(0,index3)=rs("pzMethodName"&(index3+1)) intShipping(2,index3)=0 intShipping(3,index3)=TRUE next else success=false errormsg = "Country / state shipping zone is unassigned." end if rs.Close sSQL = "SELECT zcWeight,zcRate,zcRate2,zcRate3,zcRate4,zcRate5 FROM zonecharges WHERE zcZone="&zoneid&" ORDER BY zcWeight" rs.Open sSQL,cnn,0,1 if NOT (rs.EOF OR rs.BOF) then allzones=rs.getrows rs.Close elseif shipType=3 OR shipType=4 OR shipType=6 then ' USPS / UPS / Canada Post if shipType=3 then sSQL = "SELECT uspsMethod,uspsFSA,uspsShowAs FROM uspsmethods WHERE uspsID<100 AND uspsUseMethod=1 AND uspsLocal=" if international="" then sSQL=sSQL&"1" else sSQL=sSQL&"0" elseif shipType=4 then shipinsuranceamt="" sSQL = "SELECT uspsMethod,uspsFSA,uspsShowAs FROM uspsmethods WHERE uspsID>100 AND uspsID<200 AND uspsUseMethod=1" else sSQL = "SELECT uspsMethod,uspsFSA,uspsShowAs FROM uspsmethods WHERE uspsID>200 AND uspsID<300 AND uspsUseMethod=1" end if rs.Open sSQL,cnn,0,1 if NOT rs.EOF then uspsmethods=rs.GetRows() else success=false errormsg = "Admin Error: " & xxNoMeth end if rs.Close end if if shipType=3 then sXML = "<"&international&"RateRequest USERID="""&uspsUser&""" PASSWORD="""&uspsPw&""">" elseif shipType=4 then sXML = ""&upsAccess&""&upsUser&""&upsPw&"" sXML = sXML & "Rating and Service1.0001" sXML = sXML & "Rateshop" if upspickuptype<>"" then sXML = sXML & ""&upspickuptype&"" sXML = sXML & "
" sXML = sXML & ""&origZip&"" sXML = sXML & ""&origCountryCode&"" sXML = sXML & "
" sXML = sXML & ""&destZip&"" sXML = sXML & ""&shipCountryCode&"" if Request.Form("commercialloc")<>"Y" then sXML = sXML & "" sXML = sXML & "
" 'sXML = sXML & "11" elseif shipType=6 then sXML = " " & _ " " & _ " en " & _ "" & _ " "&adminCanPostUser&" " & _ " "&origZip&" " & _ "" end if end sub sub addproducttoshipping(apsrs, prodindex) if packtogether then iTotItems = 1 else iTotItems = iTotItems + 1 shipThisProd=true if (apsrs(8,prodindex) AND 4)=4 then ' No Shipping on this product if NOT packtogether then iTotItems = iTotItems - Int(apsrs(4,prodindex)) shipThisProd=false end if if shipType=1 then ' Flat rate shipping if shipThisProd then shipping = shipping + apsrs(6,prodindex) + (apsrs(7,prodindex) * (apsrs(4,prodindex)-1)) elseif (shipType=2 OR shipType=5) AND request.form("shipping")="" then ' Weight / Price based shipping havematch=false for index3=0 to numshipoptions dHighest(index3)=0 next if IsArray(allzones) then if shipThisProd then somethingToShip=true if shipType=2 then tmpweight = cDbl(apsrs(5,prodindex)) else tmpweight = cDbl(apsrs(3,prodindex)) if packtogether then thePWeight = thePWeight + (cDbl(apsrs(4,prodindex))*tmpweight) thePQuantity = 1 else thePWeight = tmpweight thePQuantity = cDbl(apsrs(4,prodindex)) end if end if if ((NOT packtogether AND shipThisProd) OR (packtogether AND prodindex=UBOUND(apsrs,2))) AND somethingToShip then ' Only calculate pack together when we have the total for index2=0 to UBOUND(allzones,2) if allzones(0,index2)>=thePWeight then havematch=true for index3=0 to numshipoptions intShipping(2,index3)=intShipping(2,index3)+(cDbl(allzones(1+index3,index2))*thePQuantity) if cDbl(allzones(1+index3,index2))=-99999.0 then intShipping(3,index3)=FALSE next exit for end if dHighWeight=allzones(0,index2) for index3=0 to numshipoptions dHighest(index3)=allzones(1+index3,index2) next next if NOT havematch then for index3=0 to numshipoptions intShipping(2,index3) = intShipping(2,index3) + dHighest(index3) if dHighest(index3)=-99999.0 then intShipping(3,index3)=FALSE next if allzones(0,0) < 0 then dHighWeight = thePWeight - dHighWeight do while dHighWeight > 0 for index3=0 to numshipoptions intShipping(2,index3) = intShipping(2,index3) + (cDbl(allzones(1+index3,0))*thePQuantity) next dHighWeight = vsround(dHighWeight + allzones(0,0),4) loop end if end if for index3=numshipoptions to 0 step-1 if intShipping(3,index3)=FALSE then for index4=index3+1 to numshipoptions intShipping(0,index4-1)=intShipping(0,index4) intShipping(2,index4-1)=intShipping(2,index4) intShipping(3,index4-1)=intShipping(3,index4) next numshipoptions = numshipoptions-1 end if next end if end if elseif shipType=3 AND request.form("shipping")="" then ' USPS Shipping if packtogether then if shipThisProd then somethingToShip=true iWeight = iWeight + (cDbl(apsrs(5,prodindex)) * Int(apsrs(4,prodindex))) end if if prodindex = UBOUND(apsrs,2) AND somethingToShip then numpacks=1 if splitpackat<>"" then if iWeight > splitpackat then numpacks=-Int(-(iWeight/splitpackat)) end if if numpacks > 1 then if international <> "" then sXML = sXML & addInternational(rowcounter,splitpackat,numpacks-1,"Package",shipcountry) else sXML = sXML & addDomestic(rowcounter,"Parcel",origZip,destZip,splitpackat,numpacks-1,"None","REGULAR","True") end if iTotItems = iTotItems + 1 iWeight = iWeight - (splitpackat*(numpacks-1)) rowcounter = rowcounter + 1 end if if international <> "" then sXML = sXML & addInternational(rowcounter,iWeight,1,"Package",shipcountry) else sXML = sXML & addDomestic(rowcounter,"Parcel",origZip,destZip,iWeight,1,"None","REGULAR","True") end if rowcounter = rowcounter + 1 end if else if shipThisProd then somethingToShip=true iWeight=apsrs(5,prodindex) numpacks=1 if splitpackat<>"" then if iWeight > splitpackat then numpacks=-Int(-(iWeight/splitpackat)) end if if numpacks > 1 then if international <> "" then sXML = sXML & addInternational(rowcounter,splitpackat,apsrs(4,prodindex)*(numpacks-1),"Package",shipcountry) else sXML = sXML & addDomestic(rowcounter,"Parcel",origZip,destZip,splitpackat,apsrs(4,prodindex)*(numpacks-1),"None","REGULAR","True") end if iTotItems = iTotItems + 1 iWeight = iWeight - (splitpackat*(numpacks-1)) rowcounter = rowcounter + 1 end if if international <> "" then sXML = sXML & addInternational(rowcounter,iWeight,apsrs(4,prodindex),"Package",shipcountry) else sXML = sXML & addDomestic(rowcounter,"Parcel",origZip,destZip,iWeight,apsrs(4,prodindex),"None","REGULAR","True") end if rowcounter = rowcounter + 1 end if end if elseif (shipType=4 OR shipType=6) AND request.form("shipping")="" then ' UPS Shipping OR Canada Post Session.LCID = 1033 if upspacktype="" then upspacktype="02" if packtogether then if shipThisProd then somethingToShip=true iWeight = iWeight + (cDbl(apsrs(5,prodindex)) * Int(apsrs(4,prodindex))) end if if prodindex = UBOUND(apsrs,2) AND somethingToShip then numpacks=1 if splitpackat<>"" then if iWeight > splitpackat then numpacks=-Int(-(iWeight/splitpackat)) end if for index3 = 1 to numpacks if shipType=4 then sXML = sXML & addUPSInternational(iWeight / numpacks,adminUnits,upspacktype,shipCountryCode,totalgoods-shipfreegoods) else sXML = sXML & addCanadaPostPackage(iWeight / numpacks,adminUnits,upspacktype,shipCountryCode,totalgoods-shipfreegoods,"") end if next end if else if shipThisProd then somethingToShip=true iWeight=apsrs(5,prodindex) numpacks=1 if splitpackat<>"" then if iWeight > splitpackat then numpacks=-Int(-(iWeight/splitpackat)) end if for index2=0 to Int(apsrs(4,prodindex))-1 for index3 = 1 to numpacks if shipType=4 then sXML = sXML & addUPSInternational(iWeight / numpacks,adminUnits,upspacktype,shipCountryCode,apsrs(3,prodindex)) else sXML = sXML & addCanadaPostPackage(iWeight / numpacks,adminUnits,upspacktype,shipCountryCode,apsrs(3,prodindex),apsrs(11,prodindex)) end if next next end if end if Session.LCID = saveLCID end if end sub sub calculateshipping() if shipType=1 then isstandardship = true elseif (shipType=2 OR shipType=5) AND (somethingToShip OR willpickuptext<>"") then checkIntOptions = (request.form("shipping")="") if IsArray(allzones) AND numshipoptions>=0 then shipping = intShipping(2,0) shipMethod = intShipping(0,0) isstandardship = ((pzFSA AND 1) = 1) if numshipoptions = 0 AND willpickuptext="" then checkIntOptions = FALSE else if willpickuptext<>"" then if willpickupcost<>"" then shipping = willpickupcost shipMethod = willpickuptext else success = FALSE errormsg=xxNoMeth checkIntOptions = false end if end if elseif shipType=3 AND somethingToShip then checkIntOptions = (request.form("shipping")="") if request.form("shipping")="" then sXML = sXML & "" success = USPSCalculate(sXML,international,shipping, errormsg, intShipping) if left(errormsg, 30)="Warning - Bound Printed Matter" then success=true if success AND checkIntOptions then ' Look for a single valid shipping option totShipOptions = 0 for index=0 to UBOUND(intShipping,2) if iTotItems=intShipping(3,index) then for index2=0 to UBOUND(uspsmethods,2) if Trim(intShipping(0,index)) = Trim(uspsmethods(0,index2)) then if totShipOptions=0 then shipping = intShipping(2,index) shipMethod = Trim(uspsmethods(2,index2)) isstandardship = Int(uspsmethods(1,index2)) end if totShipOptions = totShipOptions + 1 end if next end if next if totShipOptions=1 then checkIntOptions=False elseif totShipOptions=0 AND willpickuptext="" then checkIntOptions=False success=False errormsg=xxNoMeth end if if willpickuptext<>"" then checkIntOptions = True elseif NOT success then errormsg = "USPS error: " & errormsg end if end if elseif shipType=4 AND somethingToShip then checkIntOptions = (request.form("shipping")="") if request.form("shipping")="" then sXML = sXML & "
" if Trim(upsUser)<>"" AND Trim(upsPw)<>"" then success = UPSCalculate(sXML,international,shipping, errormsg, intShipping) else success = false errormsg = "You must register with UPS by logging on to your online admin section and clicking the "Register with UPS" link before you can use the UPS OnLine® Shipping Rates and Services Selection" end if if success then totShipOptions = 0 for index=0 to UBOUND(intShipping,2) if intShipping(3,index)=true then totShipOptions = totShipOptions + 1 if index=0 then shipping = intShipping(2,index) shipMethod = intShipping(0,index) isstandardship = intShipping(4,index) end if end if next if totShipOptions=1 then checkIntOptions=False elseif totShipOptions=0 AND willpickuptext="" then checkIntOptions=False success=False errormsg=xxNoMeth end if if willpickuptext<>"" then checkIntOptions = True end if end if elseif shipType=6 AND somethingToShip then checkIntOptions = (request.form("shipping")="") if request.form("shipping")="" then sXML = sXML & " " if shipstate<>"" then sXML = sXML & " "&shipstate&" " else if shipCountryCode="US" OR shipCountryCode="CA" then if trim(Request.form("sname")) <> "" OR trim(Request.form("saddress")) <> "" then sXML = sXML & " "&request.form("sstate2")&" " else sXML = sXML & " "&request.form("state2")&" " end if else sXML = sXML & " " end if end if sXML = sXML & ""&shipCountryCode&""&destZip&" " & _ "" success = CanadaPostCalculate(sXML,international,shipping, errormsg, intShipping) if success then totShipOptions = 0 for index=0 to UBOUND(intShipping,2) if intShipping(3,index)=true then totShipOptions = totShipOptions + 1 next shipping = intShipping(2,0) shipMethod = intShipping(0,0) isstandardship = intShipping(4,0) if totShipOptions=1 then checkIntOptions=False elseif totShipOptions=0 AND willpickuptext="" then checkIntOptions=False success=False errormsg=xxNoMeth end if if willpickuptext<>"" then checkIntOptions = True end if end if end if end sub if stockManage<>0 then tdt = DateAdd("h",dateadjust-stockManage,now()) sSQL = "SELECT cartOrderID,cartID FROM cart WHERE (cartCompleted=0 AND cartOrderID=0 AND cartDateAdded<" & datedelim & VSUSDateTime(tdt) & datedelim & ")" if delAfter<>0 then tdt = Date()-delAfter sSQL = sSQL & " OR (cartCompleted=0 AND cartDateAdded<"&datedelim & VSUSDate(tdt) & datedelim & ")" end if rs.Open sSQL,cnn,0,1 if NOT rs.EOF then addcomma="" delstr="" delcart="" do while NOT rs.EOF delcart = delcart & addcomma & rs("cartOrderID") delstr = delstr & addcomma & rs("cartID") addcomma="," rs.MoveNext loop if delAfter<>0 then cnn.Execute("DELETE FROM orders WHERE ordID IN ("&delcart&")") cnn.Execute("DELETE FROM cart WHERE cartID IN ("&delstr&")") cnn.Execute("DELETE FROM cartoptions WHERE coCartID IN ("&delstr&")") end if rs.Close end if if request.querystring("token") <> "" then sSQL = "SELECT payProvData1,payProvData2,payProvDemo,payProvMethod FROM payprovider WHERE payProvEnabled=1 AND payProvID=18" rs.Open sSQL,cnn,0,1 username = rs("payProvData1") password = rs("payProvData2") demomode=(Int(rs("payProvDemo"))=1) ppmethod=Int(rs("payProvMethod")) rs.Close sXML = ppsoapheader(username, password) & _ " " & _ " " & _ " " & _ " 1.00" & _ " " & request.querystring("token") & "" & _ " " & _ " " & _ " " & _ "" if demomode then sandbox = ".sandbox" else sandbox = "" if callxmlfunction("https://api" & sandbox & ".paypal.com/2.0/", sXML, res, username, "WinHTTP.WinHTTPRequest.5.1", errormsg, FALSE) then countryid=0 success = FALSE ordPayProvider = "19" commercialloc = "" wantinsurance = "" ordComLoc = 0 ordEmail = "" token = request.querystring("token") if abs(addshippinginsurance)=1 then ordComLoc = ordComLoc + 2 set xmlDoc = Server.CreateObject("MSXML2.DOMDocument") xmlDoc.validateOnParse = False xmlDoc.loadXML (res) Set nodeList = xmlDoc.getElementsByTagName("SOAP-ENV:Body") Set n = nodeList.Item(0) for j = 0 to n.childNodes.length - 1 Set e = n.childNodes.Item(i) if e.nodeName = "GetExpressCheckoutDetailsResponse" then for k = 0 To e.childNodes.length - 1 Set t = e.childNodes.Item(k) if t.nodeName = "Ack" then if t.firstChild.nodeValue = "Success" then success=TRUE elseif t.nodeName = "GetExpressCheckoutDetailsResponseDetails" then set ff = t.childNodes for kk = 0 to ff.length - 1 set gg = ff.item(kk) if gg.nodeName = "PayerInfo" then set hh = gg.childNodes for ll = 0 to hh.length - 1 set ii = hh.item(ll) if ii.nodeName = "Payer" then if ii.hasChildNodes then ordEmail = ii.firstChild.nodeValue elseif ii.nodeName = "PayerID" then if ii.hasChildNodes then payerid = ii.firstChild.nodeValue elseif ii.nodeName = "PayerName" then set jj = ii.childNodes for mm = 0 to jj.length - 1 set jjj = jj.item(mm) if jjj.nodeName = "FirstName" then if jjj.hasChildNodes then ordName = jjj.firstChild.nodeValue & IIfVr(ordName<>"", " " & ordName, ordName) elseif jjj.nodeName = "LastName" then if jjj.hasChildNodes then ordName = IIfVr(ordName<>"", ordName&" ",ordName) & jjj.firstChild.nodeValue end if next elseif ii.nodeName = "Address" then set jj = ii.childNodes for mm = 0 to jj.length - 1 set jjj = jj.item(mm) if jjj.nodeName = "Street1" then if jjj.hasChildNodes then ordAddress = jjj.firstChild.nodeValue elseif jjj.nodeName = "Street2" then if jjj.hasChildNodes then ordAddress2 = jjj.firstChild.nodeValue elseif jjj.nodeName = "CityName" then if jjj.hasChildNodes then ordCity = jjj.firstChild.nodeValue elseif jjj.nodeName = "StateOrProvince" then if jjj.hasChildNodes then ordState = jjj.firstChild.nodeValue elseif jjj.nodeName = "Country" then if jjj.hasChildNodes then sSQL = "SELECT countryName,countryID FROM countries WHERE countryCode='" & replace(jjj.firstChild.nodeValue, "'", "''") & "'" rs.Open sSQL,cnn,0,1 ordCountry = rs("countryName") countryid = rs("countryID") rs.Close end if elseif jjj.nodeName = "PostalCode" then if jjj.hasChildNodes then ordZip = jjj.firstChild.nodeValue end if next end if next elseif gg.nodeName = "Custom" then customarr = split(gg.firstChild.nodeValue, ":") thesessionid = customarr(0) ordAffiliate = customarr(1) elseif gg.nodeName = "ContactPhone" then if gg.hasChildNodes then ordPhone = gg.firstChild.nodeValue end if next elseif t.nodeName = "Errors" then set ff = t.childNodes for kk = 0 to ff.length - 1 set gg = ff.item(kk) if gg.nodeName = "ShortMessage" then errormsg = gg.firstChild.nodeValue & "
" & errormsg elseif gg.nodeName = "LongMessage" then errormsg= errormsg & gg.firstChild.nodeValue elseif gg.nodeName = "ErrorCode" then errcode = gg.firstChild.nodeValue end if next end if next end if next if ordEmail="" then ppexpresscancel=TRUE elseif success then paypalexpress=TRUE if countryid=1 OR countryid=2 then sSQL = "SELECT stateName FROM states WHERE stateAbbrev='" & replace(ordState,"'","''") & "'" rs.Open sSQL,cnn,0,1 if NOT rs.EOF then ordState = rs("stateName") rs.Close end if else response.write "PayPal Payment Pro error: " & errormsg end if else response.write "PayPal Payment Pro error: " & errormsg end if elseif request.form("mode")="paypalexpress1" then success = FALSE sSQL = "SELECT payProvData1,payProvData2,payProvDemo,payProvMethod FROM payprovider WHERE payProvEnabled=1 AND payProvID=18" rs.Open sSQL,cnn,0,1 username = rs("payProvData1") password = rs("payProvData2") demomode=(Int(rs("payProvDemo"))=1) ppmethod=Int(rs("payProvMethod")) rs.Close if demomode then sandbox = ".sandbox" else sandbox = "" if pathtossl<>"" then if Right(pathtossl,1) <> "/" then storeurl = pathtossl & "/" else storeurl = pathtossl end if sXML = ppsoapheader(username, password) & _ " " & _ " " & _ " " & _ " 1.00" & _ " " & _ " " & request.form("estimate") & "" & _ " " & storeurl & "cart.asp" & _ " " & storeurl & "cart.asp" & _ " " & thesessionid & ":" & request.form("PARTNER") & "" & _ " " & IIfVr(ppmethod=1, "Authorization", "Sale") & "" & _ " " & _ " " & _ " " & _ " " & _ "" if callxmlfunction("https://api" & sandbox & ".paypal.com/2.0/", sXML, res, username, "WinHTTP.WinHTTPRequest.5.1", errormsg, FALSE) then set xmlDoc = Server.CreateObject("MSXML2.DOMDocument") xmlDoc.validateOnParse = False xmlDoc.loadXML (res) Set nodeList = xmlDoc.getElementsByTagName("SOAP-ENV:Body") Set n = nodeList.Item(0) for j = 0 to n.childNodes.length - 1 Set e = n.childNodes.Item(i) if e.nodeName = "SetExpressCheckoutResponse" then for k = 0 To e.childNodes.length - 1 Set t = e.childNodes.Item(k) if t.nodeName = "Ack" then if t.firstChild.nodeValue = "Success" then success=TRUE elseif t.nodeName = "Token" then token = t.firstChild.nodeValue elseif t.nodeName = "Errors" then set ff = t.childNodes for kk = 0 to ff.length - 1 set gg = ff.item(kk) if gg.nodeName = "ShortMessage" then errormsg = gg.firstChild.nodeValue & "
" & errormsg elseif gg.nodeName = "LongMessage" then errormsg= errormsg & gg.firstChild.nodeValue elseif gg.nodeName = "ErrorCode" then errcode = gg.firstChild.nodeValue end if next end if next end if next if success then response.redirect "https://www" & sandbox & ".paypal.com/webscr?cmd=_express-checkout&token=" & token response.write "

" & xxAutFo & "

" response.write "

" & xxForAut & " " & xxClkHere & "

" else response.write "PayPal Payment Pro error: " & errormsg end if else response.write "PayPal Payment Pro error: " & errormsg end if elseif request.form("mode")="update" then if estimateshipping=TRUE then session("xsshipping") = "" if NOT IsEmpty(session("discounts")) then session("discounts")="" cnn.Execute("UPDATE orders SET ordTotal=0,ordShipping=0,ordStateTax=0,ordCountryTax=0,ordHSTTax=0,ordHandling=0,ordDiscount=0,ordDiscountText='' WHERE ordSessionID="&Session.SessionID&" AND ordAuthNumber=''") for each objItem In Request.Form thequant = Trim(Request.form(objItem)) if NOT IsNumeric(thequant) then thequant=0 else thequant=abs(int(thequant)) if Left(objItem,5)="quant" AND thequant<>"" then thecartid = int(Right(objItem, Len(objItem)-5)) if thequant=0 then sSQL="DELETE FROM cartoptions WHERE coCartID="&thecartid cnn.Execute(sSQL) sSQL="DELETE FROM cart WHERE cartID="&thecartid cnn.Execute(sSQL) else totQuant = 0 pPrice = 0 pID = "" sSQL="SELECT cartQuantity,pInStock,pID,pSell,"&WSP&"pPrice FROM cart INNER JOIN products ON cart.cartProdId=products.pID WHERE cartID="&thecartid rs.Open sSQL,cnn,0,1 if NOT rs.EOF then pID = rs("pID") pInStock = Int(rs("pInStock")) pSell = Int(rs("pSell")) pPrice = rs("pPrice") cartQuantity = Int(rs("cartQuantity")) rs.Close sSQL = "SELECT SUM(cartQuantity) AS cartQuant FROM cart WHERE cartCompleted=0 AND cartProdID='"&Trim(pID)&"'" rs.Open sSQL,cnn,0,1 if NOT rs.EOF then if NOT IsNull(rs("cartQuant")) then totQuant = Int(rs("cartQuant")) end if end if rs.Close if pID<>"" then if stockManage<>0 then quantavailable = thequant if (pSell AND 2) = 2 then hasalloptions=true sSQL = "SELECT coID,optStock,cartQuantity,coOptID FROM cart INNER JOIN (cartoptions INNER JOIN (options INNER JOIN optiongroup ON options.optGroup=optiongroup.optGrpID) ON cartoptions.coOptID=options.optID) ON cart.cartID=cartoptions.coCartID WHERE (optType=2 OR optType=-2) AND cartID="&thecartid rs.Open sSQL,cnn,0,1 if NOT rs.EOF then do while NOT rs.EOF pInStock = Int(rs("optStock")) totQuant = 0 cartQuantity = Int(rs("cartQuantity")) sSQL = "SELECT SUM(cartQuantity) AS cartQuant FROM cart INNER JOIN cartoptions ON cart.cartID=cartoptions.coCartID WHERE cartCompleted=0 AND coOptID="&rs("coOptID") rs2.Open sSQL,cnn,0,1 if NOT rs2.EOF then if NOT IsNull(rs2("cartQuant")) then totQuant = Int(rs2("cartQuant")) end if rs2.Close if Int(pInStock - totQuant + cartQuantity) < quantavailable then quantavailable = (pInStock - totQuant + cartQuantity) if (pInStock - totQuant + cartQuantity - thequant) < 0 then hasalloptions=false rs.MoveNext loop sSQL="UPDATE cart SET cartQuantity="&quantavailable&" WHERE cartID="&thecartid cnn.Execute(sSQL) if NOT hasalloptions then isInStock = false end if rs.Close else if (pInStock - totQuant + cartQuantity - thequant) < 0 then quantavailable = (pInStock - totQuant + cartQuantity) if quantavailable < 0 then quantavailable=0 isInStock = false end if sSQL="UPDATE cart SET cartQuantity="&quantavailable&" WHERE cartID="&thecartid cnn.Execute(sSQL) end if else sSQL="UPDATE cart SET cartQuantity="&thequant&" WHERE cartID="&thecartid cnn.Execute(sSQL) end if call checkpricebreaks(pID,pPrice) end if end if elseif Left(objItem,5)="delet" then sSQL="DELETE FROM cart WHERE cartID="&int(Right(objItem, Len(objItem)-5)) cnn.Execute(sSQL) sSQL="DELETE FROM cartoptions WHERE coCartID="&int(Right(objItem, Len(objItem)-5)) cnn.Execute(sSQL) end if next end if if request.form("mode")="add" then if estimateshipping=TRUE then session("xsshipping") = "" if NOT IsEmpty(session("discounts")) then session("discounts")="" cnn.Execute("UPDATE orders SET ordTotal=0,ordShipping=0,ordStateTax=0,ordCountryTax=0,ordHSTTax=0,ordHandling=0,ordDiscount=0,ordDiscountText='' WHERE ordSessionID="&Session.SessionID&" AND ordAuthNumber=''") Session.LCID = 1033 if Trim(Request.Form("frompage"))<>"" then Session("frompage")=Request.Form("frompage") else Session("frompage")="" if Request.Form("quant")="" OR NOT IsNumeric(Request.Form("quant")) then quantity=1 else quantity=abs(int(trim(Request.Form("quant")))) end if for jj = 1 to Request.Form.Count for each objElem in Request.Form if Request.Form(objElem) is Request.Form(jj) then objForm = objElem next if Left(objForm,4)="optn" then sSQL="SELECT optRegExp FROM options WHERE optID="&replace(Request.Form(objForm),"'","") rs2.Open sSQL,cnn,0,1 theexp = trim(rs2("optRegExp")&"") if theexp<>"" AND Left(theexp,1)<>"!" then theexp = replace(theexp, "%s", theid) if InStr(theexp, " ") > 0 then ' Search and replace exparr = split(theexp, " ", 2) theid = replace(theid, exparr(0), exparr(1), 1, 1) else theid = theexp end if end if rs2.Close end if next bExists=False sSQL = "SELECT cartID FROM cart WHERE cartCompleted=0 AND cartSessionID="&Session.SessionID&" AND cartProdID='"&theid&"'" rs.Open sSQL,cnn,0,1 do while (NOT rs.EOF) AND (NOT bExists) bExists=True cartID=rs("cartID") for each objForm in Request.Form ' We have the product. Check we have all the same options if Left(objForm,4)="optn" then if Trim(Request.Form("v"&objForm))<>"" then sSQL="SELECT coID FROM cartoptions WHERE coCartID="&cartID&" AND coOptID="&replace(Request.Form(objForm),"'","")&" AND coCartOption='"&replace(trim(Request.Form("v"&objForm)),"'","''")&"'" rs2.Open sSQL,cnn,0,1 if rs2.EOF then bExists=false rs2.Close else sSQL="SELECT coID FROM cartoptions WHERE coCartID="&cartID&" AND coOptID="&replace(Request.Form(objForm),"'","") rs2.Open sSQL,cnn,0,1 if rs2.EOF then bExists=false rs2.Close end if end if if NOT bExists then exit for next rs.MoveNext loop rs.Close sSQL = "SELECT "&getlangid("pName",1)&","&WSP&"pPrice,pInStock,pWeight,pSell FROM products WHERE pID='"&theid&"'" rs.Open sSQL,cnn,0,1 if NOT rs.EOF then alldata=rs.getrows else redim alldata(1,1) alldata(0,0)=theid stockManage=0 isInStock=false tempOutOfStock=false end if rs.Close if stockManage<>0 then if ((alldata(4,0) AND 2)=2) then isInStock = True for each objForm in Request.Form if Left(objForm,4)="optn" then sSQL="SELECT optStock FROM options INNER JOIN optiongroup ON options.optGroup=optiongroup.optGrpID WHERE (optType=2 OR optType=-2) AND optID="&replace(Request.Form(objForm),"'","") rs.Open sSQL,cnn,0,1 if NOT rs.EOF then isInStock = (isInStock AND (rs("optStock") >= quantity)) end if rs.Close end if next if isInStock then ' Check cart bestDate = DateAdd("m",2,now()) for each objForm in Request.Form totQuant = 0 stockQuant = 0 if Left(objForm,4)="optn" then sSQL = "SELECT cartQuantity,cartDateAdded,cartOrderID,optStock FROM cart INNER JOIN (cartoptions INNER JOIN (options INNER JOIN optiongroup ON options.optGroup=optiongroup.optGrpID) ON cartoptions.coOptID=options.optID) ON cart.cartID=cartoptions.coCartID WHERE (optType=2 OR optType=-2) AND cartCompleted=0 AND coOptID="&replace(Request.Form(objForm),"'","") rs.Open sSQL,cnn,0,1 if NOT rs.EOF then stockQuant = rs("optStock") do while NOT rs.EOF totQuant=totQuant+rs("cartQuantity") if Int(rs("cartOrderID"))=0 AND rs("cartDateAdded") < bestDate then bestDate = rs("cartDateAdded") rs.MoveNext loop if (totQuant+quantity) > stockQuant then isInStock=false tempOutOfStock=true end if end if rs.Close end if next end if else isInStock = ((alldata(2,0)-quantity) >= 0) if isInStock then ' Check cart totQuant = 0 bestDate = DateAdd("m",2,now()) sSQL = "SELECT cartQuantity,cartDateAdded,cartOrderID FROM cart WHERE cartCompleted=0 AND cartProdID='"&theid&"'" rs.Open sSQL,cnn,0,1 do while NOT rs.EOF totQuant=totQuant+rs("cartQuantity") if Int(rs("cartOrderID"))=0 AND rs("cartDateAdded") < bestDate then bestDate = rs("cartDateAdded") rs.MoveNext loop rs.Close if (alldata(2,0)-(totQuant+quantity)) < 0 then isInStock=false tempOutOfStock=true end if end if end if end if if isInStock then if bExists then sSQL = "UPDATE cart SET cartQuantity=cartQuantity+"&quantity&" WHERE cartID="&cartID cnn.Execute(sSQL) else rs.Open "cart",cnn,1,3,&H0002 rs.AddNew rs.Fields("cartSessionID") = Session.SessionID rs.Fields("cartProdID") = theid rs.Fields("cartQuantity") = quantity rs.Fields("cartCompleted") = 0 rs.Fields("cartProdName") = alldata(0,0) rs.Fields("cartProdPrice") = alldata(1,0) rs.Fields("cartDateAdded") = DateAdd("h",dateadjust,Now()) rs.Update if mysqlserver=true then rs.Close rs.Open "SELECT LAST_INSERT_ID() AS lstIns",cnn,0,1 cartID = rs("lstIns") else cartID = rs.Fields("cartID") end if rs.Close for jj = 1 to Request.Form.Count for each objElem in Request.Form if Request.Form(objElem) is Request.Form(jj) then objForm = objElem next if Left(objForm,4)="optn" then if Trim(Request.Form("v"&objForm))="" then sSQL="SELECT optID,"&getlangid("optGrpName",16)&","&getlangid("optName",32)&","&OWSP&"optPriceDiff,optWeightDiff,optType,optFlags FROM options INNER JOIN optiongroup ON options.optGroup=optiongroup.optGrpID WHERE optID="&Replace(Request.Form(objForm),"'","") rs.Open sSQL,cnn,0,1 if abs(rs("optType"))<> 3 then sSQL = "INSERT INTO cartoptions (coCartID,coOptID,coOptGroup,coCartOption,coPriceDiff,coWeightDiff) VALUES ("&cartID&","&rs("optID")&",'"&Replace(rs(getlangid("optGrpName",16))&"","'","''")&"','"&Replace(rs(getlangid("optName",32))&"","'","''")&"'," if (rs("optFlags") AND 1) = 0 then sSQL = sSQL & rs("optPriceDiff") & "," else sSQL = sSQL & vsround((rs("optPriceDiff")*alldata(1,0))/100.0, 2) & "," if (rs("optFlags") AND 2) = 0 then sSQL = sSQL & rs("optWeightDiff") & ")" else sSQL = sSQL & multShipWeight(alldata(3,0),rs("optWeightDiff")) & ")" else sSQL = "INSERT INTO cartoptions (coCartID,coOptID,coOptGroup,coCartOption,coPriceDiff,coWeightDiff) VALUES ("&cartID&","&rs("optID")&",'"&Replace(rs(getlangid("optGrpName",16))&"","'","''")&"','',0,0)" end if rs.Close cnn.Execute(sSQL) else sSQL="SELECT optID,"&getlangid("optGrpName",16)&","&getlangid("optName",32)&" FROM options INNER JOIN optiongroup ON options.optGroup=optiongroup.optGrpID WHERE optID="&replace(Request.Form(objForm),"'","") rs.Open sSQL,cnn,0,1 sSQL = "INSERT INTO cartoptions (coCartID,coOptID,coOptGroup,coCartOption,coPriceDiff,coWeightDiff) VALUES ("&cartID&","&rs("optID")&",'"&Replace(rs(getlangid("optGrpName",16))&"","'","''")&"','"&replace(trim(Request.Form("v"&objForm)),"'","''")&"',0,0)" cnn.Execute(sSQL) rs.Close end if end if next end if call checkpricebreaks(theid, alldata(1,0)) if Trim(Request.Form("frompage"))<>"" AND actionaftercart=3 then response.write "" else response.write ""","?PARTNER="&request.form("partner"),"")&""">" end if %>

 

<% response.write "

" & quantity & " " & alldata(0,0) & " "&xxAddOrd & "

" response.write "

" & xxPlsWait & " "" AND actionaftercart=3 then response.write Trim(Request.Form("frompage")) else response.write "cart.asp" response.write """>" & xxClkHere & ".

" %>

 

 

<% else %>

 

<% response.write "

" & xxSrryItm & " " & alldata(0,0)&" " & xxIsCntly if tempOutOfStock then response.write " " & xxTemprly response.write " " & xxOutStck & "

" if tempOutOfStock then response.write "

" & xxNotChOu & " " totMins = DateDiff("n",DateAdd("h",dateadjust,Now()),DateAdd("h",stockManage,bestDate))+1 if totMins > 300 then response.write xxShrtWhl else if totMins >= 60 then response.write Int(totMins / 60) & " hour" if totMins >= 120 then response.write "s" totMins = totMins - (Int(totMins / 60) * 60) if totMins > 0 then response.write " " & totMins & " minute" if totMins > 1 then response.write "s" end if response.write xxChkBack & "

" end if %>

<%=xxPlease%> <%=xxClkHere%> <%=xxToRetrn%>

 

 

<% end if elseif Request.Form("mode")="checkout" OR ppexpresscancel then Dim ordName,ordAddress,ordAddress2,ordCity,ordState,ordZip,ordCountry,ordEmail,ordPhone,ordShipName,ordShipAddress,ordShipAddress2,ordShipCity,ordShipState,ordShipZip,ordShipCountry,ordAddInfo Dim remember,allstates,havestate,allcountries allstates="" allcountries="" remember=False if request.form("checktmplogin")="1" then sSQL = "SELECT tmploginname FROM tmplogin WHERE tmploginid=" & replace(trim(request.form("sessionid")),"'","") rs.Open sSQL,cnn,0,1 if NOT rs.EOF then Session("clientUser")=rs("tmploginname") rs.Close cnn.Execute("DELETE FROM tmplogin WHERE tmploginid=" & replace(trim(request.form("sessionid")),"'","")) sSQL = "SELECT clientActions,clientLoginLevel FROM clientlogin WHERE clientUser='"&replace(trim(session("clientUser")),"'","")&"'" rs.Open sSQL,cnn,0,1 if NOT rs.EOF then Session("clientActions")=rs("clientActions") Session("clientLoginLevel")=rs("clientLoginLevel") end if end if rs.Close end if if request.cookies("id1")<>"" AND request.cookies("id2")<>"" AND IsNumeric(request.cookies("id1")) AND IsNumeric(request.cookies("id2")) then sSQL = "SELECT ordName,ordAddress,ordAddress2,ordCity,ordState,ordZip,ordCountry,ordEmail,ordPhone,ordShipName,ordShipAddress,ordShipAddress2,ordShipCity,ordShipState,ordShipZip,ordShipCountry,ordPayProvider,ordComLoc,ordExtra1,ordExtra2,ordAddInfo FROM orders WHERE ordID="&request.cookies("id1")&" AND ordSessionID="&request.cookies("id2") rs.Open sSQL,cnn,0,1 if NOT rs.EOF then ordName = rs("ordName") ordAddress = rs("ordAddress") ordAddress2 = rs("ordAddress2") ordCity = rs("ordCity") ordState = rs("ordState") ordZip = rs("ordZip") ordCountry = rs("ordCountry") ordEmail = rs("ordEmail") ordPhone = rs("ordPhone") ordShipName = rs("ordShipName") ordShipAddress = rs("ordShipAddress") ordShipAddress2 = rs("ordShipAddress2") ordShipCity = rs("ordShipCity") ordShipState = rs("ordShipState") ordShipZip = rs("ordShipZip") ordShipCountry = rs("ordShipCountry") ordPayProvider = rs("ordPayProvider") ordComLoc = rs("ordComLoc") ordExtra1 = rs("ordExtra1") ordExtra2 = rs("ordExtra2") ordAddInfo = rs("ordAddInfo") remember=True end if rs.Close end if if NOT remember then ordState = session("state") ordCountry = session("country") ordZip = session("zip") end if sSQL = "SELECT stateName FROM states WHERE stateEnabled=1 ORDER BY stateName" rs.Open sSQL,cnn,0,1 if NOT rs.EOF then allstates=rs.getrows rs.Close numhomecountries = 0 nonhomecountries = 0 sSQL = "SELECT countryName,countryOrder,"&getlangid("countryName",8)&" AS cnameshow FROM countries WHERE countryEnabled=1 ORDER BY countryOrder DESC,"&getlangid("countryName",8) rs.Open sSQL,cnn,0,1 if NOT rs.EOF then allcountries=rs.getrows rs.Close if IsArray(allcountries) then for rowcounter=0 to UBOUND(allcountries,2) if allcountries(1,rowcounter)=2 then numhomecountries = numhomecountries + 1 else nonhomecountries = nonhomecountries + 1 next end if %>
" /> <% if Trim(extraorderfield1)<>"" then %> <% end if %> <% if useaddressline2=TRUE then %> <% end if %> <% if IsArray(allstates) OR nonhomecountries<>0 then %> <% if IsArray(allstates) then %> <% end if if nonhomecountries=0 then response.write "" else %> <% end if if NOT IsArray(allstates) then response.write "" %> <% end if %> <% if Trim(extraorderfield2)<>"" then %> <% end if %> <% if commercialloc=TRUE OR shipType=4 then %> <% end if if abs(addshippinginsurance)=2 then %> <% end if if noshipaddress<>true then %> <% if useaddressline2=TRUE then %> <% end if %> <% if IsArray(allstates) OR nonhomecountries<>0 then %> <% if IsArray(allstates) then %> <% end if if nonhomecountries=0 then response.write "" else %> <% end if if NOT IsArray(allstates) then response.write "" %> <% end if %> <% end if ' noshipaddress %> <% if termsandconditions=TRUE then %> <% end if %> <% if nogiftcertificate<>true then %> <% end if if Session("clientLoginLevel")<>"" then minloglevel=Session("clientLoginLevel") else minloglevel=0 sSQL = "SELECT payProvID,"&getlangid("PayProvShow",128)&" FROM payprovider WHERE payProvEnabled=1 AND payProvLevel<="&minloglevel&" ORDER BY payProvOrder" rs.Open sSQL,cnn,0,1 alldata="" if not rs.EOF then alldata=rs.getrows rs.Close if NOT IsArray(alldata) then %> <% elseif UBOUND(alldata,2)=0 then %> <% else %> <% end if %>
<%=xxCstDtl%>
<% if extraorderfield1required=true then response.write "*" response.write extraorderfield1 %>: <% if extraorderfield1html<>"" then response.write extraorderfield1html else response.write ""%>
*<%=xxName%>: *<%=xxEmail%>:
*<%=xxAddress%>: >
<%=xxAddress2%>: *<%=xxCity%>:
<%=xxState%>:  <%=xxNonState%>:  
*<%=xxCountry%>: *<%=xxZip%>:
*<%=xxPhone%>: ><% if extraorderfield2required=true then response.write "*" response.write extraorderfield2 %>: <% if extraorderfield2html<>"" then response.write extraorderfield2html else response.write ""%>
/> <%=xxComLoc%>
/> <%=xxWantIns%>
<%=xxShpDiff%>
<%=xxName%>:
<%=xxAddress%>: >
<%=xxAddress2%>: <%=xxCity%>:
<%=xxState%>:  <%=xxNonState%>:  
<%=xxCountry%>: <%=xxZip%>:
<%=xxAddInf%>.
<%=xxTermsCo%>
/> <%=xxRemMe%>
<%=xxOpCook%>
<%=xxGifNum%>:
<%=xxGifEnt%>
<%=xxNoPay%>
<%=xxClkCmp%>

<%=xxPlsChz%>

<% elseif Request.Form("mode")="go" OR paypalexpress then %> <% if NOT paypalexpress then thesessionid = trim(request.form("sessionid")) ordName = trim(request.form("name")) ordAddress = trim(request.form("address")) ordAddress2 = trim(request.form("address2")) ordCity = trim(request.form("city")) ordState = trim(request.form("state2")) if trim(request.form("state")) <> "" then ordState = trim(request.form("state")) ordZip = trim(request.form("zip")) ordCountry = trim(request.form("country")) ordEmail = trim(request.form("email")) ordPhone = trim(request.form("phone")) ordShipName = trim(request.form("sname")) ordShipAddress = trim(request.form("saddress")) ordShipAddress2 = trim(request.form("saddress2")) ordShipCity = trim(request.form("scity")) ordShipState = trim(request.form("sstate2")) if trim(request.form("sstate")) <> "" then ordShipState = trim(request.form("sstate")) ordShipZip = trim(request.form("szip")) ordShipCountry = trim(request.form("scountry")) commercialloc = trim(request.form("commercialloc")) wantinsurance = trim(request.form("wantinsurance")) if commercialloc="Y" then ordComLoc = 1 if wantinsurance="Y" OR abs(addshippinginsurance)=1 then ordComLoc = ordComLoc + 2 ordAffiliate = trim(request.form("PARTNER")) ordExtra1 = trim(request.form("ordextra1")) ordExtra2 = trim(request.form("ordextra2")) ordAddInfo = trim(request.form("ordAddInfo")) end if if ordShipAddress<>"" then shipcountry = ordShipCountry shipstate = ordShipState destZip = ordShipZip else shipcountry = ordCountry shipstate = ordState destZip = ordZip end if sSQL = "SELECT countryID,countryCode,countryOrder FROM countries WHERE countryName='"&replace(ordCountry,"'","''")&"'" rs.Open sSQL,cnn,0,1 countryID = rs("countryID") countryCode = rs("countryCode") homecountry = (rs("countryOrder")=2) rs.Close if NOT homecountry then perproducttaxrate=FALSE sSQL = "SELECT countryID,countryTax,countryCode,countryFreeShip,countryOrder FROM countries WHERE countryName='"&replace(shipcountry,"'","''")&"'" rs.Open sSQL,cnn,0,1 countryTaxRate = rs("countryTax") shipCountryID = rs("countryID") shipCountryCode = rs("countryCode") freeshipapplies = (rs("countryFreeShip")=1) shiphomecountry = (rs("countryOrder")=2) rs.Close if homecountry then sSQL = "SELECT stateAbbrev FROM states WHERE stateName='"&replace(ordState,"'","''")&"'" rs.Open sSQL,cnn,0,1 if NOT rs.EOF then stateAbbrev=rs("stateAbbrev") rs.Close end if if shiphomecountry then sSQL = "SELECT stateTax,stateAbbrev,stateFreeShip FROM states WHERE stateName='"&replace(shipstate,"'","''")&"'" rs.Open sSQL,cnn,0,1 if NOT rs.EOF then stateTaxRate=rs("stateTax") shipStateAbbrev=rs("stateAbbrev") freeshipapplies=(freeshipapplies AND (rs("stateFreeShip")=1)) end if rs.Close end if initshippingmethods() if mysqlserver=true then sSQL = "SELECT cartID,cartProdID,cartProdName,cartProdPrice,cartQuantity,pWeight,pShipping,pShipping2,pExemptions,pSection,topSection,pDims,pTax FROM cart LEFT JOIN products ON cart.cartProdID=products.pId LEFT OUTER JOIN sections ON products.pSection=sections.sectionID WHERE cartCompleted=0 AND cartSessionID="&thesessionid else sSQL = "SELECT cartID,cartProdID,cartProdName,cartProdPrice,cartQuantity,pWeight,pShipping,pShipping2,pExemptions,pSection,topSection,pDims,pTax FROM cart INNER JOIN (products LEFT OUTER JOIN sections ON products.pSection=sections.sectionID) ON cart.cartProdID=products.pID WHERE cartCompleted=0 AND cartSessionID="&thesessionid end if rs.Open sSQL,cnn,0,1 if NOT (rs.EOF OR rs.BOF) then alldata=rs.getrows rs.Close if success AND IsArray(alldata) then rowcounter = 0 For index=0 to UBOUND(alldata,2) sSQL = "SELECT SUM(coPriceDiff) AS coPrDff FROM cartoptions WHERE coCartID="&alldata(0,index) rs.Open sSQL,cnn,0,1 if NOT rs.EOF then if NOT IsNull(rs("coPrDff")) then alldata(3,index)=cDbl(alldata(3,index))+cDbl(rs("coPrDff")) end if rs.Close sSQL = "SELECT SUM(coWeightDiff) AS coWghtDff FROM cartoptions WHERE coCartID="&alldata(0,index) rs.Open sSQL,cnn,0,1 if NOT rs.EOF then if NOT IsNull(rs("coWghtDff")) then alldata(5,index)=cDbl(alldata(5,index))+cDbl(rs("coWghtDff")) end if rs.Close runTot=(alldata(3,index)*Int(alldata(4,index))) totalquantity = totalquantity + alldata(4,index) totalgoods=totalgoods+runTot thistopcat=0 if Trim(Session("clientUser"))<>"" then alldata(8,index) = (alldata(8,index) OR Session("clientActions")) if (shipType=2 OR shipType=3 OR shipType=4 OR shipType=6) AND cDbl(alldata(5,index))<=0.0 then alldata(8,index) = (alldata(8,index) OR 4) if (alldata(8,index) AND 1)=1 then statetaxfree = statetaxfree + runTot if perproducttaxrate=TRUE then if isnull(alldata(12,index)) then alldata(12,index)=countryTaxRate if (alldata(8,index) AND 2)<>2 then countryTax = countryTax + ((alldata(12,index) * runTot) / 100.0) else if (alldata(8,index) AND 2)=2 then countrytaxfree = countrytaxfree + runTot end if if (alldata(8,index) AND 4)=4 then shipfreegoods = shipfreegoods + runTot call addproducttoshipping(alldata, index) Next call calculatediscounts(vsround(totalgoods,2), true, cpncode) if request.form("shipping")<>"" then shipArr = split(request.form("shipping"),"|") shipping = cDbl(shipArr(0)) isstandardship = Int(shipArr(1))=1 shipMethod = shipArr(2) else calculateshipping() end if if Trim(request.form("shipping"))="" AND alternaterates AND somethingToShip then checkIntOptions = True if IsNumeric(shipinsuranceamt) AND Trim(request.form("shipping"))="" AND somethingToShip then if (wantinsurance="Y" AND addshippinginsurance=2) OR addshippinginsurance=1 then for index3=0 to UBOUND(intShipping,2) intShipping(2,index3) = intShipping(2,index3) + ((cDbl(totalgoods)*cDbl(shipinsuranceamt))/100.0) next shipping = shipping + ((cDbl(totalgoods)*cDbl(shipinsuranceamt))/100.0) elseif (wantinsurance="Y" AND addshippinginsurance=-2) OR addshippinginsurance=-1 then for index3=0 to UBOUND(intShipping,2) intShipping(2,index3) = intShipping(2,index3) + shipinsuranceamt next shipping = shipping + shipinsuranceamt end if end if if taxShipping=1 AND Trim(request.form("shipping"))="" then for index3=0 to UBOUND(intShipping,2) intShipping(2,index3) = intShipping(2,index3) + (cDbl(intShipping(2,index3))*(cDbl(stateTaxRate)+cDbl(countryTaxRate)))/100.0 next shipping = shipping + (cDbl(shipping)*(cDbl(stateTaxRate)+cDbl(countryTaxRate)))/100.0 end if if taxHandling=1 then handling = handling + (cDbl(handling)*(cDbl(stateTaxRate)+cDbl(countryTaxRate)))/100.0 end if if NOT checkIntOptions then call calculateshippingdiscounts(true) if Session("clientUser")<>"" AND Session("clientActions")<>0 then cpnmessage = cpnmessage & xxLIDis & Session("clientUser") & "
" cpnmessage = Right(cpnmessage,Len(cpnmessage)-6) if totaldiscounts > totalgoods then totaldiscounts = totalgoods usehst=false if canadataxsystem=true AND shipCountryID=2 AND (shipStateAbbrev="NB" OR shipStateAbbrev="NF" OR shipStateAbbrev="NS") then usehst=true end if if canadataxsystem=true AND shipCountryID=2 AND (shipStateAbbrev="PE" OR shipStateAbbrev="QC") then statetaxable = 0 countrytaxable = 0 if taxShipping=2 AND (shipping - freeshipamnt > 0) then if proratashippingtax=TRUE then if totalgoods > 0 then statetaxable = statetaxable + (((cDbl(totalgoods)-(cDbl(totaldiscounts)+cDbl(statetaxfree))) / totalgoods) * (cDbl(shipping)-cDbl(freeshipamnt))) else statetaxable = statetaxable + (cDbl(shipping)-cDbl(freeshipamnt)) end if countrytaxable = countrytaxable + (cDbl(shipping)-cDbl(freeshipamnt)) end if if taxHandling=2 then statetaxable = statetaxable + cDbl(handling) countrytaxable = countrytaxable + cDbl(handling) end if if totalgoods>0 then statetaxable = statetaxable + (cDbl(totalgoods)-(cDbl(totaldiscounts)+cDbl(statetaxfree))) countrytaxable = countrytaxable + (cDbl(totalgoods)-(cDbl(totaldiscounts)+cDbl(countrytaxfree))) end if countryTax = countrytaxable*cDbl(countryTaxRate)/100.0 stateTax = (statetaxable+cDbl(countryTax))*cDbl(stateTaxRate)/100.0 else if totalgoods>0 then stateTax = ((cDbl(totalgoods)-(cDbl(totaldiscounts)+cDbl(statetaxfree)))*cDbl(stateTaxRate)/100.0) if perproducttaxrate<>TRUE then countryTax = ((cDbl(totalgoods)-(cDbl(totaldiscounts)+cDbl(countrytaxfree)))*cDbl(countryTaxRate)/100.0) end if if taxShipping=2 AND (shipping - freeshipamnt > 0) then if proratashippingtax=TRUE then if totalgoods>0 then stateTax = stateTax + (((cDbl(totalgoods)-(cDbl(totaldiscounts)+cDbl(statetaxfree))) / totalgoods) * (cDbl(shipping)-cDbl(freeshipamnt))*(cDbl(stateTaxRate)/100.0)) else stateTax = stateTax + (cDbl(shipping)-cDbl(freeshipamnt))*(cDbl(stateTaxRate)/100.0) end if countryTax = countryTax + (cDbl(shipping)-cDbl(freeshipamnt))*(cDbl(countryTaxRate)/100.0) end if if taxHandling=2 then stateTax = stateTax + cDbl(handling)*(cDbl(stateTaxRate)/100.0) countryTax = countryTax + cDbl(handling)*(cDbl(countryTaxRate)/100.0) end if end if totalgoods = vsround(totalgoods,2) shipping = vsround(shipping,2) stateTax = vsround(stateTax,2) countryTax = vsround(countryTax,2) handling = vsround(handling,2) if stateTax < 0 then stateTax = 0 if countryTax < 0 then countryTax = 0 freeshipamnt = vsround(freeshipamnt, 2) totaldiscounts = vsround(totaldiscounts, 2) grandtotal = vsround((totalgoods + shipping + stateTax + countryTax + handling) - (totaldiscounts + freeshipamnt), 2) if grandtotal < 0 then grandtotal = 0 sSQL = "SELECT ordID FROM orders WHERE ordSessionID="&replace(thesessionid,"'","")&" AND ordAuthNumber=''" rs.Open sSQL,cnn,0,1 if NOT rs.EOF then orderid=rs("ordID") else orderid="" rs.Close if orderid="" then rs.Open "orders",cnn,1,3,&H0002 rs.AddNew else if mysqlserver then rs.CursorLocation = 3 rs.Open "SELECT * FROM orders WHERE ordID="&orderid,cnn,1,3,&H0001 end if if ordShipName="" AND ordShipAddress="" AND ordShipAddress2="" AND ordShipCity="" then ordShipCountry="" rs.Fields("ordSessionID") = thesessionid rs.Fields("ordName") = ordName rs.Fields("ordAddress") = ordAddress rs.Fields("ordAddress2") = ordAddress2 rs.Fields("ordCity") = ordCity rs.Fields("ordState") = ordState rs.Fields("ordZip") = ordZip rs.Fields("ordCountry") = ordCountry rs.Fields("ordEmail") = ordEmail rs.Fields("ordPhone") = ordPhone rs.Fields("ordShipName") = ordShipName rs.Fields("ordShipAddress") = ordShipAddress rs.Fields("ordShipAddress2")= ordShipAddress2 rs.Fields("ordShipCity") = ordShipCity rs.Fields("ordShipState") = ordShipState rs.Fields("ordShipZip") = ordShipZip rs.Fields("ordShipCountry") = ordShipCountry rs.Fields("ordPayProvider") = ordPayProvider rs.Fields("ordAuthNumber") = "" ' Not yet authorized rs.Fields("ordShipping") = shipping if usehst=true then rs.Fields("ordHSTTax") = stateTax + countryTax rs.Fields("ordStateTax") = 0 rs.Fields("ordCountryTax") = 0 else rs.Fields("ordHSTTax") = 0 rs.Fields("ordStateTax") = stateTax rs.Fields("ordCountryTax") = countryTax end if rs.Fields("ordHandling") = handling rs.Fields("ordShipType") = shipMethod rs.Fields("ordTotal") = totalgoods rs.Fields("ordDate") = DateAdd("h",dateadjust,Now()) rs.Fields("ordStatus") = 2 rs.Fields("ordStatusDate") = DateAdd("h",dateadjust,Now()) rs.Fields("ordIP") = left(request.servervariables("REMOTE_HOST"), 48) rs.Fields("ordComLoc") = ordComLoc rs.Fields("ordAffiliate") = ordAffiliate rs.Fields("ordAddInfo") = ordAddInfo rs.Fields("ordDiscount") = (totaldiscounts + freeshipamnt) rs.Fields("ordDiscountText")= Left(cpnmessage,255) rs.Fields("ordExtra1") = ordExtra1 rs.Fields("ordExtra2") = ordExtra2 rs.Update if mysqlserver=true then if orderid="" then rs.Close rs.Open "SELECT LAST_INSERT_ID() AS lstIns",cnn,0,1 orderid = rs("lstIns") end if else orderid = rs.Fields("ordID") end if rs.Close sSQL="UPDATE cart SET cartOrderID="&orderid&" WHERE cartCompleted=0 AND cartSessionID="&replace(thesessionid,"'","") cnn.Execute(sSQL) descstr="" addcomma = "" sSQL="SELECT cartQuantity,cartProdName FROM cart WHERE cartOrderID="&orderid&" AND cartCompleted=0" rs.Open sSQL,cnn,0,1 do while NOT rs.EOF descstr=descstr&addcomma&rs("cartQuantity")&" "&rs("cartProdName") addcomma = ", " rs.MoveNext loop rs.Close descstr=Replace(descstr,"""","") if request.form("remember")="1" then response.write "" end if end if else success=False end if if checkIntOptions AND success OR (alternaterates AND NOT success) then hassuccess = success success = False ' So not to print the order totals. %>
<% call writehiddenvar("mode", "go") call writehiddenvar("sessionid", thesessionid) call writehiddenvar("PARTNER", ordAffiliate) call writehiddenvar("name", ordName) call writehiddenvar("email", ordEmail) call writehiddenvar("address", ordAddress) call writehiddenvar("address2", ordAddress2) call writehiddenvar("city", ordCity) call writehiddenvar("state", ordState) call writehiddenvar("country", ordCountry) call writehiddenvar("zip", ordZip) call writehiddenvar("phone", ordPhone) call writehiddenvar("sname", ordShipName) call writehiddenvar("saddress", ordShipAddress) call writehiddenvar("saddress2", ordShipAddress2) call writehiddenvar("scity", ordShipCity) call writehiddenvar("sstate", ordShipState) call writehiddenvar("scountry", ordShipCountry) call writehiddenvar("szip", ordShipZip) call writehiddenvar("ordAddInfo", ordAddInfo) call writehiddenvar("ordextra1", ordExtra1) call writehiddenvar("ordextra2", ordExtra2) call writehiddenvar("cpncode", cpncode) call writehiddenvar("payprovider", ordPayProvider) call writehiddenvar("token", token) call writehiddenvar("payerid", payerid) call writehiddenvar("wantinsurance", wantinsurance) call writehiddenvar("commercialloc", commercialloc) call writehiddenvar("remember", request.form("remember")) %> <% if alternaterates then %> <% end if %>
<%=xxShpOpt%>
<% if hassuccess then %>
<% if shipType=4 then response.write "  " else response.write " " %> <% call calculateshippingdiscounts(false) response.write "" %>  
<% else response.write "" & errormsg end if %>
Or select an alternate shipping carrier to compare rates.
 
<% if shipType=4 then %>

 
UPS®, UPS & Shield Design® and UNITED PARCEL SERVICE® are
registered trademarks of United Parcel Service of America, Inc.

<% end if %>
<% elseif NOT success then %>

 

<%=xxSryErr%>

<%="
"&errormsg%>

 

<% elseif ordPayProvider<>"" then blockuser=checkuserblock(ordPayProvider) if blockuser then orderid = 0 thesessionid = "" else sSQL = "SELECT payProvDemo,payProvData1,payProvData2,payProvMethod FROM payprovider WHERE payProvID=" & ordPayProvider rs.Open sSQL,cnn,0,1 demomode=(rs("payProvDemo")="1") data1=trim(rs("payProvData1")&"") data2=trim(rs("payProvData2")&"") ppmethod=Int(rs("payProvMethod")) rs.Close end if if pathtossl<>"" then if Right(pathtossl,1) <> "/" then pathtossl = pathtossl & "/" storeurl = pathtossl end if if grandtotal > 0 AND ordPayProvider="1" then ' PayPal %>
paypal.com/cgi-bin/webscr"> <% Session.LCID = 1033 if splitpaypalshipping then call writehiddenvar("shipping", FormatNumber(vsround((shipping + handling) - freeshipamnt, 2),2,-1,0,0)) call writehiddenvar("amount", FormatNumber(vsround((totalgoods + stateTax + countryTax) - totaldiscounts, 2),2,-1,0,0)) else call writehiddenvar("amount", FormatNumber(grandtotal,2,-1,0,0)) end if Session.LCID = saveLCID %> <% thename = Trim(Request.form("name")) if thename<>"" then if InStr(thename," ") > 0 then namearr = Split(thename," ",2) response.write ""&vbCrLf response.write ""&vbCrLf else response.write ""&vbCrLf end if end if %> " /> " /> " /> <% if countryID=1 AND stateAbbrev<>"" then %> <% else %> "" then response.write Trim(Request.form("state")) else response.write Trim(Request.form("state2"))%>" /> <% end if %> " /> " /> <% elseif grandtotal > 0 AND ordPayProvider="2" then ' 2Checkout courl="https://www.2checkout.com/cgi-bin/sbuyers/cartpurchase.2c" if IsNumeric(data1) then if data1>200000 OR use2checkoutv2=TRUE then courl="https://www2.2checkout.com/2co/buyer/purchase" end if %> <% Session.LCID = 1033 %> <% Session.LCID = saveLCID %> " /> "",", " & Request.form("address2"), "")%>" /> <% if countryID=1 OR countryID=2 then %> " /> "" then response.write Trim(Request.form("state")) else response.write Trim(Request.form("state2"))%>" /> <% else if Trim(Request.form("state"))<>"" then thestate = Trim(Request.form("state")) else thestate = Trim(Request.form("state2")) %> "", ", " & thestate, "")%>" /> <% end if %> " /> " /> " /> <% sSQL = "SELECT cartID,cartProdID,pName,pPrice,cartQuantity,"&IIfVr(digidownloads=TRUE,"pDownload,","")&"pDescription FROM cart INNER JOIN products on cart.cartProdID=products.pID WHERE cartCompleted=0 AND cartSessionID=" & thesessionid rs.Open sSQL,cnn,0,1 index=1 do while NOT rs.EOF thedesc = left(trim(replace(strip_tags2(rs("pDescription")&""),vbNewLine,"\n")), 255) if thedesc = "" then thedesc = left(trim(replace(strip_tags2(rs("pName")&""),vbNewLine,"\n")), 255) response.write "" & vbCrLf response.write "" & vbCrLf response.write "" & vbCrLf response.write "" & vbCrLf if digidownloads=TRUE then if trim(rs("pDownload")&"")<>"" then response.write "" & vbCrLf end if index = index+1 rs.MoveNext loop rs.Close if trim(Request.form("sname")) <> "" OR trim(Request.form("saddress")) <> "" then %> " /> "",", " & Request.form("saddress2"), "")%>" /> " /> "" then response.write Trim(Request.form("sstate")) else response.write Trim(Request.form("sstate2"))%>" /> " /> " /> <% end if if demomode then Response.write "" elseif grandtotal > 0 AND ordPayProvider="3" then ' Authorize.net SIM if secretword<>"" then data1 = upsdecode(data1, secretword) data2 = upsdecode(data2, secretword) end if %> <% if ppmethod=1 then %> <% end if thename = Trim(Request.form("name")) if thename<>"" then if InStr(thename," ") > 0 then namearr = Split(thename," ",2) response.write ""&vbCrLf response.write ""&vbCrLf else response.write ""&vbCrLf end if end if Randomize sequence = Int(1000 * Rnd) if authnetadjust<>"" then tstamp = GetSecondsSince1970() + authnetadjust else tstamp = GetSecondsSince1970() end if fingerprint = HMAC(data2, data1 & "^" & sequence & "^" & tstamp & "^" & FormatNumber(grandtotal,2,-1,0,0) & "^") %> "",", " & Request.form("address2"), "")%>" /> " /> " /> " /> "" then response.write Trim(Request.form("state")) else response.write Trim(Request.form("state2"))%>" /> " /> " /> <% if trim(Request.form("sname")) <> "" OR trim(Request.form("saddress")) <> "" then thename = Trim(Request.form("sname")) if thename<>"" then if InStr(thename," ") > 0 then namearr = Split(thename," ",2) response.write ""&vbCrLf response.write ""&vbCrLf else response.write ""&vbCrLf end if end if %> "",", " & Request.form("saddress2"), "")%>" /> " /> " /> "" then response.write Trim(Request.form("sstate")) else response.write Trim(Request.form("sstate2"))%>" /> " /> <% end if %> <% if demomode then %> <% end if elseif grandtotal = 0 OR ordPayProvider="4" then ' Email %> <% elseif grandtotal > 0 AND ordPayProvider="17" then ' Email 2 %> <% elseif grandtotal > 0 AND ordPayProvider="5" then ' WorldPay %> <% Session.LCID = 1033 %> <% Session.LCID = saveLCID %> " /> "",", " & Request.form("address2"), "")%> <%=Request.form("city")%> <% if trim(request.form("state"))<>"" then response.write Request.form("state") else response.write Request.form("state2") end if%>" /> " /> " /> " /> " /> <% if demomode then %> <% end if data2arr = split(data2,"&",2) if UBOUND(data2arr) >= 0 then data2 = data2arr(0) if data2<>"" then response.write "" Session.LCID = 1033 response.write "" Session.LCID = saveLCID end if elseif grandtotal > 0 AND ordPayProvider="6" then ' NOCHEX %> " /> <% if demomode then response.write "" elseif grandtotal > 0 AND ordPayProvider="7" then ' VeriSign Payflow Pro %> <% elseif grandtotal > 0 AND ordPayProvider="8" then ' Payflow Link paymentlink = "https://payments.verisign.com/payflowlink" if data2="VSA" then paymentlink="https://payments.verisign.com.au/payflowlink" %> " /> "",", " & Request.form("address2"), "")%>" /> " /> "" then response.write Trim(Request.form("state")) else response.write Trim(Request.form("state2"))%>" /> " /> " /> " /> " /> <% if trim(Request.form("sname")) <> "" OR trim(Request.form("saddress")) <> "" then %> " /> "",", " & Request.form("saddress2"), "")%>" /> " /> "" then response.write Trim(Request.form("sstate")) else response.write Trim(Request.form("sstate2"))%>" /> " /> " /> <% end if elseif grandtotal > 0 AND ordPayProvider="9" then ' Secpay %> " /> " /> " /> " /> "" then response.write Trim(Request.form("state")) else response.write Trim(Request.form("state2"))%>" /> " /> " /> " /> " /> <% if trim(Request.form("sname")) <> "" OR trim(Request.form("saddress")) <> "" then %> " /> " /> " /> " /> "" then response.write Trim(Request.form("sstate")) else response.write Trim(Request.form("sstate2"))%>" /> " /> " /> <% end if if demomode then %> <% end if elseif grandtotal > 0 AND ordPayProvider="10" then ' Capture Card %> <% elseif grandtotal > 0 AND (ordPayProvider="11" OR ordPayProvider="12") then ' PSiGate %> > <% Session.LCID = 1033 %> <% Session.LCID = saveLCID %> " /> <% if ordPayProvider="11" then %>" /><% end if %> " /> " /> " /> " /> <% if countryID=1 AND stateAbbrev<>"" then %> <% else %> "" then response.write Trim(Request.form("state")) else response.write Trim(Request.form("state2"))%>" /> <% end if %> " /> " /> " /> <% if trim(Request.form("sname")) <> "" OR trim(Request.form("saddress")) <> "" then %> " /> " /> " /> " /> "" then response.write Trim(Request.form("sstate")) else response.write Trim(Request.form("sstate2"))%>" /> " /> " /> <% end if if demomode then %> <% end if elseif grandtotal > 0 AND ordPayProvider="13" then ' Authorize.net AIM %> <% elseif grandtotal > 0 AND ordPayProvider="14" then ' Custom Pay Provider %> <% elseif grandtotal > 0 AND ordPayProvider="15" then ' Netbanx %> " /> " /> " /> <% elseif grandtotal > 0 AND ordPayProvider="16" then ' Linkpoint %> > <%if data2<>"1" then %>" /><% end if %> " /> " /> " /> <% if countryID=1 AND stateAbbrev<>"" then %> <% else %> "" then response.write Trim(Request.form("state")) else response.write Trim(Request.form("state2"))%>" /> <% end if %> " /> " /> " /> " /> <% if trim(Request.form("sname")) <> "" OR trim(Request.form("saddress")) <> "" then %> " /> " /> " /> " /> "" then response.write Trim(Request.form("sstate")) else response.write Trim(Request.form("sstate2"))%>" /> " /> <% end if if demomode then %> <% end if elseif grandtotal > 0 AND ordPayProvider="18" then ' PayPal Payment Pro %> " /> <% elseif grandtotal > 0 AND ordPayProvider="19" then ' PayPal Express Payment %> <% end if end if if success then %>
<% if cpncode<>"" AND NOT gotcpncode then %> <% end if if cpnmessage<>"" then %> <% end if %> <% if shipType<>0 then %> <% end if if handling<>0 then %> <% end if if (totaldiscounts + freeshipamnt)<>0 then %> <% end if if usehst then %> <% else if stateTax<>0.0 then %> <% end if if countryTax<>0.0 then %> <% end if end if %> <% if grandtotal > 0 AND (ordPayProvider="7" OR ordPayProvider="10" OR ordPayProvider="12" OR ordPayProvider="13" OR (ordPayProvider="16" AND (data2&"")="1") OR ordPayProvider="18") then ' VeriSign Payflow Pro OR Capture Card OR PSiGate SSL OR Auth.NET AIM OR PayPal Pro if ordPayProvider="7" OR ordPayProvider="12" OR ordPayProvider="13" OR ordPayProvider="16" OR ordPayProvider="18" then data1 = "XXXXXXX0XXXXXXXXXXXXXXXXX" isPSiGate = (ordPayProvider="12") isLinkpoint = (ordPayProvider="16") if isPSiGate then sscardname="bname" sscardnum = "CardNumber" ssexmon = "ExpMonth" ssexyear = "ExpYear" elseif isLinkpoint then sscardname="bname" sscardnum = "cardnumber" ssexmon = "expmonth" ssexyear = "expyear" sscvv2 = "cvm" else sscardname="cardname" sscardnum = "ACCT" ssexmon = "EXMON" ssexyear = "EXYEAR" sscvv2 = "CVV2" end if acceptecheck = (acceptecheck=true) AND (ordPayProvider="13") %> <% if request.servervariables("HTTPS")<>"on" AND (Request.ServerVariables("SERVER_PORT_SECURE") <> "1") AND nochecksslserver<>true then %> <% end if %> <% if NOT isPSiGate then %> <% end if if Mid(data1,8,1)="X" then %> <% end if if acceptecheck=true then ' Auth.net %> <% if wellsfargo=true then %> <% end if end if end if %>
<%=xxChkCmp%>
<%=xxGifCer%>: <% if request.form("shipping")="" then jumpback=1 else jumpback=2 response.write Replace(Replace(xxNoGfCr,"%s",cpncode,1,1),"%s",jumpback,1,1)%>
<%=xxAppDs%>: <%=cpnmessage%>
<%=xxTotGds%>: <%=FormatEuroCurrency(totalgoods)%>
<%=xxShippg%>: <%=FormatEuroCurrency(shipping)%>
<%=xxHndlg%>: <%=FormatEuroCurrency(handling)%>
<%=xxTotDs%>: <%=FormatEuroCurrency(totaldiscounts+freeshipamnt)%>
<%=xxSubTot%>: <%=FormatEuroCurrency((totalgoods+shipping+handling)-(totaldiscounts+freeshipamnt))%>
<%=xxHST%>: <%=FormatEuroCurrency(stateTax+countryTax)%>
<%=xxStaTax%>: <%=FormatEuroCurrency(stateTax)%>
<%=xxCntTax%>: <%=FormatEuroCurrency(countryTax)%>
<%=xxGndTot%>: <%=FormatEuroCurrency(grandtotal)%>
This site may not be secure. Do not enter real Credit Card numbers.
<%=xxCCDets%>
<%=xxCCName%>: " AUTOCOMPLETE="off" />
<%=xxCrdNum%>:
<%=xxExpEnd%>: /
<%=xx34code%>: <%if requirecvv<>true then response.write xxIfPres%>
Issue Number / Start Date: (Switch/Solo Only)
ECheck Details
Please enter either Credit Card OR ECheck details
Account Name: " />
Account Number:
Bank Name:
Routing Number:
Account Type:
Personal or Business Acct.:
Tax ID:
If you have provided a Tax ID then the following information is not necessary
Drivers License Number:
Drivers License State:
Date Of Birth On License:
<%=xxMstClk%>
 
<% end if ' success elseif Request.Form("mode")="authorize" then blockuser=checkuserblock("") ordID = replace(Request.Form("ordernumber"), "'", "") if Request.Form("method")="payflowpro" then sSQL = "SELECT payProvData1,payProvDemo,payProvMethod FROM payprovider WHERE payProvID=7" rs.Open sSQL,cnn,0,1 vsdetails = rs("payProvData1") demomode=(Int(rs("payProvDemo"))=1) ppmethod=Int(rs("payProvMethod")) rs.Close if IsNull(vsdetails) then vsdetails="" vsdetails = Split(vsdetails, "&") if UBOUND(vsdetails) > 0 then vs1=vsdetails(0) vs2=vsdetails(1) vs3=vsdetails(2) vs4=vsdetails(3) end if sSQL = "SELECT ordZip,ordShipping,ordStateTax,ordCountryTax,ordHandling,ordTotal,ordDiscount,ordAddress,ordAddress2,ordAuthNumber FROM orders WHERE ordID="&ordID rs.Open sSQL,cnn,0,1 vsAUTHCODE = (rs("ordAuthNumber")&"") parmList = "TRXTYPE=" & IIfVr(ppmethod=1,"A","S") & "&TENDER=C" parmList = parmList & "&ZIP["&Len(rs("ordZip"))&"]="&rs("ordZip") parmList = parmList & "&STREET["&Len(rs("ordAddress"))&"]="&rs("ordAddress") if trim(rs("ordAddress2")&"")<>"" then parmList = parmList & ", "&rs("ordAddress2") parmList = parmList & "&NAME["&Len(Request.Form("cardname"))&"]="&Request.Form("cardname") parmList = parmList & "&COMMENT1="&ordID parmList = parmList & "&ACCT=" & request.form("ACCT") parmList = parmList & "&PWD=" & vs4 parmList = parmList & "&USER=" & vs1 parmList = parmList & "&VENDOR=" & vs2 parmList = parmList & "&PARTNER=" & vs3 parmList = parmList & "&CVV2=" & Trim(request.form("CVV2")) parmList = parmList & "&EXPDATE=" & request.form("EXMON") & Right(request.form("EXYEAR"),2) parmList = parmList & "&AMT=" & FormatNumber((rs("ordShipping")+rs("ordStateTax")+rs("ordCountryTax")+rs("ordTotal")+rs("ordHandling"))-rs("ordDiscount"),2,-1,0,0) rs.Close if vsAUTHCODE="" then success=true if blockuser then success=FALSE else Set client = Server.CreateObject("PFProCOMControl.PFProCOMControl.1") if vs3="VSA" then theurl = "payflow.verisign.com.au" if demomode then theurl = "payflow-test.verisign.com.au" else theurl = "payflow.verisign.com" if demomode then theurl = "test-payflow.verisign.com" end if Ctx1 = client.CreateContext(theurl, 443, 30, "", 0, "", "") curString = client.SubmitTransaction(Ctx1, parmList, Len(parmList)) client.DestroyContext (Ctx1) Do while Len(curString) <> 0 'get the next name value pair if InStr(curString,"&") Then varString = Left(curString, InStr(curString , "&" ) -1) else varString = curString end if 'get the name part of the name/value pair name = Left(varString, InStr(varString, "=" ) -1) value = Right(varString, Len(varString) - (Len(name)+1)) if name="RESULT" then vsRESULT=value elseif name="PNREF" then vsPNREF=value elseif name="RESPMSG" then vsRESPMSG=value elseif name="AUTHCODE" then vsAUTHCODE=value elseif name="AVSADDR" then vsAVSADDR=value elseif name="AVSZIP" then vsAVSZIP=value elseif name="IAVS" then vsIAVS=value end if 'skip over the & if Len(curString) <> Len(varString) Then curString = Right(curString, Len(curString) - (Len(varString)+1)) else curString = "" end if Loop end if if success then if vsRESULT="0" then do_stock_management(ordID) sSQL="UPDATE cart SET cartCompleted=1 WHERE cartOrderID="&ordID cnn.Execute(sSQL) sSQL="UPDATE orders SET ordStatus=3,ordAuthNumber='"&replace(vsAVSADDR&vsAVSZIP&"-"&vsAUTHCODE, "'", "")&"' WHERE ordID="&ordID cnn.Execute(sSQL) end if end if set client = nothing else vsRESULT="0" vsRESPMSG="Approved" if InStr(vsAUTHCODE,"-") > 0 then vsAUTHCODE = Right(vsAUTHCODE,Len(vsAUTHCODE)-InStr(vsAUTHCODE,"-")) end if elseif Request.Form("method")="authnetaim" then sSQL = "SELECT payProvData1,payProvData2,payProvDemo,payProvMethod FROM payprovider WHERE payProvID=13" rs.Open sSQL,cnn,0,1 login = rs("payProvData1") trankey = rs("payProvData2") if secretword<>"" then login = upsdecode(login, secretword) trankey = upsdecode(trankey, secretword) end if demomode=(Int(rs("payProvDemo"))=1) ppmethod=Int(rs("payProvMethod")) rs.Close sSQL = "SELECT ordID,ordName,ordCity,ordState,ordCountry,ordPhone,ordHandling,ordZip,ordEmail,ordShipping,ordStateTax,ordCountryTax,ordTotal,ordDiscount,ordAddress,ordAddress2,ordIP,ordAuthNumber,ordShipName,ordShipAddress,ordShipAddress2,ordShipCity,ordShipState,ordShipCountry,ordShipZip FROM orders WHERE ordID="&ordID rs.Open sSQL,cnn,0,1 vsAUTHCODE = rs("ordAuthNumber") if IsNull("ordAuthNumber") then vsAUTHCODE="" parmList = "x_version=3.1&x_delim_data=True&x_relay_response=False&x_delim_char=|" parmList = parmList & "&x_login="&login parmList = parmList & "&x_tran_key="&trankey parmList = parmList & "&x_cust_id="&rs("ordID") parmList = parmList & "&x_Invoice_Num="&rs("ordID") parmList = parmList & "&x_amount=" & FormatNumber((rs("ordShipping")+rs("ordStateTax")+rs("ordCountryTax")+rs("ordTotal")+rs("ordHandling"))-rs("ordDiscount"),2,-1,0,0) parmList = parmList & "&x_currency_code=" & countryCurrency parmList = parmList & "&x_Description=" & server.urlencode(request.form("description")) if trim(request.form("accountnum"))<>"" then parmList = parmList & "&x_method=ECHECK&x_echeck_type=WEB&x_recurring_billing=NO" parmList = parmList & "&x_bank_acct_name=" & server.urlencode(trim(request.form("accountname"))) parmList = parmList & "&x_bank_acct_num=" & server.urlencode(trim(request.form("accountnum"))) parmList = parmList & "&x_bank_name=" & server.urlencode(trim(request.form("bankname"))) parmList = parmList & "&x_bank_aba_code=" & server.urlencode(trim(request.form("routenumber"))) parmList = parmList & "&x_bank_acct_type=" & server.urlencode(trim(request.form("accounttype"))) parmList = parmList & "&x_type=AUTH_CAPTURE" if wellsfargo=true then parmList = parmList & "&x_customer_organization_type=" & trim(request.form("orgtype")) if trim(request.form("taxid"))<>"" then parmList = parmList & "&x_customer_tax_id=" & server.urlencode(trim(request.form("taxid"))) else parmList = parmList & "&x_drivers_license_num=" & server.urlencode(trim(request.form("licensenumber"))) parmList = parmList & "&x_drivers_license_state=" & server.urlencode(trim(request.form("licensestate"))) parmList = parmList & "&x_drivers_license_dob=" & server.urlencode(trim(request.form("dldobyear")) & "/" & trim(request.form("dldobmon")) & "/" & trim(request.form("dldobday"))) end if end if else parmList = parmList & "&x_method=CC" parmList = parmList & "&x_card_num=" & server.urlencode(trim(request.form("ACCT"))) parmList = parmList & "&x_exp_date=" & request.form("EXMON") & Right(request.form("EXYEAR"),2) if Trim(request.form("CVV2"))<>"" then parmList = parmList & "&x_card_code=" & server.urlencode(Trim(request.form("CVV2"))) if ppmethod=1 then parmList = parmList & "&x_type=AUTH_ONLY" else parmList = parmList & "&x_type=AUTH_CAPTURE" end if thename = Trim(trim(request.form("cardname"))) if thename<>"" then if InStr(thename," ") > 0 then namearr = Split(thename," ",2) parmList = parmList & "&x_first_name=" & server.urlencode(namearr(0)) parmList = parmList & "&x_last_name=" & server.urlencode(namearr(1)) else parmList = parmList & "&x_last_name=" & server.urlencode(thename) end if end if parmList = parmList & "&x_address="&server.urlencode(rs("ordAddress")) if trim(rs("ordAddress2")&"")<>"" then parmList = parmList & server.urlencode(", "&rs("ordAddress2")) parmList = parmList & "&x_city="&server.urlencode(rs("ordCity")) parmList = parmList & "&x_state="&server.urlencode(rs("ordState")) parmList = parmList & "&x_zip="&server.urlencode(rs("ordZip")) parmList = parmList & "&x_country="&server.urlencode(rs("ordCountry")) parmList = parmList & "&x_phone="&server.urlencode(rs("ordPhone")) parmList = parmList & "&x_email="&server.urlencode(rs("ordEmail")) thename = trim(rs("ordShipName")) if thename<>"" OR rs("ordShipAddress")<>"" then if thename<>"" then if InStr(thename," ") > 0 then namearr = Split(thename," ",2) parmList = parmList & "&x_ship_to_first_name=" & server.urlencode(namearr(0)) parmList = parmList & "&x_ship_to_last_name=" & server.urlencode(namearr(1)) else parmList = parmList & "&x_ship_to_last_name=" & server.urlencode(thename) end if end if parmList = parmList & "&x_ship_to_address="&server.urlencode(rs("ordShipAddress")) if trim(rs("ordShipAddress2")&"")<>"" then parmList = parmList & server.urlencode(", "&rs("ordShipAddress2")) parmList = parmList & "&x_ship_to_city="&server.urlencode(rs("ordShipCity")) parmList = parmList & "&x_ship_to_state="&server.urlencode(rs("ordShipState")) parmList = parmList & "&x_ship_to_zip="&server.urlencode(rs("ordShipZip")) parmList = parmList & "&x_ship_to_country="&server.urlencode(rs("ordShipCountry")) end if if Trim(rs("ordIP"))<>"" then parmList = parmList & "&x_customer_ip="&server.urlencode(Trim(rs("ordIP"))) if demomode then parmList = parmList & "&x_test_request=TRUE" rs.Close if vsAUTHCODE="" then success=true if blockuser then success=FALSE else set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") objHttp.open "POST", "https://secure.authorize.net/gateway/transact.dll", false objHttp.Send parmList If err.number <> 0 OR objHttp.status <> 200 Then errormsg = "Error, couldn't connect to Authorize.net server" Else varString = Split(objHttp.responseText, "|") vsRESULT=varString(0) vsERRCODE=varString(2) vsRESPMSG=varString(3) if vsERRCODE <> "1" AND demomode then vsRESPMSG = vsERRCODE & " - " & vsRESPMSG vsAUTHCODE=varString(4) vsAVSADDR=varString(5) vsTRANSID=varString(6) vsCVV2=varString(38) if Int(vsRESULT)=1 then vsRESULT="0" ' Keep in sync with Payflow Pro do_stock_management(ordID) sSQL="UPDATE cart SET cartCompleted=1 WHERE cartOrderID="&ordID cnn.Execute(sSQL) sSQL="UPDATE orders SET ordStatus=3,ordAuthNumber='"&vsAVSADDR&vsCVV2&"-"&vsAUTHCODE&"',ordTransID='"&vsTRANSID&"' WHERE ordID="&ordID cnn.Execute(sSQL) end if End If set objHttp = nothing end if else vsRESULT="0" vsRESPMSG="This transaction has been approved." if InStr(vsAUTHCODE,"-") > 0 then vsAUTHCODE = Right(vsAUTHCODE,Len(vsAUTHCODE)-InStr(vsAUTHCODE,"-")) end if elseif Request.Form("method")="paypalpro" then on error resume next Server.ScriptTimeout = 120 on error goto 0 sSQL = "SELECT payProvData1,payProvData2,payProvDemo,payProvMethod FROM payprovider WHERE payProvEnabled=1 AND payProvID=18" rs.Open sSQL,cnn,0,1 username = rs("payProvData1") password = rs("payProvData2") demomode=(Int(rs("payProvDemo"))=1) ppmethod=Int(rs("payProvMethod")) rs.Close sSQL = "SELECT ordID,ordName,ordCity,ordState,ordCountry,ordPhone,ordHandling,ordZip,ordEmail,ordShipping,ordStateTax,ordCountryTax,ordTotal,ordDiscount,ordAddress,ordAddress2,ordIP,ordAuthNumber,ordShipName,ordShipAddress,ordShipAddress2,ordShipCity,ordShipState,ordShipCountry,ordShipZip FROM orders WHERE ordID=" & ordID rs.Open sSQL,cnn,0,1 ordState = rs("ordState") sSQL = "SELECT countryID,countryCode,countryOrder FROM countries WHERE countryName='" & replace(rs("ordCountry"),"'","''") & "'" rs2.Open sSQL,cnn,0,1 countryID = rs2("countryID") countryCode = rs2("countryCode") homecountry = (rs2("countryOrder")=2) rs2.Close if countryID = 1 OR countryID = 2 then sSQL = "SELECT stateTax,stateAbbrev FROM states WHERE stateName='" & replace(rs("ordState"),"'","''") & "'" rs2.Open sSQL,cnn,0,1 if NOT rs2.EOF then ordState=rs2("stateAbbrev") rs2.Close end if vsAUTHCODE = trim(rs("ordAuthNumber")&"") thename = trim(request.form("cardname")) if thename<>"" then if InStr(thename," ") > 0 then namearr = Split(thename," ",2) firstname = namearr(0) lastname = namearr(1) else firstname = "" lastname = thename end if end if cardnum = replace(trim(request.form("ACCT")), " ", "") cartype = "Visa" if left(cardnum, 1)="5" then cartype="MasterCard" elseif left(cardnum, 1)="6" then cartype="Discover" elseif left(cardnum, 1)="3" then cartype="Amex" end if sXML = ppsoapheader(username, password) & _ " " & _ " " & _ " " & _ " 1.00" & _ " " & _ " " & IIfVr(ppmethod=1, "Authorization", "Sale") & "" & _ " " & _ " " & FormatNumber((rs("ordShipping")+rs("ordStateTax")+rs("ordCountryTax")+rs("ordTotal")+rs("ordHandling"))-rs("ordDiscount"),2,-1,0,0) & "" & _ " ecommercetemplates.asp.ecommplus" & _ " " & _ " " & _ " " & cartype & "" & _ " " & server.urlencode(cardnum) & "" & _ " " & request.form("EXMON") & "" & _ " " & request.form("EXYEAR") & "" & _ " " & _ " " & _ " " & firstname & "" & _ " " & lastname & "" & _ " " & _ " " & countryCode & "" & _ "
" & _ " " & server.urlencode(rs("ordAddress")) & "" & _ " " & server.urlencode(rs("ordAddress2")) & "" & _ " " & rs("ordCity") & "" & _ " " & ordState & "" & _ " " & countryCode & "" & _ " " & rs("ordZip") & "" & _ "
" & _ "
" & _ " " & trim(request.form("CVV2")) & "" & _ "
" & _ " " & trim(rs("ordIP")) & "" & _ " " & rs("ordID") & "" & _ "
" & _ "
" & _ "
" & _ "
" & _ "" if demomode then sandbox = ".sandbox" else sandbox = "" vsRESULT="-1" if vsAUTHCODE="" then if blockuser then success=FALSE else success = callxmlfunction("https://api" & sandbox & ".paypal.com/2.0/", sXML, res, username, "WinHTTP.WinHTTPRequest.5.1", vsRESPMSG, TRUE) end if if success then vsAUTHCODE="" vsERRCODE="" vsRESPMSG="" vsAVSADDR="" vsTRANSID="" vsCVV2="" set xmlDoc = Server.CreateObject("MSXML2.DOMDocument") xmlDoc.validateOnParse = False xmlDoc.loadXML (res) Set nodeList = xmlDoc.getElementsByTagName("SOAP-ENV:Body") Set n = nodeList.Item(0) for j = 0 to n.childNodes.length - 1 Set e = n.childNodes.Item(i) if e.nodeName = "DoDirectPaymentResponse" then for k = 0 To e.childNodes.length - 1 Set t = e.childNodes.Item(k) if t.nodeName = "Ack" then if t.firstChild.nodeValue = "Success" then vsRESULT = 1 vsRESPMSG = t.firstChild.nodeValue end if elseif t.nodeName = "TransactionID" then vsAUTHCODE = t.firstChild.nodeValue elseif t.nodeName = "AVSCode" then if t.hasChildNodes then vsAVSADDR = t.firstChild.nodeValue elseif t.nodeName = "CVV2Code" then if t.hasChildNodes then vsCVV2 = t.firstChild.nodeValue elseif t.nodeName = "Errors" then set ff = t.childNodes for kk = 0 to ff.length - 1 set gg = ff.item(kk) if gg.nodeName = "ShortMessage" then ' vsRESPMSG = gg.firstChild.nodeValue & "
" & errormsg elseif gg.nodeName = "LongMessage" then vsRESPMSG = gg.firstChild.nodeValue elseif gg.nodeName = "ErrorCode" then vsERRCODE = gg.firstChild.nodeValue end if next end if next end if next if Int(vsRESULT)=1 then vsRESULT="0" ' Keep in sync with Payflow Pro do_stock_management(ordID) sSQL="UPDATE cart SET cartCompleted=1 WHERE cartOrderID="&ordID cnn.Execute(sSQL) sSQL="UPDATE orders SET ordStatus=3,ordAuthNumber='"&vsAVSADDR&vsCVV2&"-"&vsAUTHCODE&"',ordTransID='"&vsTRANSID&"' WHERE ordID="&ordID cnn.Execute(sSQL) end if end if else vsRESULT="0" vsRESPMSG="This transaction has been approved." if InStr(vsAUTHCODE,"-") > 0 then vsAUTHCODE = Right(vsAUTHCODE,Len(vsAUTHCODE)-InStr(vsAUTHCODE,"-")) end if end if %>
<% if vsRESULT="0" then %> <% if forcesubmit=true then if forcesubmittimeout="" then forcesubmittimeout=5000 response.write "" & vbCrLf end if else %> <% end if %>
<%=xxTnxOrd%>
<%=xxTrnRes%>: <%=vsRESPMSG%>
<%=xxOrdNum%>: <%=ordID%>
<%=xxAutCod%>: <%=vsAUTHCODE%>
   

 
<%=xxSorTrn%>
<%=xxTrnRes%>: <%="(" & vsERRCODE & ") " & vsRESPMSG%>
   

 
<% elseif request.querystring("token") = "" AND request.form("mode") <> "paypalexpress1" then addextrarows=0 wantstateselector=FALSE wantcountryselector=FALSE wantzipselector=FALSE if estimateshipping=TRUE then addextrarows=1 if shipType=2 OR shipType=5 then ' weight / price based wantcountryselector=TRUE if splitUSZones then addextrarows=3 wantstateselector=TRUE else addextrarows=2 end if elseif shipType=3 OR shipType=4 OR shipType=6 then addextrarows=3 wantzipselector=TRUE wantcountryselector=TRUE end if shiphomecountry=TRUE if request.form("state")<>"" then shipstate = request.form("state") session("state") = request.form("state") elseif session("state")<>"" then shipstate = session("state") else shipstate = defaultshipstate end if if request.form("zip")<>"" then destZip = trim(request.form("zip")) session("zip") = trim(request.form("zip")) elseif session("zip")<>"" then destZip = session("zip") else destZip = origZip end if if request.form("country")<>"" then shipcountry = request.form("country") session("country") = request.form("country") if trim(request.form("state"))="" then shipstate="" elseif session("country")<>"" then shipcountry = session("country") else shipCountryCode = origCountryCode shipcountry = origCountry end if sSQL = "SELECT countryID,countryTax,countryCode,countryFreeShip,countryOrder FROM countries WHERE countryName='"&replace(shipcountry,"'","''")&"'" rs.Open sSQL,cnn,0,1 if NOT rs.EOF then countryTaxRate = rs("countryTax") shipCountryID = rs("countryID") shipCountryCode = rs("countryCode") freeshipapplies = (rs("countryFreeShip")=1) shiphomecountry = (rs("countryOrder")=2) end if rs.Close if session("xsshipping")="" then initshippingmethods() end if alldata="" if mysqlserver=true then sSQL = "SELECT cartID,cartProdID,cartProdName,cartProdPrice,cartQuantity,pWeight,pShipping,pShipping2,pExemptions,pSection,topSection,pDims FROM cart LEFT JOIN products ON cart.cartProdID=products.pID LEFT OUTER JOIN sections ON products.pSection=sections.sectionID WHERE cartCompleted=0 AND cartSessionID="&Session.SessionID else sSQL = "SELECT cartID,cartProdID,cartProdName,cartProdPrice,cartQuantity,pWeight,pShipping,pShipping2,pExemptions,pSection,topSection,pDims FROM cart INNER JOIN (products LEFT OUTER JOIN sections ON products.pSection=sections.sectionID) ON cart.cartProdID=products.pID WHERE cartCompleted=0 AND cartSessionID="&Session.SessionID end if rs.Open sSQL,cnn,0,1 if NOT (rs.EOF OR rs.BOF) then alldata=rs.getrows rs.Close %>
<% if IsArray(alldata) then if NOT isInStock then %> <% end if %> <% totaldiscounts = 0 changechecker = "" For index=0 to UBOUND(alldata,2) changechecker = changechecker & "if(document.checkoutform.quant" & alldata(0,index) & ".value!=" & alldata(4,index) & ") dowarning=true;" & vbCrLf theoptions = "" theoptionspricediff = 0 sSQL = "SELECT coOptGroup,coCartOption,coPriceDiff,coWeightDiff FROM cartoptions WHERE coCartID="&alldata(0,index) & " ORDER BY coID" rs.Open sSQL,cnn,0,1 do while NOT rs.EOF theoptionspricediff = theoptionspricediff + rs("coPriceDiff") alldata(5,index)=cDbl(alldata(5,index))+cDbl(rs("coWeightDiff")) theoptions = theoptions & "" theoptions = theoptions & "" theoptions = theoptions & "" theoptions = theoptions & "" theoptions = theoptions & "" theoptions = theoptions & "" theoptions = theoptions & "" theoptions = theoptions & "" & vbCrLf totalgoods = totalgoods + (rs("coPriceDiff")*alldata(4,index)) rs.MoveNext loop rs.Close %> <% response.write theoptions totalgoods = totalgoods + (alldata(3,index)*alldata(4,index)) totalquantity = totalquantity + Int(alldata(4,index)) alldata(3,index) = alldata(3,index) + theoptionspricediff if (shipType=2 OR shipType=3 OR shipType=4 OR shipType=6) AND cDbl(alldata(5,index))<=0.0 then alldata(8,index) = (alldata(8,index) OR 4) if estimateshipping=TRUE AND session("xsshipping")="" then call addproducttoshipping(alldata, index) Next call calculatediscounts(totalgoods, false, "") if totaldiscounts > totalgoods then totaldiscounts = totalgoods if totaldiscounts=0 then session("discounts")="" else session("discounts")=totaldiscounts addextrarows = addextrarows + 1 end if if addextrarows > 0 then %> <% end if if totaldiscounts>0 then %> <% end if if estimateshipping=TRUE then if session("xsshipping")="" then calculateshipping() if IsNumeric(shipinsuranceamt) AND abs(addshippinginsurance)=1 then shipping = shipping + IIfVr(addshippinginsurance=1,((cDbl(totalgoods)*cDbl(shipinsuranceamt))/100.0),shipinsuranceamt) calculateshippingdiscounts(false) session("xsshipping")=shipping-freeshipamnt else shipping = session("xsshipping") end if if errormsg<>"" then %> <% else %> <% end if if wantstateselector then sSQL = "SELECT stateName FROM states WHERE stateEnabled=1 ORDER BY stateName" rs.Open sSQL,cnn,0,1 if NOT rs.EOF then allstates=rs.getrows rs.Close if IsArray(allstates) then %> <% end if end if if wantcountryselector then %> <% end if if wantzipselector then %> <% end if end if %> <% if addextrarows=0 then %> <% end if %> <% else cartEmpty=True %> <% end if %>
<%=xxNoStok%>
<%=xxCODets%> <%=xxCOName%> <%=xxCOUPri%> <%=xxQuant%> <%=xxTotal%> <%=xxCOSel%>
"&rs("coOptGroup")&":" & " - " & rs("coCartOption") & "" & IIfVr(rs("coPriceDiff")=0 OR hideoptpricediffs=true,"- ", FormatEuroCurrency(rs("coPriceDiff"))) & " " & IIfVr(rs("coPriceDiff")=0 OR hideoptpricediffs=true,"- ", FormatEuroCurrency(rs("coPriceDiff")*alldata(4,index))) & " 
<%=alldata(1,index)%> <% Response.write alldata(2,index) %> <%=IIfVr(hideoptpricediffs=true,FormatEuroCurrency(alldata(3,index)+theoptionspricediff),FormatEuroCurrency(alldata(3,index)))%> <%=IIfVr(hideoptpricediffs=true,FormatEuroCurrency((alldata(3,index)+theoptionspricediff)*alldata(4,index)),FormatEuroCurrency(alldata(3,index)*alldata(4,index)))%>
  <%=xxSubTot%>: <%=FormatEuroCurrency(totalgoods)%> <%=xxDelete%>
<%=xxDsApp%> <%=FormatEuroCurrency(totaldiscounts)%>  
<%=xxShpEst%>: <%=errormsg%>
<%=xxShpEst%>: <% if freeshipamnt=shipping then response.write "

" & xxFree & "

" else response.write FormatEuroCurrency(shipping-freeshipamnt)%>
 
<%=xxAllSta%>:
<%=xxCountry%>:
<%=xxZip%>: ">
 <%=xxGndTot%>: <%=FormatEuroCurrency((totalgoods+shipping)-(totaldiscounts+freeshipamnt))%> <% if addextrarows=0 then response.write "" & xxDelete & "" else response.write " " end if %>
"" AND (actionaftercart=2 OR actionaftercart=3) then response.write Session("frompage") else response.write xxHomeURL%>"><%=xxCntShp%> <%=xxUpdTot%>

 

<%=xxSryEmp%>

 

"" AND (actionaftercart=2 OR actionaftercart=3) then response.write Session("frompage") else response.write xxHomeURL%>"><%=xxCntShp%>

 

<% end if if request.querystring("token") = "" AND request.form("mode") <> "paypalexpress1" AND request.form("mode")<>"go" AND request.form("mode")<>"checkout" AND request.form("mode")<>"add" AND request.form("mode")<>"authorize" AND NOT cartEmpty then requiressl = false if pathtossl="" then sSQL = "SELECT payProvID FROM payprovider WHERE payProvEnabled=1 AND (payProvID IN (7,10,12,13,18) OR (payProvID=16 AND payProvData2='1'))" ' All the ones that require SSL rs.Open sSQL,cnn,0,1 if NOT rs.EOF then requiressl = true rs.Close end if sSQL = "SELECT payProvID FROM payprovider WHERE payProvEnabled=1 AND payProvID=18" ' Check for PayPal Payment Pro rs.Open sSQL,cnn,0,1 if NOT rs.EOF then paypalexpress = true rs.Close if requiressl OR pathtossl<>"" then if pathtossl<>"" then if Right(pathtossl,1) <> "/" then pathtossl = pathtossl & "/" cartpath = pathtossl & "cart.asp" else cartpath = Replace(storeurl,"http:","https:") & "cart.asp" end if else cartpath="cart.asp" end if %>
"",trim(request.querystring("PARTNER")),Trim(request.cookies("PARTNER")))%>" /> <% if Trim(Session("clientUser"))<>"" then cnn.Execute("DELETE FROM tmplogin WHERE tmplogindate < " & datedelim & VSUSDate(Date()-3) & datedelim & " OR tmploginid=" & Session.SessionID) cnn.Execute("INSERT INTO tmplogin (tmploginid, tmploginname, tmplogindate) VALUES (" & Session.SessionID & ",'" & Trim(Session("clientUser")) & "'," & datedelim & VSUSDate(Date()) & datedelim & ")") response.write "" if (Session("clientActions") AND 8) = 8 OR (Session("clientActions") AND 16) = 16 then if minwholesaleamount<>"" then minpurchaseamount=minwholesaleamount if minwholesalemessage<>"" then minpurchasemessage=minwholesalemessage end if end if %> <% if totalgoods <% else %> <% if paypalexpress then %> <% end if end if%>
<%=minpurchasemessage%>
<%=xxPrsChk%>
<%=xxPPPBlu%>
<% end if cnn.Close set rs = nothing set rs2 = nothing set cnn = nothing %>