<% ' 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") 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") pOffLineCardsAccepted = getSettingKey("pOffLineCardsAccepted") pHeaderKeywords = getSettingKey("pHeaderKeywords") pAuctions = getSettingKey("pAuctions") pListBestSellers = getSettingKey("pListBestSellers") pNewsLetter = getSettingKey("pNewsLetter") pPriceList = getSettingKey("pPriceList") pStoreNews = getSettingKey("pStoreNews") pUseShippingAddress = getSettingKey("pUseShippingAddress") pShippingTaxable = getSettingKey("pShippingTaxable") pTaxIncluded = getSettingKey("pTaxIncluded") pShowNews = getSettingKey("pShowNews") pPaymentSurcharge = 0 pBonusPoints = 0 pIdDbSession = checkSessionData() pIdDbSessionCart = checkDbSessionCartOpen() pIdCustomer = getSessionVariable("idCustomer",0) pIdCustomerType = getSessionVariable("idCustomerType",1) pDiscountCode = getSessionVariable("discountCode","") ' get shipping and payment selection pIdShipmentArray = getUserInput(request.form("idShipmentArray"),20) pIdPaymentArray = getUserInput(request.form("idPaymentArray"),20) pComments = getUserInput(request.form("comments"),500) pVatNumber = getUserInput(request.form("vatNumber"),30) pUser1 = getUserInput(request.form("user1"),50) pUser2 = getUserInput(request.form("user2"),50) pUser3 = getUserInput(request.form("user3"),50) ' verify required datak, if something is missing, redirect to checkout1 step if (pIdShipmentArray="" or pIdPaymentArray="" or isNumeric(pIdShipmentArray)=false or isNumeric(pIdPaymentArray)=false) and pByPassShipping="0" then response.redirect "comersus_supportError.asp?error="&Server.Urlencode("Missing or invalid Shipment array data in checkout3") end if 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 ' populate payments pArrayPaymentMethods = split(pStringPaymentMethods,"|") pArrayOnePayment = split(pArrayPaymentMethods(pIdPaymentArray),"&") pPaymentDescription = pArrayOnePayment(0) pPaymentSurcharge = pArrayOnePayment(1) pIdPayment = pArrayOnePayment(2) ' populate shipment methods from dbSessionCart if pByPassShipping="0" then mySQL="SELECT sessionData FROM dbSession WHERE idDbSession=" &pIdDbSession call getFromDatabase(mySQL, rstemp, "checkout3") if rstemp.eof then response.redirect "comersus_supportError.asp?error="&Server.Urlencode("Cannot get dbSession shipment data at checkout 3 for "&pIdDbSession) end if pStringShipmentMethods =rstemp("sessionData") ' verify shipment string array if pStringShipmentMethods="" then response.redirect "comersus_supportError.asp?error="&Server.Urlencode("There are no shipments available. Please contact us") end if if instr(pStringShipmentMethods,"|")=0 then response.redirect "comersus_checkout2.asp?time="&Time end if pArrayShipmentMethods = split(pStringShipmentMethods,"|") pArrayOneShipment = split(pArrayShipmentMethods(pIdShipmentArray),"&") ' verify shipment string array if uBound(pArrayOneShipment)<>2 then response.redirect "comersus_checkout2.asp?time="&Time end if pShipmentDescription = pArrayOneShipment(0) pShipmentCharge = Cdbl(pArrayOneShipment(1))+Cdbl(pArrayOneShipment(2)) else pShipmentDescription ="N/A" pShipmentCharge =0 end if ' get customer information mySQL="SELECT * FROM customers WHERE idCustomer=" &pIdCustomer call getFromDatabase(mySQL, rstemp, "orderVerify") if not rstemp.eof then pName = rstemp("name") pLastName = rstemp("lastName") pCustomerCompany = rstemp("customerCompany") pEmail = rstemp("email") pPassword = rstemp("password") pPhone = rstemp("phone") pAddress = rstemp("address") pZip = rstemp("zip") pStateCode = rstemp("stateCode") pState = rstemp("state") pCity = rstemp("city") pCountryCode = rstemp("countryCode") pShippingName = rstemp("shippingName") pShippingLastName = rstemp("shippingLastName") pShippingAddress = rstemp("shippingAddress") pShippingZip = rstemp("shippingZip") pShippingStateCode = rstemp("shippingStateCode") pShippingState = rstemp("shippingState") pShippingCity = rstemp("shippingCity") pShippingCountryCode = rstemp("shippingCountryCode") end if ' if cart has no items cancel the order if countCartRows(pIdDbSessionCart)=0 then response.redirect "comersus_supportError.asp?error="&Server.Urlencode("No items in cart at checkout3 step for customer with email "&pEmail) 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)) pDiscountDesc ="" pDiscountAmount =0 call getDiscount(pDiscountCode, pDiscountDesc, pDiscountAmount) ' bonus points if Cdbl(pBonusPointsPerPrice)>0 then pBonusPoints=getBonusPoints(pIdCustomer) if pBonusPoints>=pSubTotal-pDiscountAmount then pBonusPoints=pSubTotal-pDiscountAmount else pBonusPoints=0 end if pSubTotal=pSubTotal-pBonusPoints end if pTaxAmount = calculateTax(pShipmentCharge, pSubTotal, pVatNumber) pTotal = pSubTotal + pTaxAmount + pPaymentSurcharge + pShipmentCharge - pDiscountAmount if pPaymentSurcharge>0 then pPaymentDetails=pPaymentDescription & " " &getMsg(726,"surcharge")& " " & pCurrencySign &money(pPaymentSurcharge) else pPaymentDetails=pPaymentDescription end if pShipmentDetails=pShipmentDescription& " " &pCurrencySign & money(pShipmentCharge) ' save order data in dbSession pSessionData=pShipmentDetails&"||"&pPaymentDetails&"||"&pComments&"||"&pBonusPoints&"||"&pVatNumber&"||"&pUser1&"||"&pUser2&"||"&pUser3&"||"& pDiscountCode &"||"& pDiscountAmount &"||"& pTaxAmount &"||"& pTotal &"||" &pIdPayment mySQL="UPDATE dbSession set sessionData='" &pSessionData& "' WHERE idDbSession=" &pIdDbSession call updateDatabase(mySQL, rstemp, "orderVerify") %>
<% ' iterate through cart mySQL="SELECT idCartRow, cartRows.idProduct, quantity, unitPrice, description, sku, deliveringTime, personalizationDesc FROM cartRows, products WHERE cartRows.idProduct=products.idProduct AND cartRows.idDbSessionCart="&pIdDbSessionCart call getFromDatabase(mySQL, rstemp, "orderVerify") do while not rstemp.eof pIdCartRow = rstemp("idCartRow") pIdProduct = rstemp("idProduct") pQuantity = rstemp("quantity") pUnitPrice = Cdbl(rstemp("unitPrice")) pDescription = rstemp("description") pSku = rstemp("sku") pPersonalizationDesc = rstemp("personalizationDesc") %> <%rstemp.movenext loop%> <%if pDiscountCode<>"" then%> <%end if%> <%if pByPassShipping="0" then%> <%end if%> <%if pBonusPoints>0 then%> <%end if%> <%if isOffLinePayment(pIdPayment) then%> <%end if%>
 
<%=pCompany%>
<%=pCompanyAddress%>
<%=pCompanyCity&", "&pCompanyStateCode&" "& pCompanyZip &" "& pCompanyCountryCode%>



  <%=getMsg(447,"date")%>: <%=formatDate(fixDate(Date))%>

<%=getMsg(448,"name")%>: <%=pName&" "&pLastName%> - <%=getMsg(449,"cpany")%>: <%=pCustomerCompany%>
<%=getMsg(450,"phone")%>: <%=pPhone%>
<%=getMsg(451,"addr")%>: <%=pAddress%> <%=pCity%>, <%=pState & pStateCode%> <%=pZip%>  <%=pCountryCode%>
<%if pUseShippingAddress="-1" and pShippingAddress<>"" then%> <%if trim(pShippingAddress)="" then%> <%=getMsg(471,"ship address")%>: <%=getMsg(472,"same as bill")%> <%else%> <%=getMsg(471,"ship address")%>: (<%=pShippingName&" "&pShippingLastName%>) <%=pShippingAddress%> <%=pShippingCity%>, <%=pShippingState & pShippingStateCode%>  <%=pShippingZip%>  <%=pShippingCountryCode%> <%end if%> <%end if%>
<%=getMsg(452,"comments")%>: <%=pComments%> <%if pOrderFieldName1<>"" then%>
<%=pOrderFieldName1%>: <%=pUser1%> <%end if%> <%if pOrderFieldName2<>"" then%>
<%=pOrderFieldName2%>: <%=pUser2%> <%end if%> <%if pOrderFieldName3<>"" then%>
<%=pOrderFieldName3%>: <%=pUser3%> <%end if%>

<%=getMsg(453,"qty")%> <%=getMsg(454,"item")%> <%=getMsg(455,"variat")%> <%=getMsg(456,"price")%>
<%=pQuantity%> <%=pSku & " "&pDescription%> <%if pPersonalizationDesc<>"" then response.write " (" &pPersonalizationDesc& ")"%> <%=getCartRowOptionals(pIdCartRow)%> <%=pCurrencySign & money(getCartRowPrice(pIdCartRow)) %>

<%=getMsg(459,"disc")%> <%=pDiscountDesc%>
- <%=pCurrencySign & money(pDiscountAmount)%>
<%=getMsg(457,"payment")%> <%=pPaymentDescription%>
<%if pPaymentSurcharge>0 then response.write pCurrencySign & money(pPaymentSurcharge)%>
<%=getMsg(458,"ship method")%> <%=pShipmentDescription%> <%if Cdbl(pArrayOneShipment(2))>0 then%> + <%=getMsg(441,"handling")%> <%end if%>
<%=pCurrencySign & money(pShipmentCharge)%>
 
<%=getMsg(464,"bonus points")%>
- <%=pCurrencySign & money(pBonusPoints) %>  
 
<%=getMsg(465,"subtotal")%>
<%=pCurrencySign & money(pSubTotal-pDiscountAmount+pPaymentSurcharge+pShipmentCharge) %>  
 
<%=getMsg(473,"tax")%>
<%=pCurrencySign & money(pTaxAmount)%>  
 
<%=getMsg(466,"total")%>
<%=pCurrencySign & money(pTotal) %>  
<%if pStoreFrontDemoMode="-1" then%> <%else%> <%end if%> <%if pStoreFrontDemoMode="-1" then%> <%else%> <%end if%>
<%=getMsg(512,"type")%>
<%=getMsg(504,"number")%>
<%=getMsg(505,"expi")%> <%=getMsg(506,"month")%> <%=getMsg(507,"year")%>
<%=getMsg(508,"CVV2")%>
 
">
">

* <%=getMsg(469,"you have")%> <%=getMsg(470,"terms")%>


<%call closeDb()%>