% ' 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 %>
<%call closeDb()%>