<% ' Comersus Shopping Cart ' Comersus Open Technologies ' United States ' Software License can be found at License.txt ' http://www.comersus.com %> <% on error resume next dim mySQL, connTemp, rsTemp, rsTemp2, rsTemp3 ' get settings. pStoreFrontDemoMode = getSettingKey("pStoreFrontDemoMode") pCurrencySign = getSettingKey("pCurrencySign") pDecimalSign = getSettingKey("pDecimalSign") pMoneyDontRound = getSettingKey("pMoneyDontRound") pCompany = getSettingKey("pCompany") pCompanyCountryCode = getSettingKey("pCompanyCountryCode") pApplyGST = getSettingKey("pGST") pGSTRate = getSettingKey("pGSTRate") pCompanySlogan = getSettingKey("pCompanySlogan") pCompanyAddress = getSettingKey("pCompanyAddress") pCompanyZip = getSettingKey("pCompanyZip") pCompanyCity = getSettingKey("pCompanyCity") pCompanyStateCode = getSettingKey("pCompanyStateCode") pCompanyCountryCode = getSettingKey("pCompanyCountryCode") pCompanyPhone = getSettingKey("pCompanyPhone") pCompanyFax = getSettingKey("pCompanyFax") pChangeDecimalPoint = getSettingKey("pChangeDecimalPoint") pEncryptionMethod = getSettingKey("pEncryptionMethod") pOrderFieldName1 = getSettingKey("orderFieldName1") pOrderFieldName2 = getSettingKey("orderFieldName2") pOrderFieldName3 = getSettingKey("orderFieldName3") pDateSwitch = getSettingKey("pDateSwitch") pByPassShipping = getSettingKey("pByPassShipping") pBonusPointsPerPrice = getSettingKey("pBonusPointsPerPrice") pHeaderKeywords = getSettingKey("pHeaderKeywords") pAuctions = getSettingKey("pAuctions") pListBestSellers = getSettingKey("pListBestSellers") pNewsLetter = getSettingKey("pNewsLetter") pPriceList = getSettingKey("pPriceList") pStoreNews = getSettingKey("pStoreNews") pUseVatNumber = getSettingKey("pUseVatNumber") pShowNews = getSettingKey("pShowNews") pUseShippingAddress = getSettingKey("pUseShippingAddress") pStoreClosed = getSettingKey("pStoreClosed") pRealTimeShipping = getSettingKey("pRealTimeShipping") pAustPostShipping = getSettingKey("pAustPostShipping") pIdDbSession = checkSessionData() pIdDbSessionCart = checkDbSessionCartOpen() pIdCustomer = getSessionVariable("idCustomer",0) pIdCustomerType = getSessionVariable("idCustomerType",1) pDiscountCode = getSessionVariable("discountCode","") 'pTime = getUserInput(request.querystring("time"),12) ' if the store is closed it will not allow checkout. if pStoreClosed = "-1" then response.redirect "comersus_message.asp?message=" & Server.Urlencode(getMsg(391,"Sorry, your cannot checkout, the store is closed right now.")) end if if countCartRows(pIdDbSessionCart) = 0 then response.redirect "comersus_message.asp?message=" & Server.Urlencode(getMsg(392,"The cart is empty, you cannot checkout.")) end if if pIdCustomer = 0 then response.redirect "comersus_checkoutCustomerForm.asp" end if ' get customer information. mySQL = "SELECT * FROM customers WHERE idCustomer=" & pIdCustomer call getFromDatabase(mySQL, rstemp, "checkout2") if not rstemp.eof then pName = rstemp("name") pLastName = rstemp("lastName") pCustomerCompany = rstemp("customerCompany") pEmail = rstemp("email") pPassword = rstemp("password") pPhone = rstemp("phone") pShippingName = rstemp("shippingName") pShippingLastName = rstemp("shippingLastName") pAddress = rstemp("address") pZip = rstemp("zip") pStateCode = rstemp("stateCode") pState = rstemp("state") pCity = rstemp("city") pCountryCode = rstemp("countryCode") pShippingAddress = rstemp("shippingAddress") pShippingStateCode = rstemp("shippingStateCode") pShippingState = rstemp("shippingState") pShippingCity = rstemp("shippingCity") pShippingCountryCode = rstemp("shippingCountryCode") if trim(rstemp("shippingZip")) = "" or isNull(rstemp("shippingZip")) then pShippingPCode = rstemp("zip") else pShippingPCode = rstemp("shippingZip") end if end if if pShippingCountryCode <> "" then pFilterCountryCode = pShippingCountryCode else pFilterCountryCode = pCountryCode end if ' calculate total price of the order, total weight and product total quantities. pSubTotal = Cdbl(calculateCartTotal(pIdDbSessionCart)) pCartTotalWeight = Cdbl(calculateCartWeight(pIdDbSessionCart)) pCartQuantity = Cdbl(calculateCartQuantity(pIdDbSessionCart)) ' populate payment methods. pStringPaymentMethods = createArrayPayments(pCartQuantity, pCartTotalWeight, pSubTotal) if pStringPaymentMethods = "" then response.redirect "comersus_supportError.asp?error=" & Server.Urlencode("There are no payments available. Please contact us") end if pArrayPaymentMethods = split(pStringPaymentMethods,"|") ' populate shipment methods. ' calculate Free Shipping Items inside the cart. pCartFreeShippingTotal = Cdbl(calculateFreeShippingTotal(pIdDbSessionCart)) pCartFreeShippingWeight = Cdbl(calculateCartFreeShippingWeight(pIdDbSessionCart)) pCartFreeShippingQuantity = Cdbl(calculateCartFreeShippingQuantity(pIdDbSessionCart)) select Case lcase(pRealTimeShipping) case "ups" pStringShipmentMethods = createArrayShipmentsUps(pCartQuantity - pCartFreeShippingQuantity, pCartTotalWeight - pCartFreeShippingWeight, pSubTotal - pCartFreeShippingTotal) case "usps" if pFilterCountryCode = "US" then pStringShipmentMethods = createArrayShipmentsUsps(pCartQuantity - pCartFreeShippingQuantity, pCartTotalWeight - pCartFreeShippingWeight, pSubTotal - pCartFreeShippingTotal) else pStringShipmentMethods = createArrayShipmentsUspsInt(pCartQuantity - pCartFreeShippingQuantity, pCartTotalWeight - pCartFreeShippingWeight, pSubTotal - pCartFreeShippingTotal) end if case "intershipper" pStringShipmentMethods = createArrayShipmentsIntershipper(pCartQuantity - pCartFreeShippingQuantity, pCartTotalWeight - pCartFreeShippingWeight, pSubTotal - pCartFreeShippingTotal) case "fedex" pStringShipmentMethods = createArrayShipmentsFedex(pCartQuantity - pCartFreeShippingQuantity, pCartTotalWeight - pCartFreeShippingWeight, pSubTotal - pCartFreeShippingTotal) case "ca" pStringShipmentMethods = createArrayShipmentsCA(pCartQuantity - pCartFreeShippingQuantity, pCartTotalWeight - pCartFreeShippingWeight, pSubTotal - pCartFreeShippingTotal) case Else pStringShipmentMethods = createArrayShipments(pCartQuantity - pCartFreeShippingQuantity, pCartTotalWeight - pCartFreeShippingWeight, pSubTotal - pCartFreeShippingTotal) end Select if pStringShipmentMethods = "" then response.redirect "comersus_supportError.asp?error=" & Server.Urlencode("There are no shipments available. Please contact us") end if pArrayShipmentMethods = split(pStringShipmentMethods,"|") ' retrieve Australia Post Shipping. if request("pFreightCode") = "" then pAustPostServiceType = "STANDARD" else pAustPostServiceType = request("pFreightCode") end if ' retrieve discount. pDiscountDesc = "" pDiscountAmount = 0 call getDiscount(pDiscountCode, pDiscountDesc, pDiscountAmount) pSubTotal = pSubTotal - pDiscountAmount %>
<%=getMsg(58,"checkout")%>
<%if pTime <> "" then%>

<%=getMsg(681,"Reloaded")%><%end if%>
<%if pCustomerCompany <> "" then%> <%end if%>
<%=getMsg(411,"billing")%>
<%=getMsg(448,"name")%> : <%=pName&" "&pLastName%>
<%=getMsg(449,"cpany")%> : <%=pCustomerCompany%>
<%=getMsg(450,"phone")%> : <%=pPhone%>
<%=getMsg(451,"addr")%> : <%=pAddress%>
<%=pCity%>, <%=pState & pStateCode%> <%=pZip%>
<%=getCountryName(pCountryCode)%>
[<%=getMsg(185,"modify")%>]
<%if pUseShippingAddress = "-1" and pByPassShipping = "0" then%> <%if trim(pShippingAddress) = "" or isNull(pShippingAddress) then%> <%else%> <%end if%>

<%=getMsg(420,"shipping")%>
<%=getMsg(471,"ship address")%> : <%=getMsg(472,"same as bill")%>
<%=getMsg(448,"name")%> : <%=pShippingName & " " & pShippingLastName%>
<%=getMsg(471,"ship address")%> : <%=pShippingAddress%>
<%=pShippingCity%>, <%=pShippingState & pShippingStateCode%> <%=pShippingZip%>
<%=getCountryName(pShippingCountryCode)%>
[<%=getMsg(185,"modify")%>]
<%end if%> <%if pCompanyCountryCode = "AU" and pApplyGST = "-1" then%> <%end if%> <% ' iterate through cart. mySQL = "SELECT idCartRow, cartRows.idProduct, quantity, unitPrice, unitGST, unitWeight, description, sku, deliveringTime, personalizationDesc FROM cartRows, products WHERE cartRows.idProduct=products.idProduct AND cartRows.idDbSessionCart=" & pIdDbSessionCart call getFromDatabase(mySQL, rstemp, "checkout2") do while not rstemp.eof pIdCartRow = rstemp("idCartRow") pIdProduct = rstemp("idProduct") pQuantity = rstemp("quantity") pUnitPrice = Cdbl(rstemp("unitPrice")) pUnitGST = Cdbl(rstemp("unitGST")) pUnitWeight = rstemp("unitWeight") pDescription = rstemp("description") pSku = rstemp("sku") pPersonalizationDesc = rstemp("personalizationDesc") %> <%if pCompanyCountryCode = "AU" and pApplyGST = "-1" then%> <%end if%> <% pTotalWeight = pTotalWeight + (pUnitWeight * pQuantity) rstemp.movenext loop %>

Order details
<%=getMsg(453,"qty")%>
<%=getMsg(454,"item")%>
<%=getMsg(455,"variat")%>
<%=getMsg(456,"price")%>
GST
Total
<%=pQuantity%> <%=pSku & " " & pDescription%> <%if pPersonalizationDesc <> "" then response.write " (" & pPersonalizationDesc & ")" end if%> <%=getCartRowOptionals(pIdCartRow)%>
<%=pCurrencySign & money(getCartRowPrice(pIdCartRow))%>
<%if pUnitGST <> 0 then%> <%=pCurrencySign & money(getCartRowPrice(pIdCartRow) * pGSTRate)%> <%else%> <%pGSTRate = 0%> Exempt <%end if%>
<%=pCurrencySign & money(getCartRowPrice(pIdCartRow) + money(getCartRowPrice(pIdCartRow) * pGSTRate))%>
[<%=getMsg(185,"modify")%>]

<%=getMsg(459,"discount")%>
:
<%=pCurrencySign & money(pDiscountAmount)%>
<%if Cdbl(pBonusPointsPerPrice)>0 then%>
<%pBonusPoints = getBonusPoints(pIdCustomer) if pBonusPoints >= pSubTotal - pDiscountAmount then pBonusPoints = pSubTotal - pDiscountAmount else pBonusPoints = 0 end if pSubTotal = pSubTotal - pBonusPoints%>
<%=getMsg(464,"points")%> - <%=pCurrencySign & money(pBonusPoints)%>
<%end if%>
<%=getMsg(465,"subtotal")%>
:
<%=pCurrencySign & money(pSubTotal)%>
<%if pAustPostShipping <> "0" then%> <% response.Buffer = true dim xmlhttp dim sURL dim qs dim sMethod dim pos1, pos2, charge, days, msg, str sURL = "http://drc.edeliver.com.au/rateCalc.asp?Height=100&Length=100&Weight=" & (pTotalWeight * 1000) & "&Width=100&Pickup_postcode=2446&Destination_Postcode=" & pShippingPCode & "&Country=AU&Service_Type=" & pAustPostServiceType & "&Quantity=1" sMethod = "GET" ' Create an xmlhttp object: set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP") ' Or, for version 3.0 of XMLHTTP, use: ' Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP") ' Opens the connection to the remote server. xmlhttp.Open sMethod, sURL, false ' Actually Sends the request and returns the data: xmlhttp.Send ' Parse the results. if (xmlhttp.readyState = 4 and xmlhttp.status = 200) then str = xmlhttp.responseText pos1 = instr(1,str,"charge=") + 7 pos2 = instr(1,str,"days=") - 1 charge = Cdbl(mid(str,pos1, pos2-pos1)) pos1 = instr(1,str,"days=") + 5 pos2 = instr(1,str,"err_msg=") - 1 days = mid(str,pos1, pos2-pos1) pos1 = instr(1,str,"err_msg=") + 8 pos2 = instr(1,str,chr(13)) - 1 msg = mid(str,pos1,pos2) else 'report error' response.write(xmlhttp.responseText) end if set xmlhttp = Nothing %>

Freight details
Australia Post <%=pAustPostServiceType%>
:
<%=pCurrencySign & formatnumber(money(charge),2)%>
Expected delivery period : <%=days%> working days.
[<%=getMsg(185,"modify")%>]
<%else%> <%if pByPassShipping = "0" then%>
<%=getMsg(458,"ship method")%> <%=pShipmentDesc%>
<%end if%> <%end if%>

<%=getMsg(457,"payment")%> <%=pPaymentDesc%>
<%if pUseVatNumber = "-1" then%>
<%=getMsg(733,"VAT")%>
<%end if%> <%if pOrderFieldName1 <> "" then%>
<%=pOrderFieldName1%>
<%end if%> <%if pOrderFieldName2 <> "" then%>
<%=pOrderFieldName2%>
<%end if%> <%if pOrderFieldName3 <> "" then%>
<%=pOrderFieldName3%>
<%end if%>
<%=getMsg(444,"comments")%>
<%if pAustPostShipping <> "0" then%>

<%=pCompany%> accepts responsibility for any loss of, damage to, late delivery or non-delivery of goods ordered from our web site.

To the maximum extent permitted by law, you agree to release our carriers from any liability relating to loss of, damage to, late delivery or non-delivery of any goods you order from this web site and to assign all rights to claim compensation or insurance against our carriers to us and expressly and irrevocably do so by clicking the following box.

In rural and regional areas of Australia, delivery times for Express Parcel Services are in respect of delivery to the Post Office of the principal township in that area. Delivery to final destinations may take longer. If in doubt please check with your local Post Office.
<%end if%>

">
<%call closeDb()%>