<% ' Comersus Sophisticated Cart ' Comersus Open Technologies ' USA - 2006 ' http://www.comersus.com ' Details: payment method functions %> <% function createArrayPayments(pCartQuantity, pCartTotalWeight, pSubTotal) ' retrieve available payment methods, load a string array with | as row separator dim mySQL, rstemp, pPaymentSurchargeAmount pIdCustomerType = getSessionVariable("idCustomerType",1) createArrayPayments ="" mySQL="SELECT idPayment, paymentDesc, priceToAdd, percentageToAdd, redirectionUrl, emailText, quantityFrom, quantityUntil, priceFrom, priceUntil, weightFrom, weightUntil FROM payments WHERE (idCustomerType=" &pIdCustomerType& " OR idCustomerType IS NULL OR idCustomerType=0) AND idStore=" &pIdStore& " ORDER by paymentDesc" call getFromDatabase(mySQL, rstemp, "orderForm") if rstemp.eof then response.redirect "comersus_supportError.asp?error="&Server.Urlencode("There are no payments in database") end if do until rstemp.eof pDbquantityFrom = Cdbl(rstemp("quantityFrom")) pDbquantityUntil = Cdbl(rstemp("quantityUntil")) pDbpriceFrom = Cdbl(rstemp("priceFrom")) pDbpriceUntil = Cdbl(rstemp("priceUntil")) pDbweightFrom = Cdbl(rstemp("weightFrom")) pDbweightUntil = Cdbl(rstemp("weightUntil")) ' insert if all rules are ok if pCartQuantity>=pDbquantityFrom and pCartQuantity<=pDbquantityUntil and pCartTotalWeight>=pDbweightFrom and pCartTotalWeight<=pDbweightUntil and pSubTotal>=pDbpriceFrom and pSubTotal<=pDbpriceUntil then pPaymentSurchargeAmount =Cdbl(rstemp("priceToAdd")) + Cdbl(rstemp("percentageToAdd"))*pSubTotal/100 createArrayPayments =createArrayPayments&rstemp("paymentDesc")&"&"&pPaymentSurchargeAmount&"&"&rstemp("idPayment")&"|" end if rstemp.movenext loop end function function isOffLinePayment(pIdPayment) dim rstemp, mysql mySQL="SELECT redirectionUrl FROM payments WHERE idPayment=" &pIdPayment call getFromDatabase(mySQL, rstemp, "isOffLinePayment") isOffLinePayment=0 if not rstemp.eof then if instr(rstemp("redirectionUrl"),"offLinePaymentForm.asp")<>0 then isOffLinePayment=-1 end if end if end function %>