"
Else
arrCart = Split(request.cookies(cartCookieName),vbCrLf)
Dim varSubTotal
varNum = 0
shippingTotal = 0
totalWeight = 0
totalPrice = 0
totalQty = 0
shipHold = False
suppliers = ""
'Get Real-Time Shipping
If regShipType = "1" Then
If shipZip = "" Then
shipHold = True
Else
For Each i in arrCart
If i <> "" AND NOT shipHold Then
arrEntry = Split(i,"|")
Set temp = conn.execute("SELECT supplier, shipHold FROM prodOptions INNER JOIN products ON products.id = prodOptions.prodID WHERE products.id = " & arrEntry(0))
If temp.eof Then response.redirect "rcCart.asp?empty=true"
If temp(1) Then shipHold = True
If inStr(suppliers, temp(0) & ", ") = 0 Then suppliers = suppliers & temp(0) & ", "
temp.close
End If
Next
For Each supplierID in Split(suppliers,", ")
totalWeight = 0
groundCost = 0
If supplierID <> "" AND NOT shipHold Then
For Each i in arrCart
If i <> "" AND NOT shipHold Then
arrEntry = Split(i,"|")
Set temp = conn.execute("SELECT weight, groundPrice, groundCost, shipHold FROM products INNER JOIN prodOptions on products.id = prodOptions.prodID WHERE id = " & arrEntry(0) & " AND supplier = " & supplierID)
If Not temp.eof Then
If temp(3) Then shipHold = True
If temp(1) Then groundCost = groundCost + (temp(2) * arrEntry(1)) Else totalWeight = totalWeight + ((temp(0) / 16) * arrEntry(1))
End If
temp.Close
End If
Next
If Not shipHold Then
Set realTime = Server.CreateObject("iisCartShip.ship")
Set temp = conn.execute("SELECT * FROM suppliers WHERE id = " & supplierID)
shipCountry = temp("sCountry")
shipCalc = ""
If temp("sFedEx") Then shipCalc = shipCalc & ", FEDEX"
If temp("sUPS") Then shipCalc = shipCalc & ", UPS"
If temp("sUSPS") Then shipCalc = shipCalc & ", USPS"
If temp("sDHL") Then shipCalc = shipCalc & ", DHL"
totalWeight = Round(totalWeight,0)
If groundCost = 0 AND totalWeight = 0 Then totalWeight = 1
If inStr(shipCalc,"USPS") > 0 Then maxWeight = 70 Else maxWeight = 150
If totalWeight > maxWeight Then shipHold = True
If shipCalc = "" Then shipHold = True
realTime.sort = "price,false"
realTime.timeOut = "10"
realTime.weight = totalWeight
realTime.origPostal = temp("sZip")
realTime.destPostal = shipZip
realTime.origCountry = shipCountry
realTime.destCountry = shipCountry
realTime.FDXGround = temp("FDXGround")
realTime.FDXPick = temp("FDXPick")
realTime.FDXPack = temp("FDXPack")
realTime.UPSPick = temp("UPSPick")
realTime.UPSPack = temp("UPSPack")
realTime.USPSlogin = USPSusername & "," & USPSpassword
realTime.UPSlogin = UPSusername & "," & UPSpassword & "," & UPSaccesskey
temp.Close
If totalWeight > 0 Then realTime.shipCalc(Mid(shipCalc,3))
num = 0
'If realTime.error <> "" Then shipHold = True
shipName = "Estimated Shipping"
For Each Service In realTime.shipInfo
If num = 0 Then
totalCharge = Service.cTotalCharge
cSingleService = Replace(Replace(Service.cSingleService,"FedEx","")," "," ")
If inStr(regShipAdjust,"%") > 0 Then
regShipAdjust = Replace(regShipAdjust,"%","")
If Not isNumeric(regShipAdjust) Then regShipAdjust = 0
totalCharge = totalCharge + (Round(totalCharge * Round((.01 * Round(Replace(regShipAdjust,"%",""),2)),2),2))
Else
regShipAdjust = Replace(regShipAdjust,"$","")
If Not isNumeric(regShipAdjust) Then regShipAdjust = 0
totalCharge = totalCharge + Round(regShipAdjust,2)
End If
shippingTotal = shippingTotal + totalCharge
End If
num = num + 1
Next
If num = 0 AND shippingTotal = 0 AND groundCost = 0 Then shipHold = True
Set realTime = Nothing
End If
shippingTotal = shippingTotal + groundCost
End If
Next
End If
'Get RocketCart Shipping
Else
Set temp = conn.execute("SELECT TOP 1 shipClass.id, calcType, className FROM shipClass INNER JOIN country ON country.shippingZone = shipClass.shippingZone WHERE country.cDefault <> 0 ORDER BY sortNum")
If temp.eof Then
shipHold = True
Else
classID = temp(0)
calcType = temp(1)
shipName = "Estimated Shipping: " & temp(2)
End If
temp.Close
For Each i in arrCart
If i <> "" AND NOT shipHold Then
arrEntry = Split(i,"|")
Set temp = conn.execute("SELECT shipHold, weight, groundPrice, groundCost FROM prodOptions WHERE prodID = " & arrEntry(0))
If temp.eof Then response.redirect "rcCart.asp?empty=true"
If temp(0) Then shipHold = True
If temp(2) Then
groundShip = groundShip + (temp(3) * arrEntry(1))
Else
totalWeight = totalWeight + (cCur(temp(1)) * arrEntry(1))
totalPrice = totalPrice + (arrEntry(2) * arrEntry(1))
totalQty = totalQty + arrEntry(1)
End If
temp.Close
End If
Next
If calcType = 0 Then varChecker = totalPrice
If calcType = 1 Then varChecker = Round(totalWeight / 16,0)
If calcType = 2 Then varChecker = totalQty
Set temp = conn.execute("SELECT shipPrice FROM shipRange WHERE shipClass = " & classID & " AND rangeLow <= " & Round(varChecker,0) & " AND rangeHigh >= " & Round(varChecker,0))
If temp.eof Then Set temp = conn.execute("SELECT TOP 1 shipPrice FROM shipRange WHERE shipClass = " & classID & " ORDER BY rangeHigh DESC")
If temp.eof Then shipHold = True Else shippingTotal = temp(0)
shippingTotal = shippingTotal + groundCost
temp.Close
End If
'Write Out Each Item
For Each i in arrCart
If i <> "" Then
arrEntry = Split(i,"|")
Set val = conn.execute("SELECT prodName, (SELECT mName FROM manufacturers WHERE id <> 1 AND id = products.manu) FROM products WHERE id = " & arrEntry(0))
If Not val.eof Then
varProdName = val(0)
varQty = arrEntry(1)
varPrice = FormatCurrency(arrEntry(2),2)
If arrEntry(3) <> "" Then varVars = " " & arrEntry(3)
manu = val(1)
If Not isNull(manu) AND manu <> "" AND regManuShow Then varManu = manu & " " Else varManu = ""
%>
|