<%Response.buffer=TRUE%> <% ' VP-ASP Shopping Cart Database Configuration 6.50.4 const xDatabase="CDM_Doro03" 'Database name const xdblocation="SQLSERVER" 'location of database relative to VP-ASP files 'NOTE - XDATABASETYPE SHOULD BE ENTERED IN UPPER CASE LETTERS const xdatabasetype="SQLSERVER" ' Database type: leave empty for Access or change to one of the options shown below 'const xdatabasetype="ODBC" 'const xdatabasetype="DRIVE" 'const xdatabasetype="SQLSERVER" 'const xdatabasetype="MYSQL" 'const xdatabasetype="MYSQL351" 'const xdatabasetype="ACCESS2007" const xSQLUser="Sean03" ' SQL Server user const xSQLPwd="Doro6397" ' SQL Server password const xSQLServer="65.17.239.1" '74.118.64.180" '64.125.149.205" ' SQL Server name or IP address ' const xshopid="shop650Doro" 'Must be changed - needs to be a unique name for your shop - eg. "shop650_myshopname" const xordernumber="40760-7" ' const xcheckout = "pfphpshopcheckout.asp" 'anaimshopcheckout.asp" 'Specify a particular electronic payment add-on here. 'The default is to use standard VP-ASP shopcheckout.asp 'If you have a VP-ASP electronic payment add-on for example, Eway, then enter ewayshopcheckout.asp const xssl = "https://www.doropaintball.com/AB1038101Equick" 'This is your secure URL to which credit card information is encrypted. 'In many cases it is simply your own URL with an 's' added to HTTP. 'If you are unsure, check with your ISP. const xmysite = "http://www.doropaintball.com/AB1038101Equick" 'This represents the URL of your site where the shopping cart files are located (eg. http://www.yourvpaspwebsiteurl.com/vpasp) const xencryptkey = "DPBbAhjBcG" 'enter an encryption key here for greater security const xmailusername = "" 'If you are using CDOSYS as your email system it requires a username, enter it here const xmailpassword = "" 'If you are using CDOSYS as your email system it requires a password, enter it here ' const xconfigtable="configuration" const xproductmatch="" ' display products matching these %> <% const xvpaspversion = "6.50.4" const xvpasppackage = "PLUS" sub versioning%> <%end sub %> <% ' BYZ: 11-DEC-2009: Declaration of BigYellowZone.com ' customer/global/admin variables: %> <% ' Global variable declaration (Dim) files (shared on both the customer and admin side) ' will be included at the bottom of this file ' as/when additional relevant BigYellowZone.com modules get installed. %> <% Dim byz_addondatabasetype Dim byz_shopfileio_included_flag Dim byz_sys_vpasp_virtual_folder %> <% ' Customer-Side variable declaration (Dim) files will be included at the bottom of this file ' as/when additional relevant BigYellowZone.com modules get installed. %> <% ' Admin variable declaration (Dim) files will be included at the bottom of this file ' as/when additional relevant BigYellowZone.com modules get installed. %> <% Const Langnodbvalue="**nodb**" 'VP-ASP 6.08b - unknown lang fix dim restarttrap '********************************************************* ' Makes sure application variables are always loaded ' VP-ASP 6.0 configuration initialization ' Languages can remain files or be in the database ' If they are not in the database, the caption has one value **nodb** ' Fix for unknown lang Changed line 15 to check for test ' April 15, 2006 getlang and getconfig now both test to see if system ' has been initialized. If not they try to do it. This ' should eliminate getlang and invalid config options '******************************************************** ' Sub ShopInitApplication dim dbc, csql, i, howmanyfields, rstemp dim fieldname, fieldvalue fieldname="Init" & "_" & xshopid if Application(fieldname)="Yes" then exit sub Application(fieldname)="No" If getsess("diagnostic")="Yes" then exit sub LoadApplicationVariables end sub ' Sub LoadApplicationVariables dim dbc,csql,rstemp ,fieldname,fieldvalue dim tempname Setsess "db",xdatabase OpenOtherDatabase dbc, xdatabase, xdblocation, xdatabasetype If dbc.state<>adStateOpen then exit sub end if 'VP-ASP 6.09 - check if the database has been created before initializing variables dim dbtestrs if ucase(xdatabasetype) = "SQLSERVER" then set dbtestrs = dbc.execute("select * from sysobjects where name='" & xconfigtable & "'") if dbtestrs.eof then set dbtestrs = nothing exit sub else set dbtestrs = nothing end if elseif ucase(xdatabasetype) = "MYSQL" OR ucase(xdatabasetype) = "MYSQL351" then set dbtestrs = dbc.execute("show tables like '" & xconfigtable & "'") if dbtestrs.eof then set dbtestrs = nothing exit sub else set dbtestrs = nothing end if end if 'End update csql="select * from " & xconfigtable & " order by fieldname" set rstemp=dbc.execute(csql) Application.Lock setconfig "InitTime",date() & " " & time() do while NoT rstemp.eof fieldname = rstemp("fieldname") fieldvalue= rstemp("fieldvalue") If isnull(fieldvalue) then fieldvalue="" end if tempname=fieldname & "_" & xshopid Application(tempname) = fieldvalue rstemp.movenext loop fieldname="Init" & "_" & xshopid Application(fieldname)= "Yes" setconfig "InitTime",date() & " " & time() Application.UnLock rstemp.close set rstemp=nothing shopclosedatabase dbc LoadLanguagevariables End sub ' Function GetConfig (fieldname) 'VP-ASP 6.08b - unknown lang fix checksystemrestart dim tempname tempname=fieldname & "_" & xshopid if lcase(fieldname) = "xmysite" then 'VP-ASP 6.50 - if xmysite is defined in shop$config.asp use that instead of value from database if xmysite > "" then Application(tempname) = xmysite end if if (Application(tempname) > "") AND (Application(tempname) <> " ") then 'VP-ASP 6.09 - added / to end of xmysite if right(Application(tempname), 1) <> "/" then Application(tempname) = Application(tempname) & "/" end if end if dim SSL SSL = Request.ServerVariables("HTTPS") If Ucase(SSL) = "ON" Then GetConfig=replace(Application(tempname), "http:", "https:") else GetConfig=Application(tempname) end if 'VP-ASP 6.50 - handle xssl the same way as xmysite elseif lcase(fieldname) = "xssl" then if xssl > "" then Application(tempname) = xssl end if if (Application(tempname) > "") AND (Application(tempname) <> " ") then if right(Application(tempname), 1) <> "/" then Application(tempname) = Application(tempname) & "/" end if end if 'VP-ASP 6.5.1 - return SSL URL GetConfig=Application(tempname) else GetConfig=Application(tempname) end if end function ' '******************************************************************* ' all languages now in application variables ' either default language or session language '******************************************************************* Function GetLang (fieldname) dim tempname, tempvalue, tempnamesess 'VP-ASP 6.08b - unknown lang fix dim rvalue, rc checksystemrestart tempname=fieldname & "_" & xshopid If Getsess("languagesession")<>"" Then tempnamesess=fieldname & "_" & Getsess("languagesession") & "_" & xshopid tempvalue=application(tempnamesess) If tempvalue="" then tempvalue=Application(tempname) if tempvalue="" then tempvalue="Unknown " & fieldname end if end if getlang=tempvalue exit function end if tempvalue=Application(tempname) If tempvalue="" then tempvalue="unknown " & fieldname end if getlang=tempvalue end function Function SetConfig (fieldname, value) dim tempname tempname=fieldname & "_" & xshopid Application(tempname)=value end function Function Setlang (fieldname, value) dim tempname tempname=fieldname & "_" & xshopid Application(tempname)=value end function Sub LoadLanguageVariables dim dbc,csql,rstemp ,fieldname,fieldvalue dim tempname, language language=getsess("language") if language="" then language=getconfig("xlanguage") end if if language="" then exit sub OpenOtherDatabase dbc, xdatabase, xdblocation, xdatabasetype If dbc.state<>adStateOpen then exit sub end if dim lang, filename csql="select * from languages where lang='" & language & "'" set rstemp=dbc.execute(csql) If not rstemp.eof then fieldvalue= rstemp("caption") If fieldvalue=Langnodbvalue then filename=rstemp("keyword") closerecordset rstemp shopclosedatabase dbc LoadLanguageVariablesNodb language, filename exit sub end if end if Application.Lock do while NoT rstemp.eof fieldname = rstemp("keyword") fieldvalue= rstemp("caption") If isnull(fieldvalue) then fieldvalue="" end if If fieldvalue<>"" Then tempname=fieldname & "_" & xshopid Application(tempname) = fieldvalue end if rstemp.movenext loop Application.UnLock rstemp.close set rstemp=nothing shopclosedatabase dbc End sub '************************************************************************* ' we are to read language files instead of the database ' shop$language_xxxxxxx.asp and shop$language2_xxxxxxxxx.asp '*********************************************************************** Sub LoadLanguageVariablesNodb (language, filename) dim fieldnames(1000),fieldvalues(1000),fieldcount dim strfilename, strfilename2, i dim tempname, fieldname, fieldvalue If filename="" then strfilename="shop$language_" & language & ".asp" strfilename2="shop$language2_" & language & ".asp" else strfilename=filename strfilename2=filename strfilename2=replace(strfilename2,"$language","$language2") end if LanguageConvertFile strfilename, fieldnames,fieldvalues, fieldcount If fieldcount=0 then exit sub Application.Lock for i=0 to fieldcount-1 fieldname = fieldnames(i) fieldvalue= fieldvalues(i) If fieldvalue<>"" Then tempname=fieldname & "_" & xshopid Application(tempname) = fieldvalue end if next Application.UnLock fieldcount=0 LanguageConvertfile strfilename2, fieldnames,fieldvalues, fieldcount If fieldcount=0 then exit sub Application.Lock for i=0 to fieldcount-1 fieldname = fieldnames(i) fieldvalue= fieldvalues(i) If fieldvalue<>"" Then tempname=fieldname & "_" & xshopid Application(tempname) = fieldvalue end if next Application.UnLock end sub '************************************************************************* 'read language file '************************************************************************* Sub LanguageConvertFile (strfilename, fieldnames,fieldvalues, fieldcount) dim rc, whichfile, fsobj, recordobj, i, record, fieldname, fieldvalue Dim morecommands fieldcount=0 on error resume next whichfile=server.mappath(strfilename) set fsObj = Server.CreateObject("Scripting.FileSystemObject") set RecordObj= fsObj.OpenTextFile(whichfile, 1, False) If err.number > 0 then fsObj.close set fsObj=nothing setsess "Errlanguage","Failed to find file " & strfilename exit sub End if MoreCommands=True Do While MoreCommands=True if RecordObj.AtEndofStream then morecommands=false else record = RecordObj.readline LanguageVerifyrecord record, fieldname,fieldvalue, rc If rc=0 then fieldnames(fieldcount)=fieldname fieldvalues(fieldcount)=fieldvalue fieldcount=fieldcount+1 ' debugwrite "fieldname=" & fieldname & "fieldvalue=" & fieldvalue end if end if loop set RecordObj = nothing set fsObj = nothing end sub ' Sub LanguageVerifyrecord (record, fieldname, fieldvalue, rc) dim words(50),wordcount, values(50), valuecount, fieldtemp, remaining dim pos, firstchar, found rc=4 record=trim(record) Pos=instr(record,"=") if pos=0 then exit sub fieldtemp=mid(record,1,pos-1) fieldtemp=lcase(fieldtemp) parserecord fieldtemp, words, wordcount," " fieldname=words(0) pos=pos+1 Found=false Do while found=false firstchar=mid(record,pos,1) If firstchar="""" then found=true else pos=pos+1 end if loop remaining=len(record)-pos-1 fieldvalue=Mid(record,pos+1,remaining) 'debugwrite "name=" & fieldname & "(" & Fieldvalue & ") pos=" & pos & " rem=" & remaining rc=0 end sub 'VP-ASP 6.08b - unknown lang fix sub CheckSystemRestart if restarttrap<>"" then exit sub restarttrap="Yes" dim fieldname, fieldvalue fieldname="Init" & "_" & xshopid if Application(fieldname)="Yes" then exit sub shopinitapplication end sub %> <% ' VP-ASP 6.50 '******************************************************************** ' Used to modify tables ands fonts, search fields, ' product fields ' Nov 11, 2005 '******************************************************************** ' Forms Customers, checkout, status and loginforce const TableDef="" Const TableDefEnd="
" 'Const TableRow="" Const GiftTableDef="" Const GiftTableDefEnd="
" Const TableRow="" const TableRowEnd="" const TableColumn="" const tableColumnEnd="" Const xTableRowFont="" Const xTableRowFontEnd="" Const xTableRowColor="#FCFCFC" const TableDefLogin="" ' Reports reports const ReportTableDef="
" const ReportHeadRow="" Const ReportRowEnd="" const ReportHeadColumn="" const ReportDetailRow="" const ReportDetailColumn="" const ReportDetailRowX="" const ReportTableEnd="
" const ReportHeadColumnEnd="
" const reportDetailColumnEnd="
" const ReportInfoFont="" const ReportInfoFontEnd="" ' Categories const CatHeader="

" const CatRow="" Const CatColumn="

" Const CatTable="

" Const CatColumnEnd="

" ' ' SubCategories const SubCatHeader="

" const SubcatHeaderEnd="

" const SubCatRow="" Const SubCatColumn="

" const SubCatTable="

" Const SubCatColumnEnd="

" const SubCatSeparator=" --> " ' 'Products Const Prodheaderfont="" Const ProdTable="
" Const ProdHeaderRow="" Const ProdHeaderColumn="" const ProdColumn="" ' const ProdNameColumn="" const ProdDescriptionColumn="" ' Const ProdColumnFont="" Const ProdColumnPrice="" const ProdSelectColor="#FCFCFC" ' color for select column Const ProdButtonColumn="
" Const ProdRow="
" const ProdColumnEnd="" const ProdNameFont="" const ProdNameEnd="" const ProdDescriptionFont="" const ProdDescriptionEnd="" const ProdQuantityColumn="" const ProdQuantityEnd="" const ProdPriceEnd="" const ProdRetailPriceStart="
" Const ProdRetailPriceEnd="" const ProdOriginalPriceStart="
" Const ProdOriginalPriceEnd="" 'const ProdFeatureCaption="

" const ProdFeatureCaption="" 'Const ProdFeatureCaptionEnd="

" Const ProdFeatureCaptionEnd="
" ' Product Feature const FeatureUserText="
" const FeatureUserTextEnd="
" ' ' Shopcartformat Const CartHeaderfont="" Const CartHeaderEnd="" Const CartInfoFont="" Const CartInfoFontEnd="" Const Carttable="" Const CartTitleColumn="" Const CartRow="" 'Const CartRow="" 'Const CartSubtotalRowLeft="" Const CartTotalRowLeftEnd="" Const CartTotalRowRight="" const CartFontend="" Const CartFontDesc="" Const CartFontQuantity="" Const CartFontUnitPrice="" Const CartFontPriceTotal="" Const CartFontDualPrice="" Const CartFontDualTotal="" Const CartOriginalPrice="
(" Const CartOriginalPriceEnd=")" ' const FeatureBasePriceFont="
" const FeatureBasePriceEnd="" Const FeatureHeaderFont="" Const FeatureHeaderFontEnd="" const FeatureFont="" const FeatureFontEnd="" const FeaturePriceFont="" Const FeaturePriceEnd="" ' Customers const CustOutsideTableDef="
" Const CartTitleColumnEnd="
" Const CartSubtotalRowLeft="" Const CartSubTotalRowRight="" Const CartTotalRowLeft="" 'Const CartTotalRowLeftEnd="" Const CartTotalRowRightEnd="
" ' 'FormatOrder Details Const FOrderTable="" Const FOrderRow="" Const FOrderRowEnd="" Const FOrderHeaderColumn="" Const FOrderFieldRow="" ' customer details Const FOrderFieldLeft="" Const FOrderFieldRight="" ' info message Const FOrderInfo="

" Const FOrderInfoEnd="

" const FOrderNumber="" Const FOrderNumberEnd="" ' company details Const FOrderCompany="" const FOrderCompanyEnd="" Const FOrderComment="" Const ForderCommentend="" ' Const SearchKeywordTable="
" Const FOrderHeaderColumnEnd="
" Const FOrderFieldLeftEnd="" Const FOrderFieldRightEnd="
" Const SearchHeaderRow="
" Const SearchKeywordRow="
" Const SearchCatTable="" Const SearchCatHeaderLeft="" Const SearchCatRowEnd="" const SearchCatColumnStart="" const SearchSubcatColumnStart="" ' const Templatetable="
" Const SearchCatHeaderRight="" Const SearchCatRowStart="
" const SearchCatColumnEnd="" const SearchSubCatColumnEnd="
" const TemplateQuantityRow="" const TemplateQuantityColumn="" const TemplateButtonRow="" const TemplateButtonColumn="" const TemplateCheckboxColumn="" const TemplateFeaturesRow="" const TemplateFeaturesColumn="" ' 'ShopError const ErrorFontStart="" const ErrorFontEnd="" ' Stock low const OutOfStockColumn="" const SavedOrderFont="" ' EditDisplay const EditSpecialColumn="" end sub Sub loginlogouttoggle 'VP-ASP 6.08 - restore cookie if enabled so this displays correctly if getconfig("xcookielogin") = "Yes" then RestoreCustomerDetailsCookie end if if Getsess ("lastname") > "" then 'VP-ASP 6.50 - advanced session handling%> <%=getLang("langcommonlogout")%> <%else 'VP-ASP 6.50 - advanced session handling%> <%=getLang("langcommonlogin")%> <%end if End sub Sub welcomenote 'VP-ASP 6.08 - restore cookie if enabled so this displays correctly if getconfig("xcookielogin") = "Yes" then RestoreCustomerDetailsCookie end if if Getsess ("lastname") > "" then response.write getlang("langloggedinas") & " " & Getsess("Firstname") & " " & Getsess("lastname") & "
" response.Write "" & getlang("langcommonlogout") & "" else response.write getlang("langnotloggedin") & "
" response.Write "" & getlang("langcommonlogin") & "" end if end sub Sub DisplayIPAddress dim ipaddress ipaddress=request.servervariables("REMOTE_ADDR") If getconfig("xdisplayIPAddress")="Yes" then %>
" const TemplateQuantityColumnEnd="
" const TemplateCheckBoxRow="
" const TemplateCheckBoxColumnEnd="
" const TemplateFeaturesColumnEnd="" const OutOfStockColumnEnd="" const AddGeneralTable="" const EditSpecialColumnEnd="" const EditLinkColumn="" const EditFieldSpecial="" end if 'VP-ASP 6.50.4 - xlcid - remove redundant getconfig("xlcid") 'if getconfig("xLCID")<>"" then ' Session.LCID=getconfig("xLCID") ' set user supplied LCID 'end if total = 0 totalquantity=scartitem totalproductquantity=0 For i = 1 to scartItem Quantity =arrCart(cQuantity,i) Price=arrCart(cUnitPrice,i) dualprice=arrCart(cdualPrice,i) If dualprice="" then dualprice=0 Name=arrCart(cProductMiniName,i) if name="" then Name=arrCart(cProductName,i) end if dim nameconn2 shopopendatabaseP nameconn2 name=translatelanguage(nameconn2, "products", "cname","catalogid", arrCart(cProductid,i), name) shopclosedatabase nameconn2 subtotal=quantity*price dualsubtotal=quantity*dualprice Total=total+subtotal dualtotal=dualtotal+dualsubtotal totalproductquantity=totalproductquantity+quantity If showtype<>"SHORT" Then Price=shopformatcurrency(price,getconfig("xdecimalpoint")) response.write minirow Response.write MiniNameColumn & Minifont & name & minicolumnend Response.write MiniPricecolumn & MiniFont & quantity & minicolumnend If hideprice <> true then Response.write MiniPriceColumn & MiniFont & Price & minicolumnend Response.write MiniPriceColumn & Minifont & shopformatcurrency(subtotal,getconfig("xdecimalpoint")) & minicolumnend If getconfig("xdualprice")="Yes" then dualPrice=formatnumber(dualprice,getconfig("xdecimalpoint")) Response.write MiniPriceColumn & MiniFont & dualPrice & minicolumnend Response.write MiniPriceColumn & Minifont & ShopFormatDualCurrency(dualsubtotal,getconfig("xdecimalpoint")) & minicolumnend end if end if response.write "" end if next If showtype="SHORT" Then Response.write MinitableShort response.write MinititleRow response.write MiniPriceColumn & minifont & getlang("langProductQuantity") & Minifontend If hideprice <> True then response.write MiniPriceColumn & minifont & getlang("langProductPrice") & "" & Minifontend end if response.write "" response.write minirow Response.write MinipriceColumn & Minifont & totalproductquantity & Minicolumnend If hideprice <> true then Response.write MinipriceColumn & minifont & shopformatcurrency(total,getconfig("xdecimalpoint")) & Minicolumnend end if else If hideprice <> true then response.write "" response.write MiniPricecolumn & minifont & minifontend response.write MiniPriceColumn & minifont & shopformatcurrency(total,getconfig("xdecimalpoint")) & minifontend If getconfig("xdualprice")="Yes" then response.write "" & MiniPriceColumn & minifont & ShopFormatDualCurrency(dualtotal,getconfig("xdecimalpoint")) & minifontend end if end if end if response.write "
" Const EditLinkColumnEnd="" ' Navigation const PageNavTable="" const PageNavRow="" const PageNavColumn="
" const PageNavFont="" const PageNavFontEnd="" const PageNavTableEnd="
" ' Customer Admin const CustAdminTable="" Const CustAdminHeaderRow="" const CustadminRow="" Const CustAdminNumColumn="" const CustAdminColumn="" ' Product Options const DeliveryFont="" const DeliveryFontEnd="" ' ' Other fields for Customers table ' Const CartFeatureCaption="" Const CartFeatureCaptionEnd="" ' Shopreview fonts const ReviewHyperlinkFont="" const ReviewHyperlinkFontEnd="" const ReviewHeader="

" const ReviewHeaderEnd="

" Sub SetupProductFields (ProdFields, ProdHeaders) dim words(20),wordcount, langs(20),langcount dim record,captions, capprefix record=getconfig("xproductfields") captions=getconfig("xproductcaptions") parserecord record, words,wordcount,"," parserecord captions, langs,wordcount,"," redim prodfields(wordcount-1) redim prodheaders(wordcount-1) for i = 0 to wordcount-1 Prodfields(i)=words(i) capprefix=lcase(left(langs(i),4)) if capprefix="lang" then prodheaders(i)=getlang(langs(i)) else prodheaders(i)=langs(i) end if next end sub ' Version 4.0 const Minitable="
" const CustAdminHeaderFont="

" const CUstAdminHeaderEnd="

" const CustAdminNumEnd="

" const CustAdminFont="" const CustAdminColumnEnd="

" Const MinititleRow="" const MiniTitleFont="" const MiniFont="" const MiniNameTitleColumn="" const MiniFontEnd="" const MiniRow="" ' const NavCatTable="
" const MiniNameColumn="" const MiniPriceColumn="" const MiniColumnend="
" const Navcatrow="" const NavCatColumn="" Sub SetupProjectFields (ProjFields, ProjHeaders) ProjFields=Array("pid","customer","description") ProjHeaders=Array(Getlang("langProjectNumber"), getlang("Langcommonname"),getlang("LangProductDescription")) end sub ' VP-ASP 4.50 additions const catmemostart="

" const catmemoend="

" const productfilteringtable="
" Const NavCatColumnEnd="
" const ProductFilteringRow="" const productfilteringcolumn="" ' VP-ASP 5.0 const FrontRow="" Const FrontColumn="

" const productfilteringcolumnend="

" Const FrontTable="" Const FrontColumnEnd="" const FrontRowEnd="" Const SmallinfoFont="" Const SmallinfoEnd="" Const LargeinfoFont="" Const LargeinfoEnd="" const ProdSpecialColor="" const ProdSpecialEnd="" Const ProdHeaderColumnEnd="

" Const CatHeaderEnd="" const Prodheaderfontend="" const MinitableShort="
" ' VP-ASP 5.50 const ReportdetailRowUnpaid="" 'VP-ASP 6.50 Const FOrderHeaderColumnNoSpan="" 'Response.write tablecolumn response.write "" Response.write tablecolumn %> <% Response.write tablecolumnend & tableRowend end sub '****************************************************************** ' used in the admin section to create a text form box '******************************************************************* Sub FormatEditRow (caption,fieldname,fieldvalue) if fieldvalue > "" then fieldvalue = Replace(fieldvalue,"""",""") end if dim capdisplay capdisplay=caption if capdisplay="" then capdisplay=fieldname end if Response.Write TableRow Response.write TableColumn & capdisplay & TableColumnEnd Response.write TableColumn & "" & vbcrlf Response.write tableColumnEnd Response.write TableRowEnd end sub Sub FormatEditRowBoolean (caption,fieldname,fieldvalue, Yesnos, Yesnocount)',helpfile) dim capdisplay capdisplay=caption if capdisplay="" then capdisplay=fieldname end if Response.Write TableRow Response.write "" Response.write "
" %> <% ' ' ADO constants include file for VBScript ' '-------------------------------------------------------------------- '---- CursorTypeEnum Values ---- Const adOpenForwardOnly = 0 Const adOpenKeyset = 1 Const adOpenDynamic = 2 Const adOpenStatic = 3 '---- CursorOptionEnum Values ---- Const adHoldRecords = &H00000100 Const adMovePrevious = &H00000200 Const adAddNew = &H01000400 Const adDelete = &H01000800 Const adUpdate = &H01008000 Const adBookmark = &H00002000 Const adApproxPosition = &H00004000 Const adUpdateBatch = &H00010000 Const adResync = &H00020000 Const adNotify = &H00040000 '---- LockTypeEnum Values ---- Const adLockReadOnly = 1 Const adLockPessimistic = 2 Const adLockOptimistic = 3 Const adLockBatchOptimistic = 4 '---- ExecuteOptionEnum Values ---- Const adRunAsync = &H00000010 '---- ObjectStateEnum Values ---- Const adStateClosed = &H00000000 Const adStateOpen = &H00000001 Const adStateConnecting = &H00000002 Const adStateExecuting = &H00000004 '---- CursorLocationEnum Values ---- Const adUseServer = 2 Const adUseClient = 3 '---- DataTypeEnum Values ---- Const adEmpty = 0 Const adTinyInt = 16 Const adSmallInt = 2 Const adInteger = 3 Const adBigInt = 20 Const adUnsignedTinyInt = 17 Const adUnsignedSmallInt = 18 Const adUnsignedInt = 19 Const adUnsignedBigInt = 21 Const adSingle = 4 Const adDouble = 5 Const adCurrency = 6 Const adDecimal = 14 Const adNumeric = 131 Const adBoolean = 11 Const adError = 10 Const adUserDefined = 132 Const adVariant = 12 Const adIDispatch = 9 Const adIUnknown = 13 Const adGUID = 72 Const adDate = 7 Const adDBDate = 133 Const adDBTime = 134 Const adDBTimeStamp = 135 Const adBSTR = 8 Const adChar = 129 Const adVarChar = 200 Const adLongVarChar = 201 Const adWChar = 130 Const adVarWChar = 202 Const adLongVarWChar = 203 Const adBinary = 128 Const adVarBinary = 204 Const adLongVarBinary = 205 '---- FieldAttributeEnum Values ---- Const adFldMayDefer = &H00000002 Const adFldUpdatable = &H00000004 Const adFldUnknownUpdatable = &H00000008 Const adFldFixed = &H00000010 Const adFldIsNullable = &H00000020 Const adFldMayBeNull = &H00000040 Const adFldLong = &H00000080 Const adFldRowID = &H00000100 Const adFldRowVersion = &H00000200 Const adFldCacheDeferred = &H00001000 '---- EditModeEnum Values ---- Const adEditNone = &H0000 Const adEditInProgress = &H0001 Const adEditAdd = &H0002 Const adEditDelete = &H0004 '---- RecordStatusEnum Values ---- Const adRecOK = &H0000000 Const adRecNew = &H0000001 Const adRecModified = &H0000002 Const adRecDeleted = &H0000004 Const adRecUnmodified = &H0000008 Const adRecInvalid = &H0000010 Const adRecMultipleChanges = &H0000040 Const adRecPendingChanges = &H0000080 Const adRecCanceled = &H0000100 Const adRecCantRelease = &H0000400 Const adRecConcurrencyViolation = &H0000800 Const adRecIntegrityViolation = &H0001000 Const adRecMaxChangesExceeded = &H0002000 Const adRecObjectOpen = &H0004000 Const adRecOutOfMemory = &H0008000 Const adRecPermissionDenied = &H0010000 Const adRecSchemaViolation = &H0020000 Const adRecDBDeleted = &H0040000 '---- GetRowsOptionEnum Values ---- Const adGetRowsRest = -1 '---- PositionEnum Values ---- Const adPosUnknown = -1 Const adPosBOF = -2 Const adPosEOF = -3 '---- enum Values ---- Const adBookmarkCurrent = 0 Const adBookmarkFirst = 1 Const adBookmarkLast = 2 '---- MarshalOptionsEnum Values ---- Const adMarshalAll = 0 Const adMarshalModifiedOnly = 1 '---- AffectEnum Values ---- Const adAffectCurrent = 1 Const adAffectGroup = 2 Const adAffectAll = 3 '---- FilterGroupEnum Values ---- Const adFilterNone = 0 Const adFilterPendingRecords = 1 Const adFilterAffectedRecords = 2 Const adFilterFetchedRecords = 3 Const adFilterPredicate = 4 '---- SearchDirection Values ---- Const adSearchForward = 1 Const adSearchBackward = -1 '---- ConnectPromptEnum Values ---- Const adPromptAlways = 1 Const adPromptComplete = 2 Const adPromptCompleteRequired = 3 Const adPromptNever = 4 '---- ConnectModeEnum Values ---- Const adModeUnknown = 0 Const adModeRead = 1 Const adModeWrite = 2 Const adModeReadWrite = 3 Const adModeShareDenyRead = 4 Const adModeShareDenyWrite = 8 Const adModeShareExclusive = &Hc Const adModeShareDenyNone = &H10 '---- IsolationLevelEnum Values ---- Const adXactUnspecified = &Hffffffff Const adXactChaos = &H00000010 Const adXactReadUncommitted = &H00000100 Const adXactBrowse = &H00000100 Const adXactCursorStability = &H00001000 Const adXactReadCommitted = &H00001000 Const adXactRepeatableRead = &H00010000 Const adXactSerializable = &H00100000 Const adXactIsolated = &H00100000 '---- XactAttributeEnum Values ---- Const adXactCommitRetaining = &H00020000 Const adXactAbortRetaining = &H00040000 '---- PropertyAttributesEnum Values ---- Const adPropNotSupported = &H0000 Const adPropRequired = &H0001 Const adPropOptional = &H0002 Const adPropRead = &H0200 Const adPropWrite = &H0400 '---- ErrorValueEnum Values ---- Const adErrInvalidArgument = &Hbb9 Const adErrNoCurrentRecord = &Hbcd Const adErrIllegalOperation = &Hc93 Const adErrInTransaction = &Hcae Const adErrFeatureNotAvailable = &Hcb3 Const adErrItemNotFound = &Hcc1 Const adErrObjectInCollection = &Hd27 Const adErrObjectNotSet = &Hd5c Const adErrDataConversion = &Hd5d Const adErrObjectClosed = &He78 Const adErrObjectOpen = &He79 Const adErrProviderNotFound = &He7a Const adErrBoundToCommand = &He7b Const adErrInvalidParamInfo = &He7c Const adErrInvalidConnection = &He7d Const adErrStillExecuting = &He7f Const adErrStillConnecting = &He81 '---- ParameterAttributesEnum Values ---- Const adParamSigned = &H0010 Const adParamNullable = &H0040 Const adParamLong = &H0080 '---- ParameterDirectionEnum Values ---- Const adParamUnknown = &H0000 Const adParamInput = &H0001 Const adParamOutput = &H0002 Const adParamInputOutput = &H0003 Const adParamReturnValue = &H0004 '---- CommandTypeEnum Values ---- Const adCmdUnknown = &H0008 Const adCmdText = &H0001 Const adCmdTable = &H0002 Const adCmdStoredProc = &H0004 '---- SchemaEnum Values ---- Const adSchemaProviderSpecific = -1 Const adSchemaAsserts = 0 Const adSchemaCatalogs = 1 Const adSchemaCharacterSets = 2 Const adSchemaCollations = 3 Const adSchemaColumns = 4 Const adSchemaCheckConstraints = 5 Const adSchemaConstraintColumnUsage = 6 Const adSchemaConstraintTableUsage = 7 Const adSchemaKeyColumnUsage = 8 Const adSchemaReferentialContraints = 9 Const adSchemaTableConstraints = 10 Const adSchemaColumnsDomainUsage = 11 Const adSchemaIndexes = 12 Const adSchemaColumnPrivileges = 13 Const adSchemaTablePrivileges = 14 Const adSchemaUsagePrivileges = 15 Const adSchemaProcedures = 16 Const adSchemaSchemata = 17 Const adSchemaSQLLanguages = 18 Const adSchemaStatistics = 19 Const adSchemaTables = 20 Const adSchemaTranslations = 21 Const adSchemaProviderTypes = 22 Const adSchemaViews = 23 Const adSchemaViewColumnUsage = 24 Const adSchemaViewTableUsage = 25 Const adSchemaProcedureParameters = 26 Const adSchemaForeignKeys = 27 Const adSchemaPrimaryKeys = 28 Const adSchemaProcedureColumns = 29 %> <% '*************************************************************************** ' VP-ASP 6.50 ' Dec 3, 2006 ' New Session Configuration '************************************************************************** const xsavesession="No" ' Replace session with database sessions ' const xsavesessioncookie="Yes" ' use real cookies to save session key const xsavesessionexpirydays=1 ' How many days till cookie expires const xsavesessiondatabase="shopsessions" ' used when using access database %> <% const cookieDelimiter="!+" ' data delimiter const cookielesstrace="No" const cookielessdbtrace="No" ' performance tracing const xsavesessdualmode="Yes" ' Use real sesion variables with site sessions const xsavesessionfile="No" ' use real physical file const cookienullvalue="**NULL**" ' const xsavesessionfilefolder="c:\webs\vpasptest650\sessions" ' use real physical file ' dim cookieRS, cookiesql dim cookiemsg dim websessvalue ' used in gateway returns dim cookiedbc '***************************************************** ' VP-ASP 6.50 Used to replace Microsoft Session variables ' Dec 3, 2006 ' The session variabes are saved in a database table called site sessions ' The key is a random number called websess ' The key can be passed on a querystring, hidden field. It is not found then ' look in session variable websess ' next look in cookie websess ' last look in a physical file ipaddress_mmddyyyy.txt '***************************************************** Function GenerateRandomID() '**************************************************** '* Purpose: * '* Generates a random id for unique * '* identification * '* Return: * '* A string that is the combination * '* of a random number and the * '* number of seconds from 12/31/92 * '**************************************************** Dim intRandomNumber 'Random number Dim intSeconds 'Number of seconds from 12/31/92 Dim NewID 'This is the generated ID Randomize intRandomNumber = Int((100000 * Rnd) + 1) intSeconds = DateDiff("s", "12/31/92", Now) NewID = CStr(intRandomNumber) & CStr(intSeconds) GenerateRandomID = NewID End Function Function Assignwebsess() '**************************************************** '* Purpose: * '* Assigns an id for use by the rest of * '* the functions. * '* Return: * '* A random ID for use with the rest of * '* the application. * '**************************************************** Dim websess 'Unique ID Dim FileSO 'File System Object Dim CookiePath 'Path to directory containing reference files Dim CookieFile 'File of unique id and name/value pairs websess = GenerateRandomID cookiemsg="" CookieFileWriteLine("UserID*=*" & websess) CookieFileWriteLine("DateAssigned*=*" & Now) CookieFileADD websess cookieFiledbtrace "$session_assignwebsess" Assignwebsess = websess End Function '******************************************************** ' add message to cookie string '******************************************************** Sub CookieFilewriteline (msg) If cookiemsg<>"" then cookiemsg=cookiemsg & cookiedelimiter end if cookiemsg=cookiemsg & msg end sub '************************************************************** ' cookiemsg has string to be stored '************************************************************* Sub cookiefileclose (sessionkey) if len(sessionkey) > 0 then dim cookiesql, sessiondate, sessiontime, sessionvalue, sessionnow 'VP-ASP 6.09 - added formatdatetime sessiontime=formatdatetime(time(), vbshorttime) sessionvalue=replace(cookiemsg,"'","''") sessiondate=datenormalize(date()) sessionnow=now() cookieopendatabase cookiedbc cookiesql="Update sitesessions set " cookiesql=cookiesql & "sessiondate='" & sessiondate & "'," cookiesql=cookiesql & "sessiontime=" & "'" & sessiontime & "'," cookiesql=cookiesql & "sessionvalue=" & "'" & sessionvalue & "'," cookiesql=cookiesql & "sessionnow=" & "'" & sessionnow & "'" cookiesql=cookiesql & " where sessionkey='" & sessionkey & "'" 'debugwrite cookiesql cookiedbc.execute(cookiesql) 'cookiestcnt = cookiestcnt + 1 shopclosedatabase cookiedbc end if end sub '***************************************************************** ' create a new entry in sitesessions table ' The string has been created already '***************************************************************** Sub cookiefileAdd (sessionkey) dim cookiesql, sessiondate, sessiontime, sessionvalue, sessionnow 'VP-ASP 6.09 - added formatdatetime sessiontime=formatdatetime(time(), vbshorttime) sessionvalue=replace(cookiemsg,"'","''") sessiondate=datenormalize(date()) sessionnow=now() cookieopendatabase cookiedbc 'cookiesql="delete from sitesessions where sessionkey='" & sessionkey & "'" 'cookiedbc.execute(cookiesql) cookiesql="insert into sitesessions(sessiondate, sessiontime, sessionkey, sessionvalue, sessionnow) values(" cookiesql=cookiesql & "'" & sessiondate & "'," cookiesql=cookiesql & "'" & sessiontime & "'," cookiesql=cookiesql & "'" & sessionkey & "'," cookiesql=cookiesql & "'" & sessionvalue & "'," cookiesql=cookiesql & "'" & sessionnow & "'" cookiesql=cookiesql & ")" cookiedbc.execute(cookiesql) shopclosedatabase cookiedbc end sub sub ResponseCookies(ValueName, ValueData) '**************************************************** '* Adds a name/value pair to the users file. * '**************************************************** Dim FileSO 'File System Object dim websess Dim CookieRS, cookiesql, sessionvalue Dim LineCount 'Number of rows of text Dim NewCount 'Row count for new file Dim DelimiterStart 'Location of the delimiting string: *=* Dim DataArray() 'Array to contain file contents dim cartdata dim lvaluename 'on error resume next websess=Getwebsess lvaluename=lcase(valuename) cookieFiledbtrace "$session_write" cookieopendatabase cookiedbc cookiesql="Select * from sitesessions where sessionkey='" & websess & "'" 'debugwrite sql set cookiers=cookiedbc.execute(cookiesql) if not cookiers.eof then sessionvalue=cookiers("sessionvalue") Cookiecreatearray dataarray, linecount, sessionvalue else shopclosedatabase cookiedbc websess=getwebsessForce shopinit shoperror "session has been lost. Please continue" end if closerecordset cookiers shopclosedatabase cookiedbc cookiemsg="" For NewCount = 0 to LineCount - 1 DelimiterStart = Instr(DataArray(NewCount), "*=*") If lValueName <> Left(DataArray(NewCount), DelimiterStart - 1) Then CookieFileWriteLine(DataArray(NewCount)) End If Next CartData = lValueName & "*=*" & ValueData CookieFileWriteLine(CartData) CookieFileClose websess End sub Function Requestcookies( ObjectName) '**************************************************** '* Purpose: * '* Retrieves the value of an object * '* Input: * '* UserID, name of object * '* Return: * '* The value of the object passed in * '**************************************************** Dim FileSO 'File System Object Dim CookieSQL 'Path to directory containing reference files Dim CookieRS 'File of unique id and name/value pairs Dim CookieFileText 'Text of the file Dim CurrentData 'Current line of data Dim DataLength 'Length of CurrentData Dim DelimiterStart 'Location of the delimiting string: *=* Dim CurrentName 'Name of current object Dim ObjectValue 'Value of current object dim websess, sessionvalue, dataArray, Linecount, i, found websess=Getwebsess dim lobjectname lobjectname=lcase(objectname) objectvalue="" cookieFiledbtrace "$session_read" 'debugwrite "session request" & objectname 'on error resume next cookieopendatabase cookiedbc cookiesql="Select * from sitesessions where sessionkey='" & websess & "'" set cookiers=cookiedbc.execute(cookiesql) if not cookiers.eof then sessionvalue=cookiers("sessionvalue") Cookiecreatearray dataarray, linecount, sessionvalue else shopclosedatabase cookiedbc websess=getwebsessForce shopinit shoperror "session has been lost. Please continue" end if closerecordset cookiers shopclosedatabase cookiedbc cookiemsg="" found=false for i = 0 to linecount-1 CurrentData = dataArray(i) DataLength = Len(CurrentData) DelimiterStart = Instr(CurrentData, "*=*") 'Response.Write DelimiterStart CurrentName = Left(CurrentData, DelimiterStart - 1) If lObjectName = CurrentName Then ObjectValue = Right(CurrentData, DataLength - (DelimiterStart + 2)) 'debugwrite "found=" & objectvalue & " length=" & len(objectvalue) found=true Exit for End If next If found=True then Requestcookies = ObjectValue else 'debugwrite "Notfound " & objectname Requestcookies = "" end if End Function Sub CookieSessionList '**************************************************** '* Purpose: * '* Retrieves all of the data associated * '* with the UserID * '* Input: * '* UserID * '* Return: * '* All of the contents of the file * '**************************************************** Dim CurrentData 'Current line's contents dim websess websess=getwebsess dim sessionvalue, dataarray, i cookieopendatabase cookiedbc dim currentname, objectvalue cookiesql="Select * from sitesessions where sessionkey='" & websess & "'" set cookiers=cookiedbc.execute(cookiesql) if not cookiers.eof then sessionvalue=cookiers("sessionvalue") Cookiecreatearray dataarray, linecount, sessionvalue else debugwrite "Cookie Sessionlist Record not found " & sessionvalue end if closerecordset cookiers shopclosedatabase cookiedbc for i = 0 to linecount-1 CurrentData = dataArray(i) DataLength = Len(CurrentData) DelimiterStart = Instr(CurrentData, "*=*") CurrentName = Left(CurrentData, DelimiterStart - 1) ObjectValue = Right(CurrentData, DataLength - (DelimiterStart + 2)) response.write currentname & "=" & objectvalue & "
" next End sub Function DeleteData(ObjectName) '**************************************************** '* Purpose: * '* Deletes an object from the data file * '* Input: * '* UserID, and ObjectName * '* Return: * '* All of the contents of the file * '**************************************************** Dim FileSO dim websess 'File System Object Dim CookiePath 'Path to directory containing reference files Dim CookieFile 'File of unique id and name/value pairs Dim CookieFileText 'Text of the file Dim LineCount 'Number of rows of text Dim DelimiterStart 'Location of the delimiting string: *=* Dim NewCount 'Row count for new file Dim OriginalObjectExists 'Flag to determine if object was in file Dim DataArray() 'Array to contain file contents dim sessionvalue websess=getwebsess cookieopendatabase cookiedbc cookiesql="Select * from sitesession where sessionkey=" & websess set cookiers=cookiedbc.execute(sql) if not cookiers.eof then sessionvalue=cookiers("sessionvalue") Cookiecreatearray dataarray, linecount, sessionvalue else debugwrite "Record not found " & websess end if closerecordset cookiers shopclosedatabase cookiedbc cookiemsg="" For NewCount = 0 to LineCount - 1 DelimiterStart = Instr(DataArray(NewCount), "*=*") If ObjectName <> Left(DataArray(NewCount), DelimiterStart - 1) Then CookieFileWriteLine(DataArray(NewCount)) Else OriginalObjectExists = "Yes" End If Next CookieFileClose websess end Function Function CreateHiddenElements '*************************************************************** '* Purpose: '* Grabs the data associated with the UserID and creates '* hidden form elements. '* Input: The assigned user id '* Return: Writes out the form element '* using the Response object. '****************************************************************** dim websess websess=Getwebsess Response.Write "" & vbcrlf End Function '*************************************************************** '* Purpose: '* Takes cart array and turns into astring delimited by | '* writes string to cookie file '****************************************************************** Sub ResponseCookiesCart (field, value) dim expires dim cartcount, arrcount, dataarea, j, countkeyname dim keyname, deliveryvalue dim i dim cartattributes cookieFiledbtrace "$session_writecart" cartattributes=cMaxCartAttributes cartcount=getsess("CartCount") if cartcount="" then exit sub if cartcount=0 then exit sub for i = 1 to cartcount dataarea="" for j = 1 to cartattributes If j=cDelivery then CookieSavedelivery value(j, i), deliveryvalue dataArea= dataarea & deliveryvalue & "|" else dataArea= dataarea & value(j, i) & "|" end if next keyname= field & cstr(i) ' debugwrite keyname & " " & dataarea & " " & cookiekey Responsecookies keyname,dataarea next countkeyname="CartCount" Responsecookies countkeyname,cartcount end sub '*************************************************************** '* Purpose: '* Takes string version of cart array and turns into an array '****************************************************************** Sub RequestCookieCart (field, value, rc) dim arrcount, dataarea, Temparray(22), tempcount dim arrcart, cartcount, deliveryvalue dim i, j, keyname, countkeyname dim cartattributes cartattributes=cMaxCartAttributes rc=0 cookieFiledbtrace "$session_readcart" ReDim arrcart(cartAttributes,getconfig("xmaxCartItems")) value=arrcart countkeyname="CartCount" cartcount=Requestcookies(countkeyname) 'debugwrite "cartcount=" & server.htmlencode(cartcount) rc=4 value=arrcart if cartcount="" then exit sub if cartcount=0 then exit sub 'ReDim arrcart(cartAttributes,getconfig("xmaxCartItems")) 'value=arrcart for i = 1 to cartcount keyname= field & cstr(i) dataarea=Requestcookies(keyname) ' debugwrite "dataarea=" & dataarea ParseRecord dataarea, TempArray, tempcount, "|" for j = 1 to cartAttributes-1 If j=cDelivery then CookieRestoredelivery temparray(j-1), deliveryvalue value(j,i) = deliveryvalue else value(j,i)= temparray(j-1) end if next next end sub '*************************************************************** '* Purpose: '* Takes and array, turns into a string and saves string as a cookie '****************************************************************** Sub ResponsecookiesArray (field, value) dim dataarea, key, keycount,i, newvalue key = field if ucase(key)="CARTARRAY" then ResponsecookiesCart field, value exit sub end if keycount=ubound(value) dataarea="" for i = 0 to keycount dataarea=dataarea & value(i) & "|" next Responsecookies field,dataarea end sub ' Function DeleteCookieData '**************************************************** '* * '* Purpose: * '* Deletes entire file * '* * '**************************************************** If xsavesession<>"Yes" then exit function Dim FileSO dim websess 'File System Object Dim CookiePath 'Path to directory containing reference files Dim CookieFile 'File of unique id and name/value pairs Dim CookieFileText 'Text of the file Dim LineCount 'Number of rows of text Dim DelimiterStart 'Location of the delimiting string: *=* Dim NewCount 'Row count for new file Dim OriginalObjectExists 'Flag to determine if object was in file Dim DataArray() 'Array to contain file contents websess=getwebsess cookiesql="delete from sitesessions where sessionkey=" & websess cookieopendatabase cookiedbc cookiedbc.execute(cookiesql) shopclosedatabase cookiedbc End Function Sub CookieRestoreDelivery (istring, deliveryarray) deliveryarray="" If getconfig("xdeliveryAddress")<>"Yes" then exit sub If istring="" then exit sub istring=replace(istring,"!",deliverydelimiter) ConvertDeliveryToArray DeliveryArray, istring end sub Sub CookieSaveDelivery (deliveryarray, returnvalue) returnvalue="" If getconfig("xdeliveryAddress")<>"Yes" then exit sub If not isarray(deliveryarray) then exit sub ConvertDeliveryToString DeliveryArray, returnvalue returnvalue=replace(returnvalue,deliverydelimiter,"!") end sub '*************************************************************************** ' parse long string into an array '************************************************************************* Sub Cookiecreatearray (words, wordcount, record) Dim pos Dim recordl Dim temprec Dim maxwords Dim i Dim maxentries dim finished dim length dim fieldvalue, delimstart maxwords=Cookiefindoccurances(record, cookiedelimiter) maxwords=maxwords+10 redim words(maxwords) temprec = record finished=false pos = 1 wordcount = 0 ' make sure word array is null maxentries = UBound(words) For i = 0 To maxentries - 1 words(i) = "" Next recordl = Len(temprec) Do delimstart=instr(pos,temprec,cookiedelimiter) If delimstart>0 then length=delimstart-pos fieldvalue=mid(temprec,pos, length) words(wordcount) = fieldvalue pos = delimstart+2 wordcount = wordcount + 1 else If Pos maxentries Then Exit Sub Loop Until finished=true End Sub Sub CookieOpenDataBase (connection) dim databasetype databasetype=ucase(xdatabasetype) If databasetype="" or databasetype="DRIVE" then CookieProcessAccessOpen connection exit sub end if if databasetype="ODBC" then cookieProcessODBC connection exit sub end if if databasetype="SQLSERVER" then cookieProcessSQLServer connection exit sub end if if databasetype="MYSQL" then cookieProcessMYSQLServer connection exit sub end if if databasetype="MYSQL351" then cookieProcessMYSQLServer connection exit sub end if end sub '****************************************************** ' Open Access Database Sub cookieProcessAccessOpen(connection) dim dblocation dim strconn dim database If xsavesessiondatabase="" then database=xdatabase & ".mdb" ' database name else database=xsavesessiondatabase & ".mdb" end if dblocation=xdblocation If dblocation<>"" then database = dblocation & "\" & database end if if ucase(xdatabasetype)="DRIVE" Then If xAccessOle<>"Yes" then strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & database else strconn = "provider=microsoft.jet.oledb.4.0;persist security info=false;data source=" & database end if else If xAccessole<>"Yes" then strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath(database) else strconn = "provider=microsoft.jet.oledb.4.0;persist security info=false;data source=" & Server.MapPath(database) end if end if Set connection = Server.CreateObject("ADODB.Connection") 'on error resume next If xsqlpwd="" then connection.open strConn else connection.open strConn,xsqluser,xsqlpwd end if End Sub '****************************************************************************** Sub cookieProcessODBC (connection) dim strconn Set connection = Server.CreateObject("ADODB.Connection") strconn=xdatabase connection.open strConn end sub '****************************************************** ' Open SQL Server Sub CookieProcessSqlServer(connection) Set connection = Server.CreateObject("ADODB.Connection") Dim varServerIP, varUserName, varPassword, varDataBaseName dim strconn varServerIP = xSQLServer varUserName = xSQLUser varPassword = xSQLPwd varDataBaseName = xdatabase If xSQLOLEDB="Yes" then strconn="Provider=sqloledb;" & "Source=" & varServerIP & ";" & "database=" & varDataBaseName & ";" & "UID=" & varUserName & ";" & "Password=" & varPassword & ";" else strconn= "DRIVER={SQL Server}; Server=" & varServerIP & "; Database=" & varDataBaseName & "; UID=" & varUserName & "; PWD=" & varPassword' end if Connection.Open strconn end sub ' '****************************************************** ' Open MYSQL Sub cookieProcessMYSqlServer(connection) Set connection = Server.CreateObject("ADODB.Connection") Dim varServerIP, varUserName, varPassword, varDataBaseName varServerIP = xSQLServer varUserName = xSQLUser varPassword = xSQLPwd varDataBaseName = xdatabase dim mysqlconn on error resume next 'debugwrite "DRIVER={MySQL}; Server=" & varServerIP & "; Database=" & varDataBaseName & "; UID=" & varUserName & "; PWD=" & varPassword' if ucase(xdatabasetype)="MYSQL351" then mysqlconn="DRIVER={MYSQL ODBC 3.51 Driver};" else mysqlconn="DRIVER={MySQL}; " end if mysqlconn=mysqlconn & " Server=" & varServerIP & "; Database=" & varDataBaseName & "; UID=" & varUserName & "; PWD=" & varPassword Connection.Open mysqlconn end sub '************************************************************************* ' how man session variables do we have '************************************************************************* function Cookiefindoccurances(inputstring, findstring) 'Returns the number of occurances of findstring that exist in the input string dim i, pos, findcounter pos=0 findcounter=0 i=1 do while i < len(inputstring) pos=instr(i, inputstring,findstring) if pos>0 then findcounter=findcounter+1 i=pos+len(findstring) else 'no more occurances found, end loop i=len(inputstring)+1 end if loop cookiefindoccurances=findcounter+1 end function '***************************************************************************** ' the web session is known. We save it so we can find it agaian ' save as session variable and real cookie '***************************************************************************** sub SaveSessionVariable (userid) dim filename, cookiename ' save it in session variable session("websess")=userid cookiename="websess_" & xshopid ' so two different sites do not intefere ' save as real cookie if xsavesessioncookie="Yes" then response.cookies(cookiename)=userid 'response.cookies(cookiename).expires=date()+clng(xsavesessexpirydays) response.cookies(cookiename).expires=date()+clng(xsavesessionexpirydays) end if ' save in physical file if xsavesessionfile="Yes" then cookielessGenerateFilename filename CookielessWritefile userid, filename end if end sub '****************************************************************************** ' filename= datetime_mmddyy_hhmmss.txt '***************************************************************************** Sub cookielessGenerateFilename (filename) dim prefix, mm,yy,dd, today, hh, nn, ss, tempname dim ipaddress '-------------------------------------- ' VP-ASP Security Patch - 2 June 2008 '-------------------------------------- ipaddress=cleanchars(request.servervariables("REMOTE_HOST")) '-------------------------------------- today=now() prefix="websess_" & xshopid mm=datepart("m",today) dd=datepart("d",today) yy=Datepart("yyyy",today) hh=Datepart("h",today) If len(mm)=1 then mm= "0" & mm if len(dd)=1 then dd= "0" & dd if len(hh)=1 then hh = "0" & hh tempname=prefix & "_" & mm & dd & yy & "_" & Ipaddress tempname=tempname & ".txt" tempname=xsavesessionfilefolder & "\" & tempname 'debugwrite tempname filename=tempname end sub Sub CookielessWriteFile ( userid, filename) dim fso, myfile, rc Set fso = CreateObject("Scripting.FileSystemObject") 'on error resume next Set Myfile = fso.OpenTextFile(filename, 2, True) 'debugwrite filename if err.number> 0 then ' debugwrite filename 'debugwrite "" & getlang("LangExportOpen") & "
" & err.description & "
" rc=4 else MyFile.writeline userid rc =0 end if myfile.close set myfile=nothing set fso=nothing end sub Sub CookielessreadFile ( userid, filename) dim fso, myfile, rc 'debugwrite "filename=" & filename Set fso = CreateObject("Scripting.FileSystemObject") 'on error resume next Set Myfile = fso.OpenTextFile(filename, 1, false) if err.number> 0 then response.write "" & "unable to open file" & filename & "
" & err.description & "
" rc=4 else userid=myfile.readline 'debugwrite "read " & userid rc =0 end if myfile.close set myfile=nothing set fso=nothing end sub '************************************************************************* ' try to find websess by reading a file '************************************************************************ Function Requestcookiefile dim userid, filename cookielessGenerateFilename filename CookielessreadFile userid, filename if cookielesstrace="Yes" then debugwrite "readcookfile returned " & userid & " from " & filename end if requestcookiefile=userid end function '*************************************************************** '* Purpose: find the current websess. '* Hopefully it exists on form, querystring or session variable '* Takes string version of cart array and turns into an array ' This has been totally rewriiten to find websess. ' It could be in: ' session variables if cookies are enabled and no web farm swtich ' It could be on querystring if passed ' it could be on a hidden field ' It could be a real cookie ' If file cookies are used, it could be in a physical file ' If we cannot find it, then we create a new web session using assignwebsess '****************************************************************** Function Getwebsess dim userid, cookiename ' Try session variable userid=session("websess") ' is it areal session variable if userid<>"" then getwebsess=userid exit function end if ' Try querystring or hidden field 'VP-ASP 6.50 - precautionary security fix userid=cleanchars(request("websess")) if userid<>"" then getwebsess=userid exit function end if ' Try real cookie cookiename="websess_" & xshopid ' so two different sites do not intefere '-------------------------------------- ' VP-ASP Security Patch - 2 June 2008 '-------------------------------------- userid=cleanchars(request.cookies(cookiename)) '-------------------------------------- if userid<>"" then ' debugwrite "read cookie " & cookiename & " value=" & userid CookielessReloadSession userid ' if whole session is load reload all variables getwebsess=userid session("websess")=userid exit function end if ' Try cookie in a file If xsavesessionfile="Yes" then ' must be configired to try physical file userid=requestcookiefile ' try and find it if userid<>"" then ' did we get it CookielessReloadSession userid ' if whole session is load reload all variables session("websess")=userid getwebsess=userid ' return value exit function end if end if ' someone stored it away such as gateway userid=websessvalue ' last resort gateway put something here if userid<>"" then getwebsess=userid session("websess")=userid exit function end if userid=assignwebsess ' need to assign a new web sess if cookielesstrace="Yes" then debugwrite "New websess created " & userid end if SaveSessionVariable userid ' save it away as cookie or file getwebsess=userid exit function end function '************************************************************************ 'lost database, need to assign a new websess '************************************************************************ Function GetWebSessForce dim userid userid=assignwebsess ' need to assign a new web sess if cookielesstrace="Yes" then debugwrite "New websess created " & userid end if SaveSessionVariable userid ' save it away as cookie or fil getwebsessforce=userid end function '****************************************************************************** ' trace number of times an event occurs '**************************************************************************** Sub cookieFiledbtrace (keyword) dim tempcount tempcount=session(keyword) if tempcount="" then tempcount=0 tempcount=tempcount+1 session(keyword)=tempcount end sub '****************************************************************************** ' this is an optimization ' if using dual mode and the websess had to be found via cookie or file ' we probabaly have lost everything. So reload all session variables from ' database '****************************************************************************** Sub CookielessReloadSession (websess) Dim CookieSQL 'Path to directory containing reference files Dim CookieRS 'File of unique id and name/value pairs Dim CookieFileText 'Text of the file Dim CurrentData 'Current line of data Dim DataLength 'Length of CurrentData Dim DelimiterStart 'Location of the delimiting string: *=* Dim CurrentName 'Name of current object Dim CurrentValue 'Value of current object dim sessionvalue, dataArray, Linecount, i, found dim lobjectname If xsavesessdualmode<>"Yes" then exit sub cookieFiledbtrace "$session_reloadsessionvariables" cookieopendatabase cookiedbc cookiesql="Select * from sitesessions where sessionkey='" & websess & "'" 'debugwrite cookiesql set cookiers=cookiedbc.execute(cookiesql) if not cookiers.eof then sessionvalue=cookiers("sessionvalue") Cookiecreatearray dataarray, linecount, sessionvalue else closerecordset cookiers shopclosedatabase cookiedbc exit sub end if closerecordset cookiers shopclosedatabase cookiedbc ' first two values are internal useri9d and date. no need to restore for i = 2 to linecount-1 CurrentData = dataArray(i) DataLength = Len(CurrentData) DelimiterStart = Instr(CurrentData, "*=*") CurrentName = Left(CurrentData, DelimiterStart - 1) Currentvalue= Right(CurrentData, DataLength - (DelimiterStart + 2)) ' debugwrite currentname & "=" & currentvalue Session(currentname)=currentvalue next 'debugwrite "reloaded session varaibles" end sub %> <% '*************************************************************** ' maintains state for VP-ASP using cookies or session variables ' Cookies are not currently supported ' VP-ASP 6.50 ' June 12, 2004 Support Coookieless VP-ASP ' March 2, 2006 Address 2 now saved into cookie ' Nov 14, 2006 HK Redo sessions in database ' Dec 3, 2006 Separate database and performance enhancements ' make null value to increase performance '*************************************************************** const CookieKey="VPASP" ' ************************************************************** ' save a value in session variable ' if using file sessions also save in database '*************************************************************** Sub SetSess (field, value) dim newvalue If xsavesession="Yes" then newvalue=value If value="" then newvalue=cookienullvalue ' distinquish nothing from empty if xsavesessdualmode="Yes" then Session(field)=newvalue end if If lcase(field)="currenturl" then newvalue=value & "?websess=" & getwebsess Responsecookies field,newvalue else Responsecookies field,newvalue end if exit sub end if ' normal sessions Session(field)=value end sub ' ' ************************************************************** ' Used to save an array in a session varaible. ' Normal sessions don't have a problem by file sessions need to ' know it is an array '*************************************************************** Sub SetSessA (field, value) dim a(3) If xsavesession="Yes" Then if xsavesessdualmode="Yes" then Session(field)=value end if ResponsecookiesArray field,value exit sub end if ' normal sessions Session(field)=value end sub ' '*********************************************************************** ' get value from session varaible ' if value is empty and we are using file sessions ' try to get value from database ' If could be empty because no real value, lost sessions do to ' web farm or timeout '*********************************************************************** Function GetSess (field) dim value ' try database if xsavesession="Yes" then if xsavesessdualmode="Yes" then value=Session(field) if value<>"" then If value=cookienullvalue then value="" Getsess=value exit function end if end if value=Requestcookies(field) If value=cookienullvalue then value="" else if value="" then if xsavesessdualmode="Yes" then Session(field)=cookienullvalue ' next time we will have it in real session variable end if end if end if ' debugwrite "value=" & value & " for " & field Getsess=value exit function end if ' normal sessions value=Session(field) Getsess=value End Function '************************************************************************ ' get an array from session varaible ' Normal sessions are not an issue ' File sessions need to know it is an array ' first try real sessions, if they are empty, try file sessions '*********************************************************************** Function GetSessA (field) dim dataarea, temparray(100), tempcount, rc dim value, i, key, cartcount If xsavesession="Yes" then if xsavesessdualmode="Yes" then value=Session(field) if isarray(value) then GetsessA=value exit function end if end if key = field if ucase(key)="CARTARRAY" then RequestcookieCart field, value, rc GetSessA=value exit function end if dataarea=Requestcookies(field) If dataarea="" then GetSessA="" exit function end if ParseRecord dataarea, TempArray, tempcount, "|" GetSessA=Temparray exit function end if ' normal sessions value=Session(field) GetsessA=value End Function Sub SetSessionTimeout If getconfig("xSessionTimeout")<>"" then Session.timeout=getconfig("xsessiontimeout") end if If xsavesession="Yes" then Response.Cookies(cookiekey).expires = date+1 end if end sub ' Sub SaveCustomerDetailsCookie Dim cookfield cookfield="" Buildcookie cookfield,"Firstname", strFirstname BuildCookie cookfield,"Lastname", strLastname BuildCookie cookfield,"Address", strAddress 'VP-ASP 6.08 - address 2 now saved into cookie BuildCookie cookfield,"Address2", strAddress2 BuildCookie cookfield,"City", strCity BuildCookie cookfield,"State", strState BuildCookie cookfield,"PostCode", strPostCode BuildCookie cookfield,"Country", strCountry BuildCookie cookfield,"Company", strCompany BuildCookie cookfield,"Website", strWebsite BuildCookie cookfield,"Phone", strPhone BuildCookie cookfield,"Email", strEmail 'VP-ASP 6.08 - losing customerid on shopcustomer.asp error fix - added IF statement below if strCustomerID = "" OR isnull(strCustomerID) then BuildCookie cookfield,"CustomerID", getsess("customerid") else BuildCookie cookfield,"CustomerID", strCustomerID end if '12/1/2006 - bug fix dim tmpstrdiscount if isnull(strdiscount) then tmpstrdiscount="" else tmpstrdiscount=replace(strdiscount, ",", ".") end if BuildCookie cookfield,"Custdiscount", tmpstrdiscount 'end fix 'VP-ASP 6.08 - losing customerid on shopcustomer.asp error fix - commented out line below. ' BuildCookie cookfield,"Customerid", strcustomerid BuildCookie cookfield,"Customertype", strcustomertype 'VP-ASP 6.09 - add other fields to cookie if getconfig("xcustomerotherfields") > "" then if instr(getconfig("xcustomerotherfields"), ",") > 0 then dim custfield, tempcustfields tempcustfields = split(getconfig("xcustomerotherfields"), ",") for each custfield in tempcustfields 'VP-ASP 6.50 - precautionary security fix '------------------------------------------ ' VP-ASP 6.50.4 Bugs Fix - 08 October 2008 '------------------------------------------ BuildCookie cookfield,"c_" & Trim(custfield), cleanchars(request(trim(custfield))) next else 'VP-ASP 6.50 - precautionary security fix BuildCookie cookfield,"c_" & getconfig("xcustomerotherfields"), cleanchars(request(getconfig("xcustomerotherfields"))) end if end if Response.Cookies ("CartLogin")=cookfield response.cookies("CartLogin").expires=date()+365 ' debugwrite cookfield end sub Sub BuildCookie (dataarea, fieldname,fieldvalue) If dataarea<>"" then dataarea=dataarea & "," end if If fieldvalue="" then dataarea=dataarea & fieldname & "=" & "???" else 'VP-ASP 6.09 - If there is a comma in the customers details, replace with pipe before saving in cookie if fieldvalue > "" then dataarea=dataarea & fieldname & "=" & replace(fieldvalue,",","|") else dataarea=dataarea & fieldname & "=" & fieldvalue end if end if end sub Sub RestoreCustomerDetailsCookie dim restored, i dim cookfield, pairs(30),paircount,fields(4), fieldcount ' restored=getsess("Restored") ' if restored<>"" then exit sub cookfield=request.cookies("CartLogin") if cookfield="" then exit sub parserecord cookfield, pairs, paircount,"," for i =0 to paircount-1 parserecord pairs(i), fields, fieldcount,"=" if fields(1)="???" then fields(1)="" end if 'VP-ASP 6.09 - If using comma instead of decimal, replace it before restoring if getconfig("xconverteuropeannumbers") = "Yes" then if fields(0) = "Custdiscount" then fields(1) = replace(fields(1), ".", ",") end if end if 'VP-ASP 6.09 - If there is a pipe in the customers details, replace with comma before restoring if fields(1) > "" then fields(1) = replace(fields(1), "|",",") end If '-------------------------------------- ' VP-ASP Security Patch - 17 April 2008 '-------------------------------------- If cleanchars(fields(1)) = "" Then If fields(1) <> "" Then 'Delete Cookie response.cookies("CartLogin").expires=date()-1 response.cookies("CartLogin") = "" 'Redirect to Error Page shoperror "Error loading data from session: " &server.htmlencode(fields(1)) End If End If '-------------------------------------- Setsess fields(0),fields(1) next Setsess "Restored","Yes" Setsess "Login","Yes" end sub Function ShopLcname dim abc,name, i abc=array("l","a","n","g","k","e","y") for i = 0 to ubound(abc) name=name & abc(i) next shoplcname=name end function Sub SessSaveCart (field, value, cookiekey, cartdays) dim expires dim cartcount, arrcount, dataarea, j, countkeyname dim keyname dim i dim cartattributes cartattributes=cMaxCartAttributes expires=date+cartdays cartcount=getsess("CartCount") if cartcount="" or cartcount=0 then exit sub 'debugwrite "cartcount=" & cartcount for i = 1 to cartcount dataarea="" for j = 1 to cartattributes dataArea= dataarea & value(j, i) & ";" next keyname= field & cstr(i) ' debugwrite keyname & " " & dataarea & " " & cookiekey Response.cookies(Cookiekey) (keyname)=dataarea Response.cookies(Cookiekey).expires=expires next countkeyname="CartCount" Response.cookies(Cookiekey) (countkeyname)=cartcount Response.cookies(Cookiekey).expires=expires end sub ' Sub SessRestoreCart (field, value, cartcount, cookiekey, rc) dim arrcount, dataarea, Temparray(20), tempcount dim arrcart dim i, j, keyname, countkeyname dim cartattributes cartattributes=cMaxCartAttributes rc=0 ReDim arrcart(cartAttributes,getconfig("xmaxCartItems")) value=arrcart countkeyname="CartCount" cartcount=Request.cookies(Cookiekey) (countkeyname) If cartcount="" or Cartcount=0 then rc=4 exit sub end if ReDim arrcart(cartAttributes,getconfig("xmaxCartItems")) value=arrcart for i = 1 to cartcount keyname= field & cstr(i) dataarea=Request.cookies(Cookiekey) (keyname) ParseRecord dataarea, TempArray, tempcount, ";" for j = 1 to cartAttributes value(j,i)= temparray(j-1) next next end sub sub ShopProductcheck If getconfig(shoplcname)="" then shoplicenseerror If getconfig(shoplcname)="No" then shoplicenseerror end sub '************************************************************* ' add websess if using cookies '************************************************************* sub responseredirect (url) If xsavesession<>"Yes" then response.redirect url exit sub end if dim pos, newurl, delim, posdelim delim="?" newurl=url pos=instr(url,"websess") posdelim=instr(url,"?") if posdelim>0 then delim="&" end if if pos=0 then newurl=newurl & delim & "websess=" & getwebsess end if response.redirect newurl end sub '************************************************************* ' add websess to url if using cookies '************************************************************* Function AddWebSess (url) If xsavesession<>"Yes" then addwebsess=url exit function end if dim pos, newurl, delim, posdelim delim="?" newurl=url pos=instr(url,"websess") posdelim=instr(url,"?") if posdelim>0 then delim="&" end if if pos=0 then newurl=newurl & delim & "websess=" & getwebsess end if addwebsess=newurl end function Sub AddWebSessForm If xsavesession<>"Yes" then exit sub CreateHiddenElements end sub '************************************************************* ' add websess to url if using cookies ' create &websess=xxxxxxxx '************************************************************* Function AddWebSessLink If xsavesession<>"Yes" then addwebsesslink="" else addwebsesslink = "&websess=" & getwebsess end if end function '************************************************************* ' add websess to url if using cookies ' addsession '************************************************************* sub AddSession dim field field="?" If xsavesession<>"Yes" then exit Sub response.write field & "websess=" & getwebsess end sub Sub AddWebSessFormGW (fieldname) '*************************************************************** '* Purpose: '* Grabs the data associated with the UserID and creates '* hidden form elements. '* Input: The assigned user id '* Return: Writes out the form element '* using the Response object. '****************************************************************** If xsavesession<>"Yes" then exit sub dim websess websess=Getwebsess Response.Write "" & vbcrlf End sub '************************************************************* ' add websess to url if using cookies ' create ?websess=xxxxxxxx. Replaced addwession '************************************************************* Function AddWebSessLinkFirst If xsavesession<>"Yes" then addwebsesslinkfirst="" else addwebsesslinkfirst = "?websess=" & getwebsess end if end function %> <% '***************************************************************** ' Subroutines to support delivery address per product ' Version 6.50 Feb 4, 2003 '****************************************************************** const dFirstName=1 const dLastName=2 const dAddress=3 const dCity=4 const dState=5 const dPostCode=6 const dcountry=7 const dCompany=8 const dPhone=9 const dEmail=10 const dDeliveryType=11 const Dshippingtype=12 const dshippingcost=13 const dComment=14 const dSignature=15 Const dDeliveryTime=16 const DeliveryAttributes=17 const DeliveryDelimiter=";" Sub CreateDeliveryAddress (deliveryarray) deliveryarray(dfirstname)=strfirstname deliveryarray(dlastname)=strlastname deliveryarray(daddress)=straddress deliveryarray(dcity)=strcity deliveryarray(dstate)=strstate deliveryarray(dpostcode)=strpostcode deliveryarray(dcountry)=strcountry deliveryarray(dCompany)=strCompany deliveryarray(dPhone)=strPhone deliveryarray(demail)=strEmail deliveryarray(dDeliverytype)=DeliveryType deliveryarray(dShippingCost)=ShippingCost deliveryarray(dShippingtype)=ShippingMethod deliveryarray(dComment)=DeliveryComment deliveryarray(dSignature)=DeliverySignature Deliveryarray(ddeliveryTime)=DeliveryTime end sub sub SetupDeliveryFields (Deliveryarray) If not isarray(deliveryarray) then exit sub Strfirstname=Deliveryarray(dFirstName) strlastname=Deliveryarray(dLastName) straddress=Deliveryarray(dAddress) strcity=Deliveryarray(dCity) strstate=Deliveryarray(dState) strpostcode=Deliveryarray(dPostCode) strcountry=Deliveryarray(DCountry) strcompany=Deliveryarray(dCompany) stremail=Deliveryarray(dEmail) strphone=Deliveryarray(dPhone) DeliveryType=DeliveryArray(DDeliveryType) ShippingMethod=DeliveryArray(dShippingType) ShippingCost=DeliveryArray(dShippingCost) DeliveryComment=DeliveryArray(dComment) DeliverySignature=DeliveryArray(dSignature) DeliveryTime=deliveryarray(dDeliveryTime) end sub 'add namesto cart Sub GetDeliveryName (name, DeliveryArray) dim shippingmethod If Not isarray(DeliveryArray) then exit sub If Deliveryarray(dDeliveryType)<> getlang("LangDeliverySelf") then name=name & "
" & DeliveryFont & getlang("LangDeliveryAddress") & DeliveryFontEnd name=name & "
" & deliveryArray(dFirstName) & " " & DeliveryArray(dLastname) name=name & "
"& deliveryArray(dAddress) name=name & "
" & deliveryArray(dCity) & " " & deliveryArray(dState) & " " & deliveryArray(dPostcode) AddDeliveryField "",name, deliveryArray(dCountry) AddDeliveryField "",name, deliveryArray(dCompany) AddDeliveryField getlang("LangCustPhone"),name, deliveryArray(dPhone) AddDeliveryField getlang("LangCustemail"),name, deliveryArray(demail) else name=name & "
" & DeliveryFont & getlang("LangDeliverySelf") & DeliveryFontEnd end if AddDeliveryField getlang("LangDeliveryDate"),name, deliveryArray(dDeliveryTime) ShippingMethod= deliveryArray(dShippingType) If DeliveryArray(dShippingcost)<>"" then 'ShippingMethod = shippingmethod & " [" & shopformatcurrency(DeliveryArray(dShippingcost),getconfig("xdecimalpoint")) &"]" ShippingMethod = shippingmethod end if AddDeliveryField getlang("LangShippingMethod"),name,shippingmethod AddDeliveryField getlang("LangCreate06"),name, deliveryArray(dComment) AddDeliveryField getlang("LangDeliverySignature"), name, deliveryArray(dSignature) end sub Sub AddDeliveryField (caption,name,value) If value<>"" then If caption="" then name=name & "
" & value else name=name & "
" & DeliveryFont & caption & DeliveryFontEnd & "
" & value end if end if end sub Sub VerifyDeliveryAddress(rc) rc=0 ' See if each product that requires a delivery address, has one Dim scartitem, arrcart, i, deliveryarray, deliveryrequired If getconfig("xDeliveryRequired")<>"Yes" Then exit sub scartItem = GetSess("CartCount") arrCart = GetSessA("CartArray") ' go through all products For i = 1 to scartItem Deliveryarray=arrCart(cDelivery,i) If not isarray(deliveryArray) then rc=4 exit sub end if next rc=0 end sub Sub ConvertDeliveryToString(DeliveryArray, ostring) dim i ostring="" if not isarray(deliveryarray) then exit sub for i = 1 to DeliveryAttributes-1 if i=1 then ostring=deliveryarray(i) else ostring=ostring & DeliveryDelimiter & Deliveryarray(i) end if next end sub Sub ConvertDeliveryToArray(DeliveryArray,istring) redim DeliveryArray(DeliveryAttributes) dim words(30),wordcount,Delimiter,i Delimiter=DeliveryDelimiter parserecord istring, words, wordcount, delimiter wordcount=wordcount-1 for i =0 to wordcount Deliveryarray(i+1)=words(i) next end sub %> <% '************************************************ ' Shop subroutines VP-ASP 6.50 ' Numerous product, date category subroutines ' Nov 11,2005 Fix top sellers Mysql ' nOV 12, 2005 Fix langip ' Dec 31, 2005 Fix fieldvalue mismatch Issue 729 ' Dec 31 2005 Update navigateshowcategoriesstyled ' Sep 12 2006 Added code to CheckDeliveryFree to ' always have free shipping for gift certificate '************************************************* Sub SetupProductFieldsXXX (ProdFields, ProdHeaders) dim tempfields,swords(20),swordscount,i tempfields=getconfig("xproductfields") parserecord tempfields,swords,swordscount,"," redim prodFields(swordscount-1) for i = 0 to swordscount-1 prodfields(i)=swords(i) next end sub ' Sub SetupSearchFields (SearchFields) dim tempfields,swords(20),swordscount,i IF strSearchFields = "" THEN tempfields=getconfig("xsearchfields") ELSE tempfields = strSearchFields END IF parserecord tempfields,swords,swordscount,"," redim SearchFields(swordscount-1) for i = 0 to swordscount-1 searchfields(i)=swords(i) next end sub ' '******************************************************************* ' This routine puts fields into the cart '**************************************************************** ' Shopcartformat Formats field in cart Sub GetNameInCart (Rsitem, dbc) dim tempfields,cartfields(20),fieldcount,i, fieldvalue dim tempcatalogid tempfields=getconfig("xcartfields") if tempfields = "" then shoperror getlang("langcommonno") & " " & getlang("langsearchfields") & " to " & getlang("langeditdisplay") end if parserecord tempfields,cartfields,fieldcount,"," nameincart="" tempcatalogid=rsitem("catalogid") for i = 0 to fieldcount-1 If cartfields(i)="cdescription" then fieldvalue= memCDescription fieldvalue=translatelanguage(dbc, "products", "cdescription","catalogid", tempcatalogid, fieldvalue) else fieldvalue=rsitem(cartfields(i)) If lcase(cartfields(i))="cname" then 'VP-ASP 6.50.4 - show parent name before child name in cart dim childrs set childrs = dbc.execute("select highercatalogid from products where catalogid = " & tempcatalogid) if not childrs.eof then if childrs("highercatalogid") > 0 then set childrs = dbc.execute("select catalogid, cname from products where catalogid IN (SELECT highercatalogid FROM products where catalogid = " & tempcatalogid & ")") if not childrs.eof then fieldvalue = translatelanguage(dbc, "products", "cname","catalogid", childrs("catalogid"), childrs("cname")) & " - " & translatelanguage(dbc, "products", "cname","catalogid", tempcatalogid, fieldvalue) end if end if end if closerecordset childrs if fieldvalue = "" then fieldvalue=translatelanguage(dbc, "products", "cname","catalogid", tempcatalogid, fieldvalue) end if end if end if if not isnull(fieldvalue) then if nameincart<>"" then nameincart=nameincart & "
" end if nameincart=nameincart & fieldvalue end if next end sub Function GetMailCR 'GetMailCR= Chr(13) GetMailCR= Chr(13) & chr(10) end function ' '*************************************************************** ' Used throughout the code to create a text form box '*************************************************************** Sub CreateCustRow (caption, fieldname, fieldvalue, required) Dim aster If required="Yes" then aster="* " else aster=" " end if Response.write tablerow & "
" Response.write aster & Caption & "" %><% Response.write tablecolumnend & tableRowend end sub ' Sub CreateCustRowP (caption, fieldname, fieldvalue, required) Dim aster If required="Yes" then aster="* " else aster=" " end if Response.write tablerow & "" Response.write aster & Caption & "" & capdisplay & "" GenerateselectNV YesNos,fieldvalue,fieldname,yesnocount, "" Response.write tableColumnEnd If helpfile<>"" and getconfig("xproducthelp")="Yes" then ' FormatEditHelp fieldname, helpfile end if Response.write TableRowEnd end sub '****************************************************************** ' used in admin section to create a static equivalent of a text box '******************************************************************* Sub FormatEditRowStatic (caption,fieldname,fieldvalue) dim capdisplay, yfont capdisplay=caption if capdisplay="" then capdisplay=fieldname end if yfont=xTableRowFont Response.Write TableRow Response.write TableColumn & capdisplay & TableColumnEnd Response.write TableColumn & Yfont & fieldvalue & xTableRowFontEnd Response.write tableColumnEnd Response.write TableRowEnd end sub '*********************************************************** ' used in admin area to ceate a multirow text area '************************************************************ Sub FormatEditRowTextArea (caption,fieldname,fieldvalue) dim capdisplay, rows capdisplay=caption if capdisplay="" then capdisplay=fieldname end if rows=3 Response.Write TableRow Response.write TableColumn & capdisplay & TableColumnEnd response.write "" & vbcrlf Response.write tableColumnEnd Response.write TableRowEnd end sub '*********************************************************************** ' if doing help for products and categories '************************************************************************ Sub FormatEditHelpHeader if getconfig("xproducthelp")<>"Yes" then exit sub %> <% end sub '******************************************************************** ' write help column for products and categories '******************************************************************* Sub FormatEditHelp(fieldname, helpfile) if getconfig("xproducthelp")<>"Yes" then exit sub response.write "" %> <% response.write tablecolumnend end sub ' '**************************************************************** ' creates category drop down list '*************************************************************** Sub NavigateShowCategories() If getconfig("Xnavigatecategories")="No" then exit sub If getconfig("xlogonrequired")="Yes" then If getsess("login")="" then exit sub end if end if If getconfig("init")="" then exit sub dim cid, name,catSQL,i dim strcategory, catcount, categories,maxcategories Dim catdbc,catrs, hassubcategory,mylink 'catcount=getsess("catcount") If catcount="" then catcount=0 'VP-ASP 6.50 - advanced session handling 'If xusefilesession="Yes" then If xsavesession="Yes" then catcount=0 end if If catcount=0 then catcount=0 maxcategories=getconfig("xmaxcategories") redim categories(maxcategories) ShopOpenDatabaseP catdbc If not catdbc.state=adStateOpen then shopclosedatabase catdbc exit sub end if catSQL="Select * from categories where highercategoryid=0 and cathide is null " 'VP-ASP 6.09 - add product matching to this sub if getconfig("xproductmatch")="Yes" then 'VP-ASP 6.50 - changed below to show matching categories and categories with no association when productmatching is on ' catsql=catsql & " and productmatch='" & xproductmatch & "'" catsql=catsql & " and (productmatch='" & xproductmatch & "' or productmatch is null)" end if if getconfig("xproductmatchcustomer")="Yes" then if GetSess("CustomerProductGroup")<>"" then catsql=catsql & " and (customermatch like '%" & getsess("customerProductgroup") & "%'" catsql=catsql & " or customermatch is null)" else catsql=catsql & " and customermatch is null" end if end if If getconfig("xselectproductsbylanguage")="Yes" and getsess("language")<>"" then catsql=catsql & " and (catlanguage='" & getsess("language") & "'" catsql=catsql & " or catlanguage is null)" end if 'VP-ASP 6.08 - Order by config option rather than hardcoded if getconfig("xsortcategories") <> "" then catSQL=catsql & " order by " & getconfig("xsortcategories") else catSQL=catsql & " order by catdescription" end if ' catSQL=catsql & " order by catdescription" set catrs=catdbc.execute(catsql) While Not catrs.EOF and catcount" & name & "" else mylink="" & name & "..." end if categories(catcount)=mylink catcount=catcount+1 catrs.MoveNext Wend setsessa "categories",categories setsess "catcount",catcount catrs.Close set catrs=nothing ShopCloseDatabase catdbc end if ' catcount=getsess("catcount") categories=getsessa("categories") response.write NavCatTable for i = 0 to catcount-1 mylink=categories(i) response.write NavCatRow & NavCatColumn response.write mylink response.write NavCatColumnend next response.write "
" exit sub end sub 'Displays stylesheet driven menu Sub NavigateShowCategoriesStyled() If getconfig("Xnavigatecategories")="No" then exit sub If getconfig("xlogonrequired")="Yes" then If getsess("login")="" then exit sub end if end if If getconfig("init")="" then exit sub dim cid, name,catSQL,i dim strcategory, catcount, categories,maxcategories Dim catdbc,catrs, hassubcategory,mylink 'catcount=getsess("catcount") If catcount="" then catcount=0 'VP-ASP 6.50 - advanced session handling 'If xusefilesession="Yes" then if xsavesession = "Yes" then catcount=0 end if If catcount=0 then catcount=0 maxcategories=getconfig("xmaxcategories") redim categories(maxcategories) ShopOpenDatabaseP catdbc If not catdbc.state=adStateOpen then shopclosedatabase catdbc exit sub end if catSQL="Select * from categories where highercategoryid=0 and cathide is null " if getconfig("xproductmatch")="Yes" then 'VP-ASP 6.50 - enhanced productmatching catsql=catsql & " and " Generateproductmatchsqlsubscat catsql ' catsql=catsql & " and productmatch='" & xproductmatch & "'" end if if getconfig("xproductmatchcustomer")="Yes" then if GetSess("CustomerProductGroup")<>"" then catsql=catsql & " and (customermatch like '%" & getsess("customerProductgroup") & "%'" catsql=catsql & " or customermatch is null)" else catsql=catsql & " and customermatch is null" end if end if If getconfig("xselectproductsbylanguage")="Yes" and getsess("language")<>"" then catsql=catsql & " and (catlanguage='" & getsess("language") & "'" catsql=catsql & " or catlanguage is null)" end if 'VP-ASP 6.08 - Order by config option rather than hardcoded catSQL=catsql & " order by " & getconfig("xsortcategories") ' catSQL=catsql & " order by catdescription" set catrs=catdbc.execute(catsql) While Not catrs.EOF and catcount" & name & "" else mylink="" & name & "" end if categories(catcount)=mylink catcount=catcount+1 catrs.MoveNext Wend setsessa "categories",categories setsess "catcount",catcount catrs.Close set catrs=nothing ShopCloseDatabase catdbc end if ' catcount=getsess("catcount") categories=getsessa("categories") 'response.write NavCatTable for i = 0 to catcount-1 mylink=categories(i) 'response.write NavCatRow & NavCatColumn 'response.write mylink 'response.write NavCatColumnend response.write "" response.write "
" response.write mylink response.write "
" next 'response.write "
" exit sub end sub ' MiniCart '******************************************************************* ' Create mini cart ' If passed value "SHORT" it creates a small mini cart '******************************************************************* Sub NavigateShowMiniCart (itype) ' VP-ASP 5.00 dim showtype showtype=ucase(itype) Dim scartItem, arrCart, displayprice dim dualtotal, dualsubtotal, dualprice dim totalquantity, totalproductquantity Dim i, CartFields, total, subtotal, name, quantity, price scartItem = GetSess("CartCount") arrCart = GetSessA("CartArray") If scartitem="" then exit sub if scartitem=0 then exit sub dim hideprice hideprice = false if getconfig("xdisplayprices") <> "Yes" then hideprice = true end if if getconfig("xpriceloggedinonly") = "Yes" then if Getsess ("login") = "" then hideprice = true end if end if If getconfig("Xnavigateminicart")="No" then exit sub response.write "

" If showtype<>"SHORT" Then Response.write Minitable response.write MiniTitleRow response.write MiniNameTitleColumn & minititlefont & getlang("langProductDescription") & "
" & Minifontend response.write MiniPriceColumn & minititlefont & getlang("langProductQuantity") & "" & Minifontend If hideprice <> true then response.write MiniPriceColumn & minititlefont & getlang("langProductPrice") & "" & Minifontend response.write MiniPriceColumn & minititlefont & getlang("langProductTotal") & "" & Minifontend If getconfig("xdualprice")="Yes" then response.write MiniPriceColumn & minititlefont & getlang("langDualPrice") & "" & Minifontend response.write MiniPriceColumn & minititlefont & getlang("langDualTotal") & "" & Minifontend end if end if Response.write "
" & minifont & "" & getlang("langMiniexcludes") & "" & minicolumnend & "
" If Getconfig("xcurrencylink")="Yes" Then dim url, cprice cprice=shopformatnumber(total,getconfig("xdecimalpoint")) url="http://www.x-rates.com/cgi-bin/cgicalc.cgi?value=" & cprice & "&base=" & Getconfig("Xcurrencybase") Response.write "
" & "Convert " & Getconfig("xcurrencybase") & " " & cprice & "" end if end sub Sub NavigateShowMiniCartRight (itype) '**************************** ' VP-ASP 6.00 ' formats the minicart in the right menu ' ' Added functionality to remove extended display when "short" option is passed ' VPASP - Michael - 11 Jan 2006 '**************************** dim showtype, sqlmininav showtype=ucase(itype) Dim scartItem, arrCart, displayprice dim dualtotal, dualsubtotal, dualprice dim totalquantity, totalproductquantity Dim i, CartFields, total, subtotal, name, quantity, price, URLCart scartItem = GetSess("CartCount") arrCart = GetSessA("CartArray") If (scartitem="") OR (scartitem=0) then response.write getlang("langcartisempty") exit sub end if dim hideprice hideprice = false if getconfig("xdisplayprices") <> "Yes" then hideprice = true end if if getconfig("xpriceloggedinonly") = "Yes" then if Getsess ("login") = "" then hideprice = true end if end if If getconfig("Xnavigateminicart")="No" then exit sub If showtype<>"SHORT" Then If hideprice <> true then If getconfig("xdualprice")="Yes" then end if end if end if 'VP-ASP 6.50.4 - xlcid - remove redundant getconfig("xlcid") 'if getconfig("xLCID")<>"" then ' Session.LCID=getconfig("xLCID") ' set user supplied LCID 'end if total = 0 totalquantity=scartitem totalproductquantity=0 For i = 1 to scartItem Quantity =arrCart(cQuantity,i) Price=arrCart(cUnitPrice,i) dualprice=arrCart(cdualPrice,i) If dualprice="" then dualprice=0 name=arrcart(cproductname,i) URLCart=arrCart(cproductid,i) If len(name)>50 then name=mid(name,1,50) end if dim nameconn 'VP-ASP 6.09 - changed below database open to shopopendatabaseP to allow for split databases shopopendatabaseP nameconn 'VP-ASP 6.08 - Show Parent Name before product name, if applicable 'VP-ASP 6.08a - Change variable SQL to SQLMININAV sqlmininav = "select catalogid, highercatalogid, cname from products where catalogid = " & URLCart dim namers, cname, pname set namers = nameconn.execute(sqlmininav) if not namers.eof then if namers("highercatalogid") > "" then cname = namers("cname") cname = translatelanguage(nameconn, "products", "cname","catalogid", namers("catalogid"), cname) 'VP-ASP 6.08a - Change variable SQL to SQLMININAV sqlmininav = "select catalogid, cname from products where catalogid = " & namers("highercatalogid") set namers = nameconn.execute(sqlmininav) if not namers.eof then pname = namers("cname") pname = translatelanguage(nameconn, "products", "cname","catalogid", namers("catalogid"), pname) name= pname & " - " & cname else name=translatelanguage(nameconn, "products", "cname","catalogid", arrCart(cProductid,i), name) end if else name=translatelanguage(nameconn, "products", "cname","catalogid", arrCart(cProductid,i), name) end if else name=translatelanguage(nameconn, "products", "cname","catalogid", arrCart(cProductid,i), name) end if closerecordset namers shopclosedatabase nameconn subtotal=quantity*price dualsubtotal=quantity*dualprice total=total+subtotal dualtotal=dualtotal+dualsubtotal totalproductquantity=totalproductquantity+quantity Price=shopformatcurrency(price,getconfig("xdecimalpoint")) If showtype<>"SHORT" Then %> <%else%> <%=name%> <%end if%>
<%=quantity%> <% dim exdsql, exdrs, exdconn ShopOpenDatabaseP exdconn exdsql = "select cdescurl from products where catalogid = " & arrCart(cProductid,i) set exdrs = exdconn.execute(exdsql) if not exdrs.eof then 'VP-ASP 6.50 - go to shopquery.asp if it is set in the config if ucase(getconfig("xCrossLinkurl"))="SHOPEXD.ASP" then strDescurl= "shopexd.asp?id=" else strDescurl= "shopquery.asp?catalogid=" end if end if CloseRecordset exdrs ShopCloseDatabase exdconn if isnull(strDescurl) then strdescurl="" end if If strDescURL<>"" then If getconfig("xAddCatalogid")="Yes" then 'VP-ASP 6.08a - added bc=no to stop breadcrumb appearing in page 'VP-ASP 6.50 - go to correct URL 'VP-ASP 6.50 - advanced session handling strDescURL=strDescURL & arrCart(cProductid,i) & "&bc=no" & addwebsesslink end if else If getconfig("xGenerateShopexdLink")="Yes" then strdescurl="shopexd.asp" 'VP-ASP 6.08a - added bc=no to stop breadcrumb appearing in page 'VP-ASP 6.50 - go to correct URL 'VP-ASP 6.50 - advanced session handling strDescURL=strDescURL & arrCart(cProductid,i) & "&bc=no" & addwebsesslink end if end if if strdescurl > "" then%> <%=name%>
  <% If hideprice <> true then If getconfig("xdualprice")="Yes" then dualPrice=formatnumber(dualprice,getconfig("xdecimalpoint"))%>
<%=Price%> <%=ShopFormatDualCurrency(dualsubtotal,getconfig("xdecimalpoint"))%>
<% else response.write Price end if end if %>

<% End If next If showtype<>"SHORT" Then response.write "
" response.write "
" End If if hideprice <> true then If showtype="SHORT" Then response.write getlang("langcart01") & totalproductquantity & "
" End If response.write getlang("langcommonsubtotal") & ": " & shopformatcurrency(total,getconfig("xdecimalpoint")) & vbcrlf If getconfig("xdualprice")="Yes" then response.write ShopFormatDualCurrency(dualtotal,getconfig("xdecimalpoint")) end if end if 'VP-ASP 6.50 - advanced session handling response.write "
" & getlang("langcommonviewcart") & " |" & vbcrlf response.write " " & getlang("langcommoncheckout") & "" & vbcrlf 'VP-ASP 6.09 - add currency link to bottom of minicart If Getconfig("xcurrencylink")="Yes" Then dim url, cprice cprice=shopformatnumber(total,getconfig("xdecimalpoint")) url="http://www.x-rates.com/cgi-bin/cgicalc.cgi?value=" & cprice & "&base=" & Getconfig("Xcurrencybase") Response.write "
" & "Convert " & Getconfig("xcurrencybase") & " " & cprice & "" end if end sub '******************************************************************** ' creates quick go to categories ' currently used in shoppage_header.htm '********************************************************************* Sub NavigateShowAllCategories() If getconfig("xlogonrequired")="Yes" then If getsess("login")="" then exit sub end if end if if getconfig("init")="" then exit sub dim cid, name,catSQL,i dim strcategory, catcount, categories,maxcategories, categoryids, subcategories Dim catdbc,catrs, hassubcategory,mylink dim strpagename catcount=getsess("allcatcount") If catcount="" then catcount=0 If getconfig("xtranslate")="Yes" then catcount=0 end if If catcount=0 then catcount=0 maxcategories=getconfig("xmaxcategories") redim categories(maxcategories) redim categoryids(maxcategories) redim subcategories(maxcategories) ShopOpenDatabaseP catdbc If not catdbc.state=adStateOpen then shopclosedatabase catdbc exit sub end if catSQL="Select * from categories where cathide is null order by catdescription" set catrs=catdbc.execute(catsql) While Not catrs.EOF and catcount
" end sub Sub CorrectBooleanProgram (fieldvalue) 'If it is yes set to 1 else set to 0 If isnull(fieldvalue) or fieldvalue="" then fieldvalue=0 end if ' Dec 31, fix If not isnumeric(fieldvalue) then fieldvalue=0 end if ' If fieldvalue<>0 then fieldvalue=yesnos(0) ' Yes else fieldvalue=yesnos(1) ' no end if end sub Sub CorrectBooleanHuman (fieldvalue) 'If it is yes set to 1 else set to 0 If fieldvalue=yesnos(0) then fieldvalue=1 else fieldvalue=0 end if end sub ' '************************************************************** ' Used in shipping calculation to get total weight including ' feature weight '*********************************************************** ' Get total weight of products Sub GetTotalProductWeight (conn,totalWeight,totalfeatureweight) dim prodid, prodcode, prodname, Prodquantity, ProdPrice, prodweight dim rsitem, deliveryarray, deliverytype, prodfeatures dim i, calculate dim featureweight dim weight, shipsql scartItem = GetSess("CartCount") arrCart = GetSessA("CartArray") totalweight=0 totalfeatureweight=0 ' go through all products For i = 1 to scartItem Calculate=True prodid=arrCart(cProductid,i) prodcode=arrCart(cProductCode,i) prodname= arrCart(cProductname,i) Prodquantity=arrCart(cQuantity,i) ProdPrice=arrCart(cUnitPrice, i) ProdFeatures=arrCart(cProductFeatures, i) Prodweight=arrCart(cProductweight, i) DeliveryArray=arrCart(cDelivery, i) If getconfig("Xdeliveryshipping")="Yes" and isarray(deliveryarray) then Deliverytype=Deliveryarray(dDeliveryType) If Deliveryarray(dDeliveryType)<>getlang("langDeliverySelf") then Calculate=False end if end if If calculate=True then weight=prodweight ' Debugwrite "name=" & prodname & " quantity " & prodquantity & " weight=" & weight if weight<>"" and isnumeric(weight) then weight=cdbl(weight) else weight=0 end if weight=weight*ProdQuantity TotalWeight=weight+totalweight If Getconfig("xfeatureweight")="Yes" and prodfeatures<>"" then GetTotalfeatureweight conn, prodid, prodfeatures, featureweight end if featureweight=featureweight*prodquantity totalfeatureweight=totalfeatureweight+featureweight end if Next TotalWeight=totalweight+Totalfeatureweight SetSess "Totalweight",Totalweight 'debugwrite "totalweight=" & totalweight end sub '********************************************************************* ' features come in as a list 5,9,11 ' reread the feature record and get weight from featureother1 '**************************************************************** Sub GetTotalfeatureweight (dbc, prodid, prodfeatures, featureweight) dim sql, rs, tweight, totalweight, weight dim words(50), wordcount,i featureweight=0 if prodfeatures="" then exit sub parserecord prodfeatures,words,wordcount,"," totalweight=0 for i = 0 to wordcount-1 weight=0 sql="select * from prodfeatures where id=" & words(i) set rs=dbc.execute(sql) if not rs.eof then tweight=rs("featureweight") if not isnull(tweight) then if isnumeric(tweight) then weight=cdbl(tweight) end if end if end if totalweight=totalweight+weight closerecordset rs next featureweight=totalweight 'debugwrite "feature weight=" & totalweight end sub '*********************************************************************** ' write login form for shopcustomer, shopcustadminlogin '************************************************************************ Sub ShopLOginForm_old Dim caption If getconfig("xcustomeruserid")="Yes" then caption=getlang("langAdminUsername") else caption=getlang("langStatusEmail") end if If ucase(getconfig("Xpassword"))="YES" then Response.Write("
") 'Response.Write TableDefLogin response.write "" Response.Write ("") If ucase(getconfig("xPasswordLastname"))="YES" then response.write ("") end if Response.Write("
*" & getlang("langCustLastname") & tablecolumnend & "" & caption & tablecolumnend & "" & "" & tablecolumnend) Response.Write("" & getlang("langLoginPassword") & tablecolumnend & "" & "" & tablecolumnend) response.write "" shopbutton getconfig("xbuttonlogin"),getlang("langcommonlogin"),"" Response.write Tablecolumnend Response.write "
" addwebsessform response.write "
" response.write ("" & getlang("langLoginForgot") & "") else 'RESPONSE.WRITE "
" Response.Write("
") Response.Write("
") 'RESPONSE.WRITE "
" ' Response.Write TableDefLogin Response.Write(tablerow & "") Response.Write("") response.write "
" & getlang("langCustLastname") & tablecolumnend & "" & getlang("langCustEmail") & tablecolumnend & "" shopbutton getconfig("xbuttonlogin"), getlang("langcommonlogin"),"" Response.write Tablecolumnend Response.write "
" addwebsessform response.write "" 'RESPONSE.WRITE "
" end if end sub Sub ShopLOginForm Dim caption If getconfig("xcustomeruserid")="Yes" then caption=getlang("langAdminUsername") else caption=getlang("langStatusEmail") end if %>

<%=getlang("langCust01")%>

<%=getlang("langlogin03")%> <%=getlang("langcommonlogin")%>
<% dim currentpage currentpage = request.ServerVariables("SCRIPT_NAME") currentpage = right(currentpage, len(currentpage) - instrrev(currentpage, "/")) If currentpage = "shopcustadminlogin.asp" then dim rreturn If request.querystring("return") = "rewards" then rreturn="?rreturn=rewards" Else rreturn="" End If If getconfig("xAllowcustomerregister")="Yes" Then%> <%=getlang("langnewcustomerregister01")%>

<%'VP-ASP 6.50 - allow button to be configurable using admin If Getconfig("xbuttonsignup")="" then%>
" onclick="location.href='shopcustregister.asp<%=rreturn%>'">
<%else%>
" value="<%=getlang("langcommonsignup")%>" onclick="location.href='shopcustregister.asp<%=rreturn%>'">
<%end if%> <%end if else%> <%=getlang("langnewcustomerregister02")%>

<%'VP-ASP 6.50 - allow button to be configurable using admin If Getconfig("xbuttonsignup")="" then%>
" onclick="location.href='shopcustomer.asp?new=yes'">
<%else%>
" value="<%=getlang("langcommonsignup")%>" onclick="location.href='shopcustomer.asp?new=yes'">
<%end if%> <%end if%>
<%=getlang("langreturningcustomers")%>
<% If ucase(getconfig("Xpassword"))="YES" then %>
<% If ucase(getconfig("xPasswordLastname"))="YES" then %> <% end if %>
<%=getlang("langCustLastname")%>
<%=caption%>
<%=getlang("langLoginPassword")%>
 
<%shopbutton getconfig("xbuttonlogin"),getlang("langcommonlogin"),""%>
<% addwebsessform %>
<% else %>
<%=getlang("langCustLastname")%> >
<%=getlang("langCustEmail")%>
 
<%shopbutton getconfig("xbuttonlogin"), getlang("langcommonlogin"),""%>
<%addwebsessform%>
<% end if %>
<% end sub '********************************************************************* ' Display all products in a quick shop list '******************************************************************** Sub NavigateShowProducts dim dbc, rs, sql shopopendatabaseP dbc %>
" Closerecordset rs shopclosedatabase dbc end sub Sub NavigateTopTen if getconfig("xtopsellers") <> "Yes" then exit sub If getconfig("xlogonrequired")="Yes" then If GetSess("Login")="" then exit sub end if end if If getconfig("xshopclosed")="Yes" then If Getsess("Login")="Force" then exit sub end if if getsess("shopadmin")="" then shoperror getlang("Langshopclosed") end if end if '****************************************************** ' Find all products sold '******************************************************* dim strsql, dbc, odbc, useorderdb Dim rs strsql="select o.catalogid, sum(o.numitems) as sumofnumitems" strsql=strsql & " from oitems o " if getconfig("xtopsellersprocessedonly") = "Yes" then 'VP-ASP 6.08 - xdatabase was incorrectly used in (instr(lcase(xdatabasetype), "mysql")>0) if ucase(xdatabasetype)="SQLSERVER" OR getconfig("xmysql") = "Yes" OR (instr(lcase(xdatabasetype), "mysql")>0) then strsql=strsql & ", orders p WHERE o.orderid=p.orderid and p.oprocessed=1" else strsql=strsql & ", orders p WHERE o.orderid=p.orderid and p.oprocessed=TRUE" end if end if strsql=strsql & " GROUP BY o.catalogid" 'VP-ASP 6.08 - xdatabase was incorrectly used in (instr(lcase(xdatabasetype), "mysql")>0) if getconfig("xmysql") = "Yes" OR (instr(lcase(xdatabasetype), "mysql")>0)then strsql=strsql & " ORDER BY sumofnumitems DESC" else strsql=strsql & " ORDER BY sum(o.numitems) DESC" end if 'strsql="select sum(oitems.numitems) as sumofnumitems, oitems.catalogid AS catalogid " 'strsql=strsql & "from oitems " 'strsql=strsql & "inner join products on oitems.catalogid = products.catalogid " 'strsql=strsql & "where products.highercatalogid IS NULL " 'strsql=strsql & "GROUP BY oitems.catalogid " 'strsql=strsql & "UNION " 'strsql=strsql & "select sum(oitems.numitems) as sumofnumitems, products.highercatalogid AS catalogid " 'strsql=strsql & "from oitems " 'strsql=strsql & "inner join products on oitems.catalogid = products.catalogid " 'strsql=strsql & "where NOT products.highercatalogid IS NULL " 'strsql=strsql & "GROUP BY products.highercatalogid " 'strsql=strsql & "ORDER BY sumofnumitems DESC " openorderdb odbc set rs=odbc.execute(strsql) TopTenProducedetail odbc,rs closerecordset rs shopclosedatabase odbc end sub '****************************************************************** ' Format the top ten products '******************************************************************* 'VP-ASP 6.08 - Sub re-written to hide out of stock products Sub TopTenProduceDetail (dbc,rs) dim count, fieldvalue, prs, scriptresponder, filename, lngcatalogid, ordercount,hideprod dim strcname, strhcname, psql, pdbc,lnghighercatalogid dim limit limit=cint(getconfig("xtopsellerlimit")) if limit = "" or isnull(limit) then limit = 5 end if 'limit=10 count=0 Response.write "" do While Not rs.EOF and count "" then lnghighercatalogid = prs("highercatalogid") else lnghighercatalogid = "" end if end if closerecordset prs 'VP-ASP 6.50 - added 'childhide' to sql below to stop hidden child products from showing if lnghighercatalogid > "" then '------------------------------------------ ' VP-ASP 6.50.4 Bugs Fix - 08 October 2008 '------------------------------------------ psql="select hp.ccategory, hp.catalogid, hp.cimageurl, p.cprice, p.cname AS cname, p.cstock as cstock, hp.cname AS hpcname, hp.hide AS hphide, p.productmatch, p.customermatch, p.hide AS childhide, hp.cdescription, p.pother1 as pother1 from products p, products hp where p.highercatalogid = hp.catalogid AND p.catalogid =" & lngcatalogid else psql="select *, hide AS hphide, hide AS childhide from products where catalogid=" & lngcatalogid end if set prs=pdbc.execute(psql) If not prs.eof then ' response.write prs("cname") & "/" & count & "/" & limit & "
" 'VP-ASP 6.50 - added 'childhide' to sql below to stop hidden child products from showing if ((prs("hphide") = 1) or (lcase(prs("hphide")) = "true")) OR ((prs("childhide") = 1) or (lcase(prs("childhide")) = "true")) then hideprod = true end if if getconfig("xstockcontrol")= "Yes" then dim stocklowlevel if getconfig("xstocklow") = "" or ISNULL(getconfig("xstocklow")) then stocklowlevel = 0 else stocklowlevel = getconfig("xstocklow") end if 'VP-ASP 6.09 - If stockcontrol is on and the stock field of product was blank, there was an error here. dim dbproductstock dbproductstock = prs("cstock") if isNull(dbproductstock) Or dbproductstock = "" Then dbproductstock = 0 end if if cint(dbproductstock) <= cint(stocklowlevel) then hideprod = true end if ' if cint(prs("cstock")) <= cint(stocklowlevel) then ' hideprod = true ' end if end if 'VP-ASP 6.50.4 - updated code below to handle new product matching method 'VP-ASP 6.09 - only show product matching products 'if getconfig("xproductmatch")="Yes" then ' if lcase(prs("productmatch")) <> lcase(xproductmatch) then ' hideprod = true ' end if 'end if if getconfig("xproductmatch")="Yes" then Dim aryInput,strShopList,i strShopList = prs("productmatch") if strShopList <> "" then aryInput = Split(strShopList,",") for i = 0 to Ubound(aryInput) if lcase(aryInput(i)) <> lcase (xproductmatch) then hideprod = true else 'xproductmatch is in the list, exit the loop hideprod = false exit for end if Next else ' if productmatch field is empty, then show the product to all stores. hideprod = false end if end if 'VP-ASP 6.09 - only show customer matching products if getconfig("xproductmatchcustomer")="Yes" then if (lcase(prs("customermatch")) <> lcase(getsess("customerProductgroup"))) AND (NOT prs("customermatch") = "") then hideprod = true end if end if if hideprod <> true then Response.write "
" response.write "" Response.write "" count=count+1 end if end if closerecordset prs shopclosedatabase pdbc rs.movenext loop %>
" dim rc prs.movefirst ShopTemplateWrite "tmp_topsellers.htm", prs, rc response.write "
<% end sub Sub Navigateshowalphabet '********************************************************************** ' create a list of letters with hyperlink to display products starting with ' those letters ' If your language has different characters please replace them in myarray '**************************************************************************** dim alphaarray(100), alphak, letters, alphacount If getconfig("xalphabetdisplay")<>"Yes" then exit sub letters = getconfig("xalphabet") if letters="" then exit sub parserecord letters,alphaarray, alphacount,"," 'response.write TableDef & tablerow & tablecolumn for alphak=0 to alphacount-1 response.write "" & alphaarray(alphak) & "" response.write " " next 'response.write tablecolumnend & tablerowend & tabledefend End Sub Function GetProductOrderTotal dim Prodquantity, ProdPrice dim scartItem,arrCart, total scartItem = GetSess("CartCount") arrCart = GetSessA("CartArray") total=0 ' go through all products For i = 1 to scartItem Prodquantity=arrCart(cQuantity,i) ProdPrice=arrCart(cUnitPrice, i) total=total+prodquantity*prodprice Next SetSess "Productordertotal",Total GetProductOrderTotal=total end function Function NavigateProducttotal Dim i, stotal, iqtytotal Dim arrCart, cartcount Dim Quantity iQtyTotal = 0 stotal=0 arrCart = GetSessA("CartArray") cartcount=getsess("cartcount") For i = 1 to cartcount Quantity =arrCart(cQuantity,i) sTotal = sTotal + Quantity * cDbl("0" & arrCart(cUnitPrice,i)) iQtyTotal = iQtyTotal + Quantity Next navigateproducttotal= shopformatcurrency(sTotal,getconfig("xdecimalpoint")) end function Function NavigateProductQuantity Dim i, stotal, qtytotal Dim arrCart, cartcount Dim Quantity QtyTotal = 0 arrCart = GetSessA("CartArray") cartcount=getsess("cartcount") For i = 1 to cartcount Quantity =arrCart(cQuantity,i) Qtytotal = Qtytotal + Quantity Next navigateproductquantity=QtyTotal end function Function GenerateDateList (name, currentvalue, maxvalue, daysofweek, excludelist) dim i, j, count, downame, currentdate, displaypart dim value, dow, dayscount, daysarray(10) dim selected, excludes(10), excludecount parserecord daysofweek, daysarray,dayscount, "," If excludelist<>"" then parserecord excludelist, excludes, excludecount,"," for i=0 to excludecount-1 If not isnumeric(excludes(i)) then excludes(i)=0 excludes(i)=clng(excludes(i)) next end if currentdate=currentvalue If not isdate(currentdate) then currentdate=date() else currentdate=cdate(currentdate) end if count=0 value="" Generatedatelist=value end function '**************************************************************************** ' SQL injection Function '*************************************************************************** function Gettextfield(fieldname) dim fieldvalue dim badchars, i 'VP-ASP 6.50 - precautionary security fix fieldvalue=cleanchars(request(fieldname)) 'VP-ASP 6.50.4 - removed extra checking code - all done in cleanchars now gettextfield=fieldvalue end function '**************************************************************************** ' SQL injection Function '*************************************************************************** function GetIntField(fieldname) dim fieldvalue 'VP-ASP 6.50 - precautionary security fix fieldvalue=cleanchars(request(fieldname)) if fieldvalue<>"" then if not isnumeric(fieldvalue) then fieldvalue="" end if end if GetIntField=fieldvalue end function '************************************************************** ' Used in shipping calculation to get total weight including ' feature weight '*********************************************************** ' Get total weight of products Sub CalculateShippingdetails (conn,totalWeight,totalfeatureweight, cost, quantity) dim prodid, prodcode, prodname, Prodquantity, ProdPrice, prodweight dim rsitem, deliveryarray, deliverytype, prodfeatures dim i, calculate dim featureweight dim weight, shipsql dim projectorder,projectcnt scartItem = GetSess("CartCount") arrCart = GetSessA("CartArray") totalweight=0 totalfeatureweight=0 quantity=0 cost=0 '------------------------------------------ ' VP-ASP 6.50.4 Bugs Fix - 16 October 2008 '------------------------------------------ 'HANDLE FREE SHIPPING FOR PROJECTS 'VPASP 15 April 2008 projectorder=true projectcnt=0 ' go through all products For i = 1 to scartItem Calculate=True prodid=arrCart(cProductid,i) '------------------------------------------ ' VP-ASP 6.50.4 Bugs Fix - 08 October 2008 '------------------------------------------ 'HANDLE FREE SHIPPING FOR PROJECTS 'VPASP 15 April 2008 If getconfig("xprojectcatalogid") <> "" Then If CLng(prodid) <> CLng(getconfig("xprojectcatalogid")) Then projectorder = False else projectcnt=projectcnt+1 End If End If prodcode=arrCart(cProductCode,i) prodname= arrCart(cProductname,i) Prodquantity=arrCart(cQuantity,i) ProdPrice=arrCart(cUnitPrice, i) ProdFeatures=arrCart(cProductFeatures, i) Prodweight=arrCart(cProductweight, i) calculate=checkdeliveryfree(conn, prodid) If calculate=True then weight=prodweight ' Debugwrite "name=" & prodname & " quantity " & prodquantity & " weight=" & weight if weight<>"" and isnumeric(weight) then weight=cdbl(weight) else weight=0 end if weight=weight*ProdQuantity TotalWeight=weight+totalweight If Getconfig("xfeatureweight")="Yes" and prodfeatures<>"" then GetTotalfeatureweight conn, prodid, prodfeatures, featureweight end if featureweight=featureweight*prodquantity totalfeatureweight=totalfeatureweight+featureweight quantity=quantity+prodquantity cost=cost+(prodquantity*prodprice) end if Next TotalWeight=totalweight+Totalfeatureweight '------------------------------------------ ' VP-ASP 6.50.4 Bugs Fix - 08 October 2008 '------------------------------------------ 'HANDLE FREE SHIPPING FOR PROJECTS 'VPASP 15 April 2008 If projectorder = True Then totalweight=0 totalfeatureweight=0 quantity=0 cost=0 if projectcnt=scartItem then SetSess "ShipMethod","" SetSess "smprice",0 end if End If 'Debugwrite "weight=" & totalweight & " cost=" & cost & "quantity=" & quantity SetSess "Totalweight",Totalweight 'debugwrite "totalweight=" & totalweight end sub '************************************************************************ ' read product record to see if it has free shiping ' returns true if product does NOT have free shipping '*************************************************************************** Function CheckDeliveryFree(prodconn, prodid) ' returns true if product should be used in calculation dim psql, prs, rc, shippingfree rc=true ' ignore specific products from any shipping calculate if false is returned If getconfig("xshippingfreeproducts")<>"Yes" then checkdeliveryfree=rc exit function end if 'VP-ASP 6.09 - always have free shipping for gift certs if prodid = getconfig("xgiftproductid") then rc=false checkdeliveryfree=rc exit function end if psql="select * from products where catalogid=" & prodid set prs=prodconn.execute(psql) if not prs.eof then shippingfree=prs("freeshipping") if not isnull(shippingfree) then if shippingfree<>0 then rc=false end if end if end if closerecordset prs checkdeliveryfree=rc end function Sub ShopConvertCurrencyLink (total, link) link="" dim msg If Getconfig("xproductconvertcurrency")<>"Yes" Then exit sub dim url, cprice cprice=shopformatnumber(total,getconfig("xdecimalpoint")) msg=getlang("langconvert") & " " & cprice url="" url=url & msg url=url & "" link=url end sub ' '**************************************************************** ' creates category drop down list '*************************************************************** Sub NavigateShowContent() If getconfig("xlogonrequired")="Yes" then If getsess("login")="" then exit sub end if end if If getconfig("init")="" then exit sub dim cid, name,catSQL,i, contentlist, contentarray, contentcount dim strcategory, catcount, maxcontentarray, strpagename Dim catdbc,catrs, prevname,mylink contentcount=getsess("contentcount") If contentcount="" then contentcount=0 If contentcount=0 then maxcontentarray=20 redim contentarray(maxcontentarray) ShopOpenDatabase catdbc If not catdbc.state=adStateOpen then shopclosedatabase catdbc exit sub end if catSQL="Select * from content where hide=0 " catSQL=catsql & " order by messagetype,contentid desc" set catrs=catdbc.execute(catsql) While Not catrs.EOF and contentcountlcase(prevname) then mylink=name contentarray(contentcount)=name contentcount=contentcount+1 prevname=name end if catrs.MoveNext Wend setsessa "contentarray",contentarray setsess "contentcount",contentcount catrs.Close set catrs=nothing ShopCloseDatabase catdbc end if contentcount=getsess("contentcount") contentarray=getsessa("contentarray") If contentcount="" then exit sub if contentcount=0 then exit sub %>
" end sub ' ' '*************************************************************************** ' display all categories and their subcategories ' VP-ASP 5.00 ' Nov 29, 2004 '***************************************************************************** Sub NavigateShowCategorylist dim sql, rs, level, rc, catdescription, spacing, categoryid dim highercategoryid, hassubcategory Dim dbconn highercategoryid=0 shopopendatabaseP dbconn navGeneratesql sql, highercategoryid set rs=dbconn.execute(sql) Response.write "" response.write "" response.write "
" do while not rs.eof navGetcategoryfields rs,categoryid, hassubcategory, catdescription, rc, dbconn If rc=0 then spacing=0 FormatcategoryList categoryid, catdescription, spacing If hassubcategory<>"" then Formatsubcategories categoryid,spacing, dbconn end if end if rs.movenext loop closerecordset rs shopclosedatabase dbconn Response.write "
" end sub Sub NavGetcategoryfields (rs, categoryid, hassubcategory, strcategory, rc, catdbc) dim strcathide categoryid=rs("categoryid") strcategory=rs("catdescription") strcategory=translatelanguage(catdbc, "categories", "catdescription","categoryid", categoryid, strcategory) hassubcategory=rs("hassubcategory") If isnull(hassubcategory) then hassubcategory="" end if strcathide=rs("cathide") ' hide field if isnull(strcathide) then rc=0 else rc=4 end if end sub Sub navGeneratesql (sql, highercategoryid) SQL="Select * from categories " sql = Sql & " where highercategoryid=" & highercategoryid if getconfig("xproductmatch")="Yes" then 'VP-ASP 6.50 - enhanced product matching 'sql=sql & " and productmatch='" & xproductmatch & "'" sql=sql & " and " Generateproductmatchsqlsubs sql end if if getconfig("xproductmatchcustomer")="Yes" then if GetSess("CustomerProductGroup")<>"" then sql=sql & " and customermatch='" & getsess("customerProductgroup") & "'" end if end if If getconfig("xselectproductsbylanguage")="Yes" and getsess("language")<>"" then sql=sql & " and (catlanguage='" & getsess("language") & "'" sql=sql & " or catlanguage is null)" end if sql=sql & " order by " & Getconfig("xsortcategories") end sub Sub FormatcategoryList (id, name, spacing) dim i If spacing>0 then for i = 0 to spacing response.write "  " next end if response.write "" & name & "" & "
" & vbcrlf end sub Sub Formatsubcategories (categoryid, spacing, dbconn) dim sql, rs, rc, catdescription, hassubcategory navGeneratesql sql, categoryid Set rs=dbconn.execute(sql) spacing=spacing+1 do while not rs.eof navGetcategoryfields rs,categoryid, hassubcategory, catdescription, rc, dbconn If rc=0 then FormatcategoryList categoryid, catdescription, spacing If hassubcategory<>"" then Formatsubcategories categoryid, spacing, dbconn end if end if rs.movenext loop spacing=spacing-1 closerecordset rs end sub '****************************************************************************** ' associated products could be ' crossselling ' also bought '*************************************************************************** Sub FormatassociatedProducts (dbc, sql, headercaption, displaylimit) dim rs, strcDescURL, strurl, tempname, strmessage, tempcatalogid, tempdesc dim limit, dcount If Getconfig("Xcrosssellingimage")="Yes" then FormatAssociatedwithImages dbc, sql, headercaption, displaylimit exit sub end if dim hideprice hideprice = false if getconfig("xdisplayprices") <> "Yes" then hideprice = true end if if getconfig("xpriceloggedinonly") = "Yes" then if Getsess ("login") = "" then hideprice = true end if end if if displaylimit="" then limit=99999 else limit=clng(displaylimit) end if dcount=0 set rs=dbc.execute(sql) if not rs.eof then%> <%=headercaption%> <%end if Do While Not rs.EOF and dcount <%if hideprice <> true then%> <%else%> <%end if%> <% 'strMessage=strMessage & "
" & tempname & "" RS.MoveNext dcount=dcount+1 loop closerecordset rs %>
<%=tempname%> <%=tempdesc%><%=shopformatcurrency(rs("cprice"), getconfig("xdecimalpoint"))%> 
<% 'strMessage="
" & headercaption & strMessage 'Response.write strmessage end sub '***************************************************************** ' Cros Selling with images '**************************************************************** Sub FormatAssociatedwithImages (dbc, sql, headercaption, displaylimit) dim rs dim headerok dim limit, dcount if displaylimit="" then limit=99999 else limit=clng(displaylimit) end if dcount=0 set rs=dbc.execute(sql) If rs.eof then closerecordset rs exit sub end if %><%=Headercaption%>
<% 'Response.write reporttabledef & reportheadrow & ReportHeadColumn 'Response.write 'Response.write ReportHeadColumnEnd & reportrowend & tabledefend & reporttabledef headerok=true Do While Not rs.EOF and dcount

<% end if end sub '********************************************************************** ' format one row of crossselling. ' all products must have an image '************************************************************************** Sub FormatAssociatedrow (rs) dim hideprice hideprice = false if getconfig("xdisplayprices") <> "Yes" then hideprice = true end if if getconfig("xpriceloggedinonly") = "Yes" then if Getsess ("login") = "" then hideprice = true end if end if dim catalogid, imagefile, cname, cprice, url, cdescription dim buttonimage, buttontext, buttonname buttonimage=Getconfig("xbuttonmoreinfo") buttontext=getlang("langProductExtendeddescription") buttonname="View" if isNull(buttonimage) Or buttonimage="" then buttonimage="" end if catalogid=rs("catalogid") imagefile=rs("cimageurl") URL=rs("cdescurl") If isnull(url) then URL=getconfig("xCrossLinkURL") end if if ucase(URL)="SHOPEXD.ASP" then url="shopexd.asp?id=" & rs("catalogid") & "&bc=no" else url="shopquery.asp?catalogid=" & rs("catalogid") & "&bc=no" end if 'VP-ASP 6.50 - advanced session handling url = addwebsess(url) ' add translate cname=rs("cname") cdescription = rs("cdescription") dim assocdbc shopopendatabase assocdbc cname=translatelanguage(assocdbc, "products", "cname","catalogid", catalogid, cname) cdescription = translatelanguage(assocdbc, "products", "cdescription","catalogid", catalogid, cdescription) shopclosedatabase assocdbc 'Response.write reportdetailrow %>
<%=cname%>
<%=cdescription%>
<%if hideprice <> true then %> <%=getlang("langourprice")%>: <%=shopformatcurrency(rs("cprice"), getconfig("xdecimalpoint"))%>
<%end if%>

<%=getlang("langproductclick")%>

<% 'response.write "
 <%=getlang("langipwarn01")%>
  <%=request.ServerVariables("REMOTE_ADDR") & "
"%>
  <%=getlang("langipwarn02")%>
<% End If End Sub sub inserturchinstats if getconfig("xurchinstats") = "Yes" then 'VP-ASP 6.09 - Updated Urchin SSL URL%> <%end if end sub Sub NavigateFeaturedProducts If getconfig("xlogonrequired")="Yes" then If GetSess("Login")="" then exit sub end if end if If getconfig("xshopclosed")="Yes" then If Getsess("Login")="Force" then exit sub end if if getsess("shopadmin")="" then shoperror getlang("Langshopclosed") end if end if dim strsql, dbc, odbc, useorderdb Dim rs strsql="select *, cstock AS sumofnumitems from products where " if ucase(xdatabasetype)="SQLSERVER" OR getconfig("xmysql") = "Yes" OR (instr(lcase(xdatabasetype), "mysql")>0) then strsql=strsql & " featuredflag = 1" else strsql=strsql & " featuredflag = TRUE" end if shopopendatabaseP odbc set rs=odbc.execute(strsql) TopTEnProducedetail odbc,rs closerecordset rs shopclosedatabase odbc end sub '**************************************************************************** ' xproductmatch can be a list of shopids ' a,b,ddd,ee ' add them all to the sql '************************************************************************** Sub GenerateProductmatchsqlsubs (sql) dim shops(50), shopcount, i parserecord xproductmatch, shops, shopcount,"," ' get all shops allowed sql=sql & " (" for i = 0 to shopcount-1 If i>0 then sql=sql & " or " end if sql=sql & " productmatch like '%" & shops(i) & "%'" next sql=sql & " or productmatch is null)" end sub '**************************************************************************** ' vpasp 6.50 ' xproductmatch can be a list of shopids ' a,b,ddd,ee ' add them all to the sql '************************************************************************** Sub GenerateProductmatchsqlsubscat (sql) dim shops(50), shopcount, i parserecord xproductmatch, shops, shopcount,"," ' get all shops allowed sql=sql & " (" for i = 0 to shopcount-1 If i>0 then sql=sql & " or " end if sql=sql & " productmatch like '%" & shops(i) & "%'" next 'VP-ASP 6.5 - removed " and highercategoryid = 0" from line below sql=sql & " or (productmatch is null))" end sub %> <% '************************************************************* ' Language subroutines ' VP-ASP 6.50 ' Sept 19, 2004 Fix open on navigate show languages '*********************************************************** '********************************************************************** ' creates dropdown list of languages '********************************************************************* Sub Navigateshowlanguages dim languages, langcount,force, conn, i, name dim currentlang, selected If getconfig("init")="" then exit sub currentlang=lcase(Getsess("language")) force="" Readlanguages languages, langcount,Force 'If langcount=0 then exit sub ' If langcount=1 then exit sub %>
" end sub '*************************************************************** ' Get languages from language file or array '***************************************************************** Sub Readlanguages (languages, langcount, force) dim cid, name,catSQL,i, conn dim maxlangs, catrs,mylink langcount=0 If getconfig("xlogonrequired")="Yes" then If getsess("login")="" then exit sub end if end if If getconfig("init")="" then exit sub end if langcount=getsess("Alllangcount") languages=getsessa("AllLanguages") If langcount="" then langcount=0 If force<>"" then langcount=0 end if If langcount=0 then maxlangs=20 redim languages(maxlangs) ShopOpenDatabase conn If not conn.state=adStateOpen then shopclosedatabase conn exit sub end if catSQL="SELECT lang from languages GROUP BY lang" set catrs=conn.execute(catsql) While Not catrs.EOF and langcount <% ' April 20,2003 VP-ASP 6.50 Sub Getlkeystring(istr, url) dim ordernumber dim prefix url=request.servervariables("SERVER_NAME") url=lcase(url) url=replace(url,"http://","") url=replace(url,"https://","") prefix=left(url,4) if prefix="www." then length=len(url)-4 url=right(url,length) end if If url="127.0.0.1" then url="localhost" Ordernumber=xordernumber istr="oid=" & ordernumber & " url=" & url end sub ' Sub ValidateCliKey (istr,url, result) dim words(10),wordcount, i dim prefix,hashkey Result="No" hashkey=calcMD5(istr) If Getconfig("Xlicensekey")="" then if lcase(url)="localhost" or url="127.0.0.1" then result="Yes" else If xlicensekey="Demo" then result="Yes" end if end if else if lcase(url)="localhost" or url="127.0.0.1" then result="Yes" else parserecord getconfig("xlicensekey"), words, wordcount, " " for i=0 to wordcount-1 If words(i)=hashkey then result="Yes" exit for end if next end if end if setconfig shoplcname,result end sub %> <% '********************************************************* ' VP-ASP 6.50 ' MYSQL and Chillisoft subroutines for updating the database ' April 29, 2004, address2, coupon and commission ' June 24, 2004 Issue start date ' August 31, 2004 userid on registration ' Dec 31, 2005 Add mysqlupdatemenu '******************************************************** '------------------------------------------ ' VP-ASP 6.50.4 Bugs Fix - 08 October 2008 '------------------------------------------ dim cdateupdated Sub MYSQLUpdateContact() Dim dbc, sqlo, rso Dim DoUpdate DoUpdate="" dim tlastname tlastname=Getsess("lastname") tlastname=replace(tlastname,"'","''") 'on error resume next OpenCustomerDb dbc If GetSess("CustomerId")<>"" and GetSess("Lastname") <> "" and getconfig("xAllowCustomerUpdates")="Yes" then sql="select * from customers where contactid=" & getsess("customerid") sql=sql & " and lastname='" & tlastname & "'" set objrs=dbc.execute(sql) if not ObjRS.eof then DoUpdate="True" strcustomerid=getsess("customerid") end if closerecordset objrs end if If Doupdate="" then sqlo="insert into customers (lastname) values('" & tlastname & "')" dbc.execute(sqlo) sqlo = "select max(contactid) from customers where lastname='" & tlastname & "'" Set rso = dbc.Execute(sqlo) strcustomerid = rso(0) rso.close set rso=nothing end if sqlo="" mysqltextfield sqlo, "firstname",strfirstname mysqltextfield sqlo, "lastname",strlastname mysqltextfield sqlo, "address",straddress mysqltextfield sqlo, "city",strcity mysqltextfield sqlo, "state",strstate mysqltextfield sqlo, "postcode",strpostcode mysqltextfield sqlo, "phone",strphone mysqltextfield sqlo, "country",strcountry mysqltextfield sqlo, "workphone",strworkphone mysqltextfield sqlo, "mobilephone",strmobilephone mysqltextfield sqlo, "website",strwebsite mysqltextfield sqlo, "email",stremail mysqltextfield sqlo, "fax",strfax mysqltextfield sqlo, "company",strcompany If getconfig("xPassword")="Yes" and strpassword1<>"" then mysqltextfield sqlo,"password", strpassword1 mysqltextfield sqlo,"userid",strcustuserid ' 5.00 end if mysqlboolfield sqlo, "cookiequestion",blncookiequestion mysqlboolfield sqlo, "maillist",blnmaillist ' 4.50 mysqltextfield sqlo,"vatnumber",strvatnumber ' 4.50 mysqltextfield sqlo, "hearaboutus",strhearaboutus '5.00 mysqltextfield sqlo, "address2",straddress2 '5.10 if getconfig("xCustomerOtherfields")<>"" then MYSQLCustomerUpdateFields sqlo ' update additional end if sqlo="update customers " & sqlo & " where contactid=" & strcustomerid 'debugwrite sqlo Set rso=dbc.execute(sqlo) ShopCloseDatabase dbc UpdateCustomerSessionData ' 2.4 SetSess "customerid",strCustomerID end sub '*************************************************************************** ' add sql to sql string if the value is something otherwise set to null '************************************************************************** Sub mysqltextfield (isql,fieldname,fieldvalue) dim tfieldvalue 'on error resume next if fieldvalue="" then tfieldvalue="NULL" else 'VP-ASP 6.50 - security update 'tfieldvalue=replace(fieldvalue,"'","''") tfieldvalue=cleanchars(fieldvalue) end if If getconfig("xdebug")="Yes" then Debugwrite fieldname & " " & tfieldvalue & "
" end if if isql="" then isql="SET " else isql=isql &"," end if If tfieldvalue="NULL" then isql=isql & fieldname & "=" & tfieldvalue else isql=isql & fieldname & "='" & tfieldvalue & "'" end if end Sub '*************************************************************************** ' add sql to sql string if the value is something otherwise set to null '************************************************************************** Sub mysqlnumbfield (isql,fieldname,fieldvalue) on error resume next 'VP-ASP 6.09 - change exit sub to NULL if fieldvalue="" then 'exit sub fieldvalue="NULL" else 'VP-ASP 6.50 - security update fieldvalue = cleanchars(fieldvalue) end if If getconfig("xdebug")="Yes" then Debugwrite fieldname & " " & tfieldvalue & "
" end if if isql="" then isql="SET " else isql=isql &"," end if isql=isql & fieldname & "=" & fieldvalue end Sub '********************************************************************** ' set value to 1 or 0 depending on current setting '*********************************************************************** Sub mysqlboolfield (isql,fieldname,fieldvalue) dim tfieldvalue on error resume next if fieldvalue="" then exit sub end if If fieldvalue=TRUE then tfieldvalue=1 else tfieldvalue=0 end if if isql="" then isql="SET " else isql=isql &"," end if isql=isql & fieldname & "='" & tfieldvalue & "'" end Sub '******************************************************* ' add order to database '****************************************************** Sub MYSQLAddOrder Dim arrCart, scartItem, orderdbc Dim dbc Dim oid, sqlo Dim i, features dim rso dim supplierid, productaddress, currentordernumber dim tlastname, ipaddress dim newdate, newtime arrCart = GetSessA("CartArray") ' get shopping cart data scartItem = GetSess("CartCount") OpenOrderdb orderdbc If GetSess("Orderid")<>"" then CancelOrderRecord orderdbc,getsess("orderid") SetSess "Orderid","" end if GetCustomerSessionData ' make sure we have session into local Errors="" ' no errors If getconfig("xConvertEuropeanNumbers")="Yes" then PerformNumberConversion end if tlastname=replace(strlastname,"'","''") sqlo="insert into orders (olastname) values('" & tlastname & "')" orderdbc.execute(sqlo) ' debugwrite sqlo sqlo = "select max(orderid) from orders where olastname='" & tlastname & "'" Set rso = orderdbc.Execute(sqlo) oid = Clng(rso(0)) CurrentOrdernumber=oid Setsess "oid",oid rso.Close set rso=nothing sqlo="" MYSQLNumbField sqlo,"ocustomerid", strCustomerid If getconfig("xTimeDifference")="" then MYSQLtextField sqlo, "odate", datenormalize(date()) MYSQLtextField sqlo, "otime", formatdatetime(Time(),vbshorttime) else adjustdate newdate MYSQLtextField sqlo, "odate", datenormalize(newdate) adjusttime newtime MYSQLtextField sqlo, "otime", newtime end if mysqlnumbfield sqlo,"orderamount", getsess("ordertotal") mysqltextfield sqlo,"olastname",strlastname mysqltextfield sqlo,"ofirstname",strfirstname mysqltextfield sqlo,"oemail",stremail mysqltextfield sqlo,"oaddress",straddress mysqltextfield sqlo,"ocity",strcity mysqltextfield sqlo,"opostcode",strpostcode mysqltextfield sqlo,"ostate",strstate mysqltextfield sqlo,"ophone", strphone if lcase(left(getsess("shipmethod"), 4)) = "
" then mysqltextfield sqlo,"oshipmethodtype",getsess("shipmethodtype") & " " & getsess("shipmethod") else mysqltextfield sqlo,"oshipmethodtype",getsess("shipmethod") end if ' mysqltextfield sqlo,"oshipmethodtype",getsess("shipmethod") mysqlnumbfield sqlo,"oshipcost",replace(getsess("smprice"), "$","") mysqlnumbfield sqlo,"otax",getsess("taxes") mysqlnumbfield sqlo,"opst",getsess("pst") '6.5 mysqltextfield sqlo,"ocountry",strcountry mysqltextfield sqlo,"ofax", strfax mysqltextfield sqlo,"ocompany", strcompany mysqltextfield sqlo,"ocomment",strshipcomment mysqltextfield sqlo,"oshipname", getsess("shipname") mysqltextfield sqlo,"oshipaddress",getsess("shipaddress") mysqltextfield sqlo,"oshiptown",getsess("shiptown") mysqltextfield sqlo,"oshipzip", getsess("shipzip") mysqltextfield sqlo,"oshipstate",getsess("shipstate") mysqltextfield sqlo,"oshipcountry",getsess("shipcountry") mysqltextfield sqlo, "oshipcompany", getsess("shipcompany") mysqlnumbfield sqlo, "odiscount", getsess("discount") mysqlnumbfield sqlo, "ohandling", getsess("handling") mysqlnumbfield sqlo, "oaffid", getsess("affid") mysqlnumbfield sqlo, "canceled", 0 ipaddress=request.servervariables("REMOTE_ADDR") mysqltextfield sqlo,"ipaddress",ipaddress mysqlnumbfield sqlo, "hackeryesno",0 mysqltextfield sqlo,"vatnumber",getsess("vatnumber") mysqltextfield sqlo, "oerrors", errors 'write errors to database If getconfig("xdualprice")="Yes" then mysqlnumbfield sqlo,"odualtotal",GetSess("dualtotal") mysqlnumbfield sqlo,"odualshipping",GetSess("dualshipping") mysqlnumbfield sqlo,"odualtaxes",GetSess("dualtaxes") mysqlnumbfield sqlo,"odualpst",GetSess("dualpst") '6.5 mysqlnumbfield sqlo,"odualdiscount",GetSess("dualdiscount") mysqlnumbfield sqlo,"odualhandling",GetSess("dualhandling") end if mysqltextfield sqlo,"coupon", getsess("coupon") ' saved order info mysqlnumbfield sqlo,"coupondiscount", getsess("coupondiscount") ' saved order info mysqlnumbfield sqlo,"coupondiscountdual", getsess("coupondiscountdual") ' saved order info mysqltextfield sqlo,"giftcertificate",getsess("giftcertificate") mysqlnumbfield sqlo,"giftamountused",getsess("giftamountused") mysqlnumbfield sqlo, "giftamountuseddual",getsess("giftamountuseddual") mysqltextfield sqlo,"shipmessage",Getsess("Shipmessage") ' 5.0 mysqltextfield sqlo,"hearaboutus",Getsess("hearaboutus") ' 5.0 mysqltextfield sqlo,"oaddress2",Getsess("address2") ' 5.50 mysqltextfield sqlo,"oshipaddress2",Getsess("shipaddress2") ' 5.50 mysqltextfield sqlo,"deliverydate",Getsess("deliverydate") ' 5.50 mysqltextfield sqlo,"deliverytime",Getsess("deliverytime") ' 5.50 'VP-ASP 6.08a - Product Total wasn't being added mysqlnumbfield sqlo,"producttotal",Getsess("OrderProductTotal") 'VP-ASP 6.50 - add flag to order to say customer has agreed to terms mysqltextfield sqlo,"otermsagreed",Getsess("Licenseagreement") 'VP-ASP 6.50 - add selected currency and exchange rate to order record mysqltextfield sqlo,"ocurrency",Getsess("cid") mysqltextfield sqlo,"ocurrencyrate",Getsess("Conversionvalue") If Getconfig("xcustomerotherfieldsinorder")="Yes" then if getconfig("xcustomerotherfields")<>"" then Mysqlorderupdatefields sqlo end if end if if getconfig("xshippingotherfields")<>"" then Mysqlshippingupdatefields sqlo end if sqlo="update orders " & sqlo & " where orderid=" & oid ' debugwrite sqlo orderdbc.execute(sqlo) SetSess "orderid",oid SetSess "oid", oid ' add Items To Database Dim isql,xdualprice For i = 1 To scartItem supplierid = arrCart(csupplierid,i) if supplierid<>"" and isnumeric(supplierid) then else supplierid = 0 end if xdualprice = arrCart(cdualprice,i) if xdualprice<>"" and isnumeric(xdualprice) then else xdualprice = 0 end if productaddress="NULL" features = arrCart(cProductFeatures,i) if features="" then features="NULL" else features="'" & features & "'" end if if getconfig("XdeliveryAddress")="Yes" then ConvertDeliverytoString arrCart(cDelivery,i), ProductAddress If ProductAddress="" then ProductAddress="NULL" else Productaddress="'" & normalizefield(productaddress) & "'" end if end if 'VP-ASP 6.50 - allow customer to upload image to order isql="insert into oitems (orderid, catalogid, numitems,itemname, customerimage, unitprice,dualprice,supplierid,address,features) " isql = isql & "Values (" isql=isql & oid & "," & arrCart(cProductid,i) & "," & arrCart(cQuantity,i) isql=Isql & ",'" & normalizefield(arrCart(cProductname,i)) & "', '" & arrCart(cgraphicname1,i) & "'," & arrCart(cUnitPrice,i) &"," & xdualprice isql=Isql & "," & supplierid &"," & productaddress & "," & features isql=isql & ")" 'debugwrite isql orderdbc.execute(isql) Next ShopCloseDatabase orderdbc End Sub '************************************************************** ' add gift record to database '************************************************************** Sub MYSQLAddGiftRecord (certificate, email, i ) Dim giftexpires, today dim sqlo, giftid,gsql Dim DoUpdate DoUpdate="" today=date() giftexpires=dateadd("d",date(),getconfig("xgiftexpirydays")) gsql="insert into gifts (giftnumber) values('" & certificate & "')" dbc.execute(gsql) gsql="select max(giftid) from gifts where giftnumber='" & certificate & "'" set objrs=dbc.execute(gsql) giftid=objrs(0) objrs.close set objrs=nothing sqlo="" mysqltextfield sqlo,"giftnumber", certificate mysqltextfield sqlo,"giftissuedate", datenormalize(date()) mysqltextfield sqlo,"giftexpirydate", datenormalize(giftexpires) mysqlnumbfield sqlo,"giftamount", getsess("giftamount") if i = 0 then mysqltextfield sqlo,"gifttoname", getsess("gifttoname") else mysqltextfield sqlo,"gifttoname", email end if mysqltextfield sqlo,"giftfromname", getsess("giftfromname") mysqltextfield sqlo,"gifttoemail", email mysqltextfield sqlo,"giftfromemail", getsess("giftfromemail") mysqltextfield sqlo,"giftmessage", getsess("giftmessage") mysqltextfield sqlo,"giftorderid", getsess("oid") mysqltextfield sqlo,"giftcustomerid", getsess("customerid") mysqlnumbfield sqlo,"giftamountremaining", getsess("giftamount") gsql="update gifts " & sqlo & " where giftid=" & giftid dbc.execute(gsql) SetSess "GiftId",oid end sub Sub MYSQLUpdateOrderDatabase dim i, recordnum, giftproductid Dim strSQl, nameincart NameinCart=getlang("LangGiftCertificate") for i = 0 to Giftcount nameincart=nameincart & "
" & Giftnums(i) next strsql = "update oitems set itemname='" & nameincart & "',numitems=" & giftcount & " where orderid = " & getsess("oid") strsql = strsql & " and catalogid=" & getconfig("xgiftproductid") dbc.execute(strsql) end sub Sub MYSQLGiftDecrementAmountUsed(certificate,amountused, msg) '************************************************************************ ' Update gift certificate amount tto reflect amount used ' Giftused=certificate ' Giftusedamount=amount used" '************************************************************************ Dim myconn, customerid dim strSql msg="" dim giftnumber, giftusedamount, amount, gidtusedtrace, giftusedcount Dim orderid, giftrace Giftnumber=certificate GiftUsedamount=amountused customerid=getsess("Customerid") orderid=getsess("oid") Shopopendatabase myconn strsql="select * from gifts where giftnumber='" & Giftnumber & "'" Set objrs=myconn.execute(strsql) if not objrs.eof then giftrace=objrs("giftusedtrace") giftusedcount=objrs("giftusedcount") amount=objrs("giftamountremaining") objrs.close set objrs=nothing If amount>= amountused then amount=amount-GiftUsedamount giftusedcount=giftusedcount+1 strSQL = "update gifts set " strsql=strsql & " giftamountremaining=" & amount strsql=strsql & ",giftusedlastamount=" & giftusedamount strsql=strsql & ",giftuseddate=" & datedelimit(date()) strsql=strsql & ",giftusedcustomerid=" & customerid strsql=strsql & ",giftusedorderid=" & orderid strsql=strsql & ",giftusedcount=" & giftusedcount If isnull(giftrace) then Giftrace="" else Giftrace=giftrace & ";" end if Giftrace=Giftrace & orderid & "," & giftusedamount strsql=strsql & ",giftusedtrace='" & giftrace & "'" strSql=StrSql & "where giftnumber='" & Giftnumber & "'" ' debugwrite strsql myconn.execute(strsql) shopclosedatabase myconn exit sub else msg=getlang("LangGiftPartlyUsed") msg=msg & " " & shopformatcurrency(amount,xdecimalpoint) end if else msg=getlang("LangGiftNotFound") objrs.close set objrs=nothing end if Shopclosedatabase myconn End sub Sub MYSQLGiftRestoreAmountUsed(certificate,amountused) '************************************************************************ ' Update gift certificate amount tto reflect amount used ' Giftused=certificate ' Giftusedamount=amount used" '************************************************************************ dim myconn dim strSql dim giftnumber, giftusedamount, amount Giftnumber=certificate GiftUsedamount=amountused Shopopendatabase myconn strSQL = "select * FROM gifts where giftnumber='" & Giftnumber & "'" Set objRS = myconn.execute(strsql) If Not objrs.eof then amount=objrs("giftamountremaining") amount=amount+giftusedamount closerecordset objrs strSQL = "update gifts set " strsql=strsql & " giftamountremaining=" & amount strsql=strsql & ",giftamountrused=" & giftusedamount strsql=strsql & ",giftuseddate=" & datenormalize(date()) strsql=strsql & " where giftnumber='" & Giftnumber & "'" myconn.execute(strsql) else closerecordset objrs end if Shopclosedatabase myconn End sub ' '************************************************************** ' search capture '*************************************************************** Sub MYSQLDoSearchCapture '******************************************************** ' Store search results in seach table '******************************************************* dim dbc Dim Subcategories dim servername,sql, id, objrs, sqlo, usql 'on error resume next servername=request.servervariables("HTTP_HOST") ShopOpenOtherDB dbc,getconfig("XSearchDb") sql="insert into searchresults (ipaddress) values('" & servername & "')" dbc.execute(sql) sql="select max(ID) from searchresults where ipaddress='" & servername & "'" set objrs=dbc.execute(sql) id=objrs(0) objrs.close set objrs=nothing sqlo="" ' mysqltextfield sqlo, "categories",strcategory mysqltextfield sqlo,"categories",chosencategory ' getsubcategories subcategories ' mysqltextfield sqlo,"subcategories",subcategories ' mysqltextfield sqlo,"words",strkeyword dim updatesearchstring if allwordsString > "" then updatesearchstring = "ALL: " & allwordsString end if if exactString > "" then if updatesearchstring > "" then updatesearchstring = updatesearchstring & " / " end if updatesearchstring = updatesearchstring & "EXACT: " & exactString end if if atleastString > "" then if updatesearchstring > "" then updatesearchstring = updatesearchstring & " / " end if updatesearchstring = updatesearchstring & "AT LEAST: " & atleastString end if if withoutString > "" then if updatesearchstring > "" then updatesearchstring = updatesearchstring & " / " end if updatesearchstring = updatesearchstring & "WITHOUT: " & withoutString end if mysqltextfield sqlo,"words", updatesearchstring mysqltextfield sqlo,"lastname", getsess("lastname") mysqltextfield sqlo,"customerid", getsess("customerid") mysqltextfield sqlo,"ipaddress", servername mysqltextfield sqlo,"rdate", datenormalize(date()) mysqltextfield sqlo, "rtime",mysqltimenormalize(time()) usql="update searchresults " & sqlo usql=usql & " where id=" & id dbc.execute(usql) ShopCloseDatabase dbc end sub ' Function mysqlTimeNormalize(itime) mysqlTimenormalize=formatdatetime(itime,vbshorttime) end function '****************************************************************** ' additional customer fields '******************************************************************* ' Sub MYSQLCustomerUpdateFields (sqlo) dim words,wordcount,i, customerfieldcount dim cfieldname, fieldvalue if getconfig("xCustomerOtherFields")="" then exit sub redim words(Getconfig("xCustomermaxotherfields")) on error resume next Parserecord getconfig("xcustomerOtherFields"), words, wordcount,"," for i = 0 to wordcount-1 cfieldname="c_" & words(i) fieldvalue=getsess(cfieldname) ' debugwrite words(i) & "=" & fieldvalue If fieldvalue<>"" then mysqltextfield sqlo, words(i),fieldvalue end if next end sub ' Sub MYSQLUpdateRating dim whereok, sqlo dim doupdate, templastname, which dim rsql,rstemp rsql="Insert into reviews (catalogid) Values(" & catalogid & ")" dbc.execute(rsql) rsql="SELECT MAX(id) FROM reviews where catalogid=" & catalogid set rstemp=dbc.execute(rsql) which=rstemp(0) rstemp.close set rstemp=nothing rsql="" sqlo="" mysqlnumbfield sqlo, "catalogid",catalogid mysqlnumbfield sqlo, "rating",ratingstars mysqltextfield sqlo, "title",ratingtitle mysqltextfield sqlo, "comment",ratingcomment mysqltextfield sqlo, "location",ratinglocation mysqltextfield sqlo, "reviewdate",datenormalize(date()) 'VP-ASP 6.09 - added formatdatetime mysqltextfield sqlo, "reviewtime",formatdatetime(time(), vbshorttime) mysqltextfield sqlo, "name",ratingname If getconfig("xratingauthorize")<>"Yes" then mysqltextfield sqlo, "authorized",trim(getlang("LangcommonYes")) end if 'VP-ASP 6.50.2 - save email address If ratingemail<>"" then mysqltextfield sqlo, "email", ratingemail end if rsql ="update reviews " & sqlo & " where id=" & which 'debugwrite "rsql=" & rsql dbc.execute(rsql) set rstemp=dbc.execute("select * from reviews where id=" & which) SendMailToMerchant rstemp rstemp.close set rstemp=nothing end sub '********************************************************************* ' Update affiliate '******************************************************************** Sub MYSQLUpdateAffiliate Dim doupdate, sqlo, rso doupdate="" ShopOpenOtherDB dbc,getconfig("xaffiliateDB") If GetSess("affRegister")<>"" then LngAffid=Getsess("AffRegister") SQL="Select * from affiliates Where affid=" & lngaffid OpenRecordset dbc, objrs, sql if not ObjRS.eof then DoUpdate="True" end if closerecordset objrs end if If Doupdate="" then dim templastname templastname=replace(affstrlastname,"'","''") sqlo="insert into affiliates (lastname) values('" & templastname & "')" dbc.execute(sqlo) sqlo="select max(affid) from affiliates where lastname='" & templastname & "'" set rso=dbc.execute(sqlo) lngaffid=rso(0) rso.close set rso=nothing SetSess "AffRegister","" end if sqlo="" mysqltextfield sqlo,"firstname", affstrfirstname mysqltextfield sqlo,"lastname", affstrlastname mysqltextfield sqlo,"address", affstraddress mysqltextfield sqlo,"city", affstrcity mysqltextfield sqlo,"state", affstrstate mysqltextfield sqlo,"postcode", affstrpostcode mysqltextfield sqlo,"country", affstrcountry mysqltextfield sqlo,"company", affstrcompany mysqltextfield sqlo,"phone", affstrphone mysqltextfield sqlo,"website", affstrwebsite mysqltextfield sqlo,"fax", affstrfax mysqltextfield sqlo,"email", affstremail mysqltextfield sqlo,"comment", affstrcomment mysqltextfield sqlo,"typeofpayment", affstrtypeofpayment mysqltextfield sqlo,"bank", affstrbank mysqltextfield sqlo,"bankaccount", affstrbankaccount mysqltextfield sqlo,"bankbranch", affstrbankbranch mysqltextfield sqlo,"bankaddress", affstrbankaddress mysqltextfield sqlo,"bankother", affstrbankother 'mysqltextfield sqlo,"[password]", affstrpassword mysqltextfield sqlo,"password", affstrpassword mysqlnumbfield sqlo, "referralid", lngreferralid if doupdate="" then mysqlnumbfield sqlo,"commissionrate", getconfig("affcommissionrate") mysqltextfield sqlo,"directurl", getconfig("affdirecturl") mysqlnumbfield sqlo,"mastercommissionrate", getconfig("affmastercommissionrate") end if sqlo="Update affiliates " & sqlo & " where affid=" & lngaffid ' debugwrite sqlo dbc.execute(sqlo) shopclosedatabase dbc end sub '********************************************************************** ' update customer record '********************************************************************** Sub MYSQLUpdateCustomer Dim dbc, sqlo, rso Dim DoUpdate, customerid DoUpdate="" 'on error resume next customerid=Getsess("Customerid") dim templastname OpenCustomerDb dbc templastname=replace(strlastname,"'","''") SQL = "SELECT * FROM " & dbtable & " WHERE contactid= " & Customerid Openrecordset dbc, objrs, sql If objrs.eof then closerecordset objrs objrs.close shopclosedatabase dbc Serror="Customer id not found " & customerid exit sub end if sqlo="" mysqltextfield sqlo, "firstname",strfirstname mysqltextfield sqlo, "lastname",strlastname mysqltextfield sqlo, "address",straddress 'VP-ASP 6.091 - add address2 to database mysqltextfield sqlo, "address2",straddress2 mysqltextfield sqlo, "city",strcity mysqltextfield sqlo, "state",strstate mysqltextfield sqlo, "postcode",strpostcode mysqltextfield sqlo, "country",strcountry mysqltextfield sqlo, "phone",strphone mysqltextfield sqlo, "workphone",strworkphone mysqltextfield sqlo, "mobilephone",strmobilephone mysqltextfield sqlo, "website",strwebsite mysqltextfield sqlo, "email",stremail mysqltextfield sqlo, "company",strcompany mysqltextfield sqlo, "hearaboutus",strhearaboutus If ucase(blnmaillist)="FALSE" then blnmaillist=0 If ucase(blnmaillist)="TRUE" then blnmaillist=1 mysqlnumbfield sqlo, "maillist",blnmaillist mysqltextfield sqlo, "Fax",strFax If getconfig("xPassword")="Yes" and strpassword1<>"" then mysqltextfield sqlo,"password", strpassword1 end if if getconfig("xCustomerOtherfields")<>"" then MYSQLCustomerUpdateFields sqlo ' update additional end if sqlo="Update customers " & sqlo & " where contactid=" & customerid 'debugwrite sqlo Set rso=dbc.execute(sqlo) ShopCloseDatabase dbc UpdateCustomerSessionData end sub Sub MYSQLMaillistUpdateCustomer dim dbc, doupdate, rso DoUpdate="" 'on error resume next 'VP-ASP 6.09 - Start Security Fix dim templastname, whereok, sqlo, tempemail OpenCustomerDb dbc templastname=replace(strlastname,"'","''") tempemail=replace(stremail,"'","''") SQL = "SELECT * FROM " & dbtable & " WHERE " whereok="" sql=sql & whereok & " lastname='" & TempLastName & "'" whereok = " AND " SQL = SQL & whereok & " email='" & tempemail & "'" 'VP-ASP 6.09 - End Security Fix openrecordset dbc, objrs, sql if not ObjRS.eof then DoUpdate="True" strcustomerid=objrs("contactid") 'VP-ASP 6.09 - add customerid to session SetSess "customerid", strCustomerID end if closerecordset objrs If Doupdate="" then sqlo="Insert into customers (lastname) VALUES('" & templastname & "')" ' debugwrite sqlo dbc.execute(sqlo) sqlo = "select max(contactid) from customers where lastname='" & templastname & "'" Set rso = dbc.Execute(sqlo) strcustomerid = rso(0) 'VP-ASP 6.09 - add customerid to session SetSess "customerid", strCustomerID rso.close set rso=nothing end if sqlo="" mysqltextfield sqlo, "firstname",strfirstname mysqltextfield sqlo, "lastname",strlastname mysqltextfield sqlo, "address",straddress mysqltextfield sqlo, "city",strcity mysqltextfield sqlo, "state",strstate mysqltextfield sqlo, "postcode",strpostcode mysqltextfield sqlo, "country",strcountry mysqltextfield sqlo, "email",stremail mysqltextfield sqlo, "phone",strphone mysqltextfield sqlo, "workphone",strworkphone mysqltextfield sqlo, "mobilephone",strmobilephone mysqltextfield sqlo, "website",strwebsite mysqltextfield sqlo, "fax",strfax mysqltextfield sqlo, "password",strpassword1 mysqltextfield sqlo, "userid",strcustuserid mysqltextfield sqlo, "contactreason",maillistkey mysqltextfield sqlo, "company",strcompany ' fix july 7 If ucase(blnmaillist)="FALSE" then blnmaillist=0 If ucase(blnmaillist)="TRUE" then blnmaillist=1 mysqlnumbfield sqlo, "maillist",blnmaillist if getconfig("xCustomerOtherfields")<>"" then MYSQLCustomerUpdateFields sqlo ' update additional end if sqlo="Update customers " & sqlo & " Where contactid=" & strcustomerid ' debugwrite sqlo Set rso=dbc.execute(sqlo) ShopCloseDatabase dbc end sub '**************************************************************** ' update product in admin section '***************************************************************** Sub MYSQLUpdateProduct dim sqlo dim rso dim filtersql dim tcname 'VP-ASP 6.09 - unused due to new features selection list 'GetProductFeatures GetCrossSelling2 If ActionType="FIX" then lngcatalogid=GetSess("productID") '========================= 'VP-ASP 600 - insertion of date product was added '12/10/2005 '========================= cdateupdated = now() ' time and date product last updated '========================= else tcname=replace(strcname,"'","''") '========================= 'VP-ASP 600 - insertion of date product was added '12/10/2005 '========================= sqlo="Insert into products (cname,cdateadded,cdateupdated) VALUES('" & tcName & "', " & datedelimit(now()) & ", " & datedelimit(now()) & ")" '========================= myconn.execute(sqlo) sqlo = "SELECT max(catalogid) FROM products where cname='" & tcName & "'" Set rso = myconn.Execute(sqlo) lngCatalogid = rso(0) rso.close set rso=nothing end if sqlo="" mysqltextfield sqlo,"ccode", strccode mysqltextfield sqlo,"cname", strcname mysqltextfield sqlo,"cdescription", memcdescription mysqlnumbfield sqlo,"cprice", curcprice 'mysqlnumbfield sqlo,"ccategory", lngccategory mysqltextfield sqlo,"category", strcategory mysqltextfield sqlo,"features", strfeatures '========================= 'VP-ASP 600 - insertion of page impressions '12/10/2005 '========================= if (strimpressions = "") or (isnull(strimpressions)) then strimpressions = 0 end if mysqltextfield sqlo,"impressions", strimpressions '========================= mysqltextfield sqlo,"cimageurl", strcimageurl 'VP-ASP 6.50 - added extra image fields mysqltextfield sqlo,"extraimage1", strimageextra1 mysqltextfield sqlo,"extraimage2", strimageextra2 mysqltextfield sqlo,"extraimage3", strimageextra3 mysqltextfield sqlo,"extraimage4", strimageextra4 mysqltextfield sqlo,"extraimage5", strimageextra5 mysqltextfield sqlo,"buttonimage", strbuttonimage mysqltextfield sqlo,"cdescurl", strcdescurl ' If datcdateavailable<>"" then datcdateavailable=datenormalize(datcdateavailable) end if mysqltextfield sqlo,"cdateavailable", datcdateavailable mysqlnumbfield sqlo,"cstock", lngcstock mysqltextfield sqlo,"weight", strweight mysqltextfield sqlo,"mfg", strmfg ' mysqltextfield sqlo,"pother1", strpother1 mysqltextfield sqlo,"pother2", strpother2 mysqltextfield sqlo,"pother3", strpother3 mysqltextfield sqlo,"pother4", strpother4 mysqltextfield sqlo,"pother5", strpother5 mysqltextfield sqlo,"level3", strlevel3 mysqltextfield sqlo,"level4", strlevel4 mysqltextfield sqlo,"level5", strlevel5 mysqlnumbfield sqlo,"subcategoryid", lngsubcategoryid mysqltextfield sqlo,"specialoffer", strspecialoffer mysqlnumbfield sqlo,"retailprice", strretailprice mysqltextfield sqlo,"allowusertext", strallowusertext mysqltextfield sqlo,"featuredflag", strfeaturedflag '6.50 mysqltextfield sqlo,"customerimage", strcustomerimage '6.50 mysqltextfield sqlo,"rmadays", strrmadays '6.50 mysqltextfield sqlo,"template", strtemplate '========================= 'VP-ASP 600 - insertion of template for shopdisplayproducts listing '14/10/2005 '========================= mysqltextfield sqlo,"templatelisting", strtemplatelisting '========================= mysqltextfield sqlo,"extendeddesc", memexdesc mysqltextfield sqlo,"extendedimage", strextendedimage mysqltextfield sqlo,"selectlist", strselectlist mysqltextfield sqlo,"keywords", strkeywords mysqltextfield sqlo,"minimumquantity", strminimumquantity mysqlnumbfield sqlo,"supplierid", strsupplierid mysqltextfield sqlo,"crossselling", strcrossselling If boolhide="" then boolhide=0 end if mysqlnumbfield sqlo,"hide", boolhide mysqltextfield sqlo, "clanguage", strclanguage mysqltextfield sqlo, "groupfordiscount", strgroupfordiscount mysqltextfield sqlo,"orderattachment", strattachment mysqltextfield sqlo,"orderdownload", strdownload mysqltextfield sqlo,"customermatch", strcustomermatch mysqltextfield sqlo,"productmatch", strproductmatch mysqlnumbfield sqlo,"points", strpoints mysqlnumbfield sqlo,"pointstobuy", strpointstobuy mysqlnumbfield sqlo,"price2", strprice2 mysqlnumbfield sqlo,"price3", strprice3 mysqlnumbfield sqlo,"maximumquantity", strmaximumquantity mysqltextfield sqlo,"frontpage", strfrontpage mysqlnumbfield sqlo,"billprice",strbillprice mysqlnumbfield sqlo,"billinstallments",strinstallments mysqltextfield sqlo,"billinstallmenttype",strinstallmenttype mysqlnumbfield sqlo,"billinterval",strinstallmentinterval mysqlnumbfield sqlo,"taxfree", strtaxfree ' 5.50 mysqlnumbfield sqlo,"freeshipping", strfreeshipping ' 5.50 mysqlnumbfield sqlo,"highercatalogid", strhighercatalogid ' 6.0 mysqltextfield sqlo,"hassubproduct", strHasSubProduct ' 6.0 mysqltextfield sqlo,"spdisplaytype", strSPDisplayType ' 6.0 if strproductuserid="" then mysqltextfield sqlo,"userid", getsess("shopadmin") ' user that added product else mysqltextfield sqlo,"userid", strproductuserid ' user that added product end if mysqlupdateproductotherfields sqlo sqlo="Update products " & sqlo & " where catalogid=" & lngcatalogid ' debugwrite sqlo myconn.execute(sqlo) SetSess "ProductID",lngCatalogID 'UpdateCategory lngCatalogId, strCategoryList, strsubcategorylist UpdateCategory lngCatalogId, strCategoryList, lngccategory End Sub Sub MYSQLUpdateSupplier Dim doupdate, sqlo, rso doupdate="" OpenCustomerDb dbc If getsess("supplierid")<>"" then strsupplierid=Getsess("Supplierid") Set objRS = Server.CreateObject("ADODB.Recordset") SQL="Select * from suppliers Where supplierid=" & strsupplierid objRS.open SQL, dbc, adOpenKeyset, adLockOptimistic, adcmdText if not ObjRS.eof then DoUpdate="True" objRS.update else objRs.close set objRS=nothing end if end if If Doupdate="" then sqlo="Insert into suppliers (lastname) Values('" & strLastname & "')" dbc.execute(sqlo) sqlo="select max(supplierid) from suppliers where lastname='" & strlastname & "'" set rso=dbc.execute(sqlo) strsupplierid=rso(0) rso.close set rso=nothing end if sqlo="" mysqlupdatesupplierfield sqlo, "supplieruserid",struserid 'mysqlupdatesupplierfield sqlo, "userid",struserid mysqlupdatesupplierfield sqlo, "name",strsuppliername mysqlupdatesupplierfield sqlo, "firstname",strfirstname mysqlupdatesupplierfield sqlo, "lastname",strlastname mysqlupdatesupplierfield sqlo, "address",straddress mysqlupdatesupplierfield sqlo, "city",strcity mysqlupdatesupplierfield sqlo, "state",strstate mysqlupdatesupplierfield sqlo, "postcode",strpostcode mysqlupdatesupplierfield sqlo, "country",strcountry mysqlupdatesupplierfield sqlo, "company",strcompany mysqlupdatesupplierfield sqlo, "phone",strphone mysqlupdatesupplierfield sqlo, "workphone",strworkphone mysqlupdatesupplierfield sqlo, "mobilephone",strmobilephone mysqlupdatesupplierfield sqlo, "fax",strfax mysqlupdatesupplierfield sqlo, "email",stremail mysqlupdatesupplierfield sqlo, "website",strwebsite 'mysqlupdatesupplierfield sqlo, "password",strpassword1 mysqlupdatesupplierfield sqlo, "supplierpassword",strpassword1 sqlo="Update suppliers " & sqlo & " where supplierid=" & strsupplierid dbc.execute(sqlo) setsess "supplierid",strsupplierid shopclosedatabase dbc writeinfomessage end sub Sub mysqlupdatesupplierfield (sql,fieldname,fieldvalue) if fieldvalue="" then fieldvalue=NULL else fieldvalue=replace(fieldvalue,"'","''") end if If sql="" then sql="SET " else sql=sql & "," end if sql = sql & fieldname & "='" & fieldvalue &"'" end Sub '********************************************************************** ' numerous routines acll this routine to either add or update 'a record. if updateaction=nothin then add a record otherwise edit record ' The fields are in the form ' globval dbtable, idfield are necessary '************************************************************************* Sub MYSQLProcessrecord (updateaction, conn, dbtable, idfield, which) If updateaction<>"" then MYSQLEditRecord conn, dbtable, idfield, which else MYSQLAddRecord conn, dbtable, idfield, which end if end sub ' '*************************************************************************** ' know record exists. ' generate sql and update the record '************************************************************ Sub MYSQLEditRecord (conn, dbtable, idfield, which) dim sqltemp, updatesql sqltemp="select * from " & dbtable sqltemp= sqltemp & " where " & idfield & "=" & which set rstemp=conn.execute(sqltemp) MYSQLGenerateEditSQL updatesql rstemp.close set rstemp=nothing on error resume next updatesql ="update " & dbtable & " " & updatesql & " where " & idfield & "=" & which if getconfig("xdebug")="yes" then debugwrite updatesql end if conn.execute(updatesql) sError= sError & "
" & getlang("LangEdit03") & "" end sub ' ******** general Sql Sub MYSQLGenerateEditSQL(updatesql) Dim howmanyfields dim fieldname, fieldvalue, fieldtype dim i updatesql="" howmanyfields=rstemp.fields.count -1 for i=1 to howmanyfields fieldname = rstemp(i).name fieldtype=rstemp(i).type 'VP-ASP Security Fix 'February 2008 '------------------------------------------ ' VP-ASP 6.50.4 Bugs Fix - 16 October 2008 ' remove cleanchars since it is only used for admin site '------------------------------------------ 'fieldvalue = cleanchars(request.form(fieldname)) fieldvalue = request.form(fieldname) ' debugwrite "fn=" & fieldname & "ft=" & fieldtype 'VP-ASP 6.09 - check if higercategoryid has been set to categoryID for categories if lcase(dbtable) = "categories" then if lcase(fieldname) = "highercategoryid" then if clng(fieldvalue) = clng(which) then serror=serror & "Higher Category ID is the same as the Category ID! Please change the Higher Category ID for this record.
" end if end if end if 'VP-ASP 6.09 - if fieldtype is TIME then format it before writing to database if fieldtype = 134 then if fieldvalue > "" then fieldvalue = formatdatetime(fieldvalue, vbshorttime) end if end if MYSQLEUpdatefield updatesql,fieldname,fieldvalue,fieldtype next end sub Sub MYSQLEUpdateField (updatesql,fieldname, fieldvalue,fieldtype) 'on error resume next 'Debugwrite fieldname & " value=" & fieldvalue & " fieldtype=" & fieldtype if getconfig("xdebug")="yes" then Debugwrite fieldname & " value=" & fieldvalue & " fieldtype=" & fieldtype end if if fieldname="featuremulti" then mysqladjustfieldNull fieldname,fieldvalue end if If updatesql="" then updatesql="SET " else updatesql= updatesql & "," end if if fieldvalue="" then 'VP-ASP 6.50.2 - add date updated where required if lcase(fieldname) = "cdateupdated" then '------------------------------------------ ' VP-ASP 6.50.4 Bugs Fix - 08 October 2008 '------------------------------------------ fieldvalue = "'" & datenormalize(now()) &"'" else fieldvalue="NULL" end if else MYSQLNormalizeFieldValue fieldname, fieldvalue,fieldtype end if updatesql=updatesql & fieldname & "=" & fieldvalue end sub Sub MYSQLAddRecord (conn, dbtable, idfield, which) Dim rso, tempsql Dim sqlo dim fieldname dim fieldvalue dim fieldtype dim thing dim strSQL, sqltemp, howmanyfields, rstemp, i dim xxnames, xxvalues xxnames="" xxvalues="" sqltemp="select * from " & dbtable Set rstemp = Server.CreateObject("ADODB.Recordset") rstemp.open sqltemp, conn, 1, 3 howmanyfields=rstemp.fields.count -1 idfield=rstemp(0).name for i=1 to howmanyfields fieldname = rstemp(i).name fieldtype=rstemp(i).type 'VP-ASP Security Fix 'February 2008 fieldvalue = cleanchars(request.form(fieldname)) 'VP-ASP 6.50.2 - set date added and updated where required if lcase(fieldname) = "cdateadded" then fieldvalue = now() elseif lcase(fieldname) = "cdateupdated" then fieldvalue = now() end if MYSQLAAUpdatefield xxnames,xxvalues,fieldname,fieldvalue, fieldtype next rstemp.close set rstemp=nothing sqlo="Insert into "& dbtable & "(" & xxnames & ") values(" & xxvalues & ")" conn.execute(sqlo) strSQL="SELECT MAX(" & idfield & ") FROM " & dbtable set rstemp=conn.execute(strsql) which=rstemp(0) end sub Sub MYSQLAAUpdateField (xxnames, xxvalues,fieldname, fieldvalue, fieldtype) if fieldvalue="" then exit sub end if MYSQLNormalizeFieldvalue fieldname, fieldvalue,fieldtype If xxnames="" then xxnames=fieldname xxvalues=fieldvalue else xxnames=xxnames & "," & fieldname xxvalues=xxvalues & "," & fieldvalue end if end sub Sub MYSQLNormalizeFieldValue (fieldname, Fieldvalue,fieldtype) dim tfieldtype select case fieldtype case "134" fieldvalue = formatdatetime(fieldvalue, vbshorttime) case "133" If isdate(fieldvalue) then fieldvalue=datenormalize(fieldvalue) end if case "6", "4", "5" ' currency exit sub case "11" if isnumeric(fieldvalue) then exit sub If ucase(fieldvalue)="FALSE" then fieldvalue=0 exit sub else fieldvalue=1 end if exit sub Case "16" ' tinyint MYsqlAdjustfieldvalue fieldvalue exit sub end select fieldvalue=replace(fieldvalue,"'","''") fieldvalue="'" & fieldvalue & "'" end sub ' add credit card info to order Sub MYSQLUpdateCreditInfo dim CVN, newcardno, oauthorization, ucardno Dim dbc OpenOrderDB dbc sqltemp="" if strOCardType<> "" then ' Credit card ucardno=strocardno Encryptkey=Getencryptkey If getconfig("xEncryptCreditcard")="Yes" and encryptkey<>"" then newcardno=EnDecrypt(strocardno, encryptkey) ucardno=Converttoplain(newcardno) end if mysqlupdatefield "ocardtype",strocardtype mysqlupdatefield "ocardno",ucardno mysqlupdatefield "ocardname", strocardname mysqlupdatefield "ocardexpires",strocardexpires mysqlupdatefield "ocardaddress", strocardaddress if strOCardCVN<>"" then CVN="CVN " & stroCardCVN oauthorization=cvn end if if strocardissue<>"" Then If oauthorization="" Then oauthorization=getlang("langcardissue") &"=" & strocardissue else oauthorization=" " & oauthorization & " " & getlang("langcardissue") &"=" & strocardissue end if end if if strvalidfrom<>"" then oauthorization=oauthorization & " " & getlang("langvalidfromdate") &"=" & strvalidfrom end if mysqlUpdateField "oauthorization", oauthorization else ' Other payment mysqlupdatefield "ocardtype",stroother mysqlupdatefield "ocardname", stromore paymenturl="" end if sqltemp="update orders " & sqltemp & " where orderid=" & oid 'debugwrite sqltemp dbc.execute(sqltemp) ShopcloseDatabase dbc End Sub Sub mysqlUpdateField (fieldname, fieldvalue) if fieldvalue="" then exit sub end if if sqltemp="" then sqltemp="SET " else sqltemp=sqltemp &"," end if sqltemp=sqltemp & fieldname & "='" & fieldvalue & "'" end sub Function Normalizefield(fieldvalue) Normalizefield = replace (fieldvalue,"'","''") end function Sub FormatMonthChilli month=cint(month) if Year="0" then Year=Datepart("yyyy",date()) else Year=clng(year) end if fromdate= month & "/1" & "/" & Year month=month+1 if month = 13 then month=1 Year=Year+1 end if Todate= month & "/1" & "/" & Year 'debugwrite "fromdate=" & fromdate 'debugwrite "todate=" & todate fromdate=cdate(fromdate) todate=cdate(todate) todate = dateadd("d",-1, todate) end sub Sub formatYearChilli Year=clng(year) month=1 fromdate= month & "/" & "01/" & Year Year=Year+1 Todate= month & "/01/" & Year fromdate=cdate(fromdate) todate=cdate(todate) todate=dateadd("d",-1,todate) end sub Sub mysqlUpdateStockLevels (catalogid, quantity,stockconn) dim rsproduct, sql dim myconn dim stock sql ="select cstock from products where catalogid=" & catalogid set rsproduct=stockconn.execute(sql) If rsproduct.eof then rsproduct.close set rsproduct=nothing exit sub else stock=rsproduct("cstock") stock=stock-quantity end if rsproduct.close set rsproduct=nothing sql="update products set cstock=" & stock & " where catalogid=" & catalogid stockconn.execute(sql) end sub Sub MYSQLUpdateCategory (dbc) Dim doupdate, sqlo, rso, filtersql doupdate="" If updateaction<>"" then doupdate="True" infomsg= strcatdescription & getlang("LangProductUpdated") & " - " & GetSess("CategoryID") & "
" lngcategoryid=getsess("categoryid") end if If Doupdate="" then sqlo="Insert into categories (catdescription) Values('" & strcatdescription & "')" ' debugwrite sqlo dbc.execute(sqlo) sqlo="select max(categoryid) from categories where catdescription='" & strcatdescription & "'" set rso=dbc.execute(sqlo) lngcategoryid=rso(0) rso.close set rso=nothing Setsess "categoryID",lngcategoryid Infomsg= strcatdescription & getlang("LangProductAdded") & " - " & GetSess("categoryID") & "
" end if sqlo="" mysqltextField sqlo,"catdescription",strcatdescription mysqltextField sqlo,"catimage",strcatimage mysqlnumbField sqlo,"highercategoryid",lnghighercategoryid mysqltextField sqlo,"hassubcategory",strcathassubcategory mysqltextField sqlo,"catextra",strcatextra 'VP-ASP 6.50 - extra category fields mysqltextField sqlo,"catextra2",strcatextra2 mysqltextField sqlo,"catextra3",strcatextra3 mysqltextField sqlo,"cathide",strcathide mysqltextField sqlo,"productmatch",strcatproductmatch mysqltextField sqlo,"customermatch",strcatcustomermatch mysqltextField sqlo,"catmemo",strcatmemo mysqltextField sqlo,"catlanguage",strcatlanguage mysqltextField sqlo,"catproducttemplate",strcattemplate sqlo="Update categories " & sqlo & " where categoryid=" & lngcategoryid ' debugwrite sqlo dbc.execute(sqlo) end sub Sub MYSQLUpdateREgistrant() Dim dbc, sqlo, rso Dim DoUpdate DoUpdate="" 'on error resume next OpenCustomerDb dbc If GetSess(REGISTRANTID)<>"" then Set objRS = Server.CreateObject("ADODB.Recordset") sql="select * from registrant where registrantid=" & getsess(REGISTRANTID) set objrs=dbc.execute(sql) if not ObjRS.eof then DoUpdate="True" end if CloseRecordset objRs end if If Doupdate="" then sqlo="insert into registrant (lastname) values('" & strlastname & "')" ' debugwrite sqlo dbc.execute(sqlo) sqlo = "select max(registrantid) from registrant where lastname='" & strlastname & "'" Set rso = dbc.Execute(sqlo) Setsess REGISTRANTID, rso(0) CloseRecordset rso end if sqlo="" 'VP-ASP 6.09 - normalize date streventdateend=datenormalize(dateadd("d",cdate(streventdate),xgiftregdays)) mysqltextfield sqlo,"eventtype",streventtype mysqltextfield sqlo,"eventdate",streventdate mysqltextfield sqlo,"eventdateend",streventdateend mysqltextfield sqlo,"lastname",strlastname mysqltextfield sqlo,"copostcode",costrpostcode mysqltextfield sqlo,"sendfirstname",sendstrfirstname mysqltextfield sqlo,"sendaddress",sendstraddress mysqltextfield sqlo,"firstname",strfirstname mysqltextfield sqlo,"address",straddress mysqltextfield sqlo,"sendpostcode",sendstrpostcode mysqltextfield sqlo,"sendphone",sendstrphone mysqltextfield sqlo,"city",strcity mysqltextfield sqlo,"cofirstname",costrfirstname mysqltextfield sqlo,"cocountry",costrcountry mysqltextfield sqlo,"state",strstate mysqltextfield sqlo,"postcode",strpostcode mysqltextfield sqlo,"country",strcountry mysqltextfield sqlo,"costate",costrstate mysqltextfield sqlo,"cophone",costrphone mysqltextfield sqlo,"phone",strphone mysqltextfield sqlo,"coaddress",costraddress mysqltextfield sqlo,"email",stremail mysqltextfield sqlo,"sendcity",sendstrcity mysqltextfield sqlo,"sendcountry",sendstrcountry mysqltextfield sqlo,"colastname",costrlastname mysqltextfield sqlo,"cocity",costrcity mysqltextfield sqlo,"sendlastname",sendstrlastname 'mysqltextfield sqlo,"thankyou",strthankyou mysqltextfield sqlo,"sendstate",sendstrstate mysqltextfield sqlo,"shippingtype",shippingtype 'mysqltextfield sqlo,"publicallowed",strpublicallowed sqlo="update registrant " & sqlo & " where registrantid=" & getsess(REGISTRANTID) 'debugwrite sqlo Set rso=dbc.execute(sqlo) ShopCloseDatabase dbc end sub Sub MYSQLUpdateRegistrantPass dim regid, dbc shopopendatabase dbc regid=GetSess(REGISTRANTID) If strpublicpass="" then strpublicPASS="NULL" else strPublicPass="'" & strpublicpass & "'" end if If strprivatepass="" then strprivatePASS="NULL" else strPrivatePass="'" & strprivatepass & "'" end if If strthankyou="" then strthankyou="NULL" else strthankyou=replace(strthankyou,"'","''") strthankyou="'" & strthankyou & "'" end if if strpublicallowed="" then strpublicallowed=0 else strpublicallowed=1 end if sql="Update registrant set regpassword=" & strprivatepass sql= sql & ",publicpassword=" & strpublicpass sql= sql & ",thankyounote=" & strthankyou sql= sql & ",publicallowed=" & strpublicallowed sql=sql & " where registrantid=" & getsess(REGISTRANTID) debugwrite sql dbc.execute(sql) ShopCloseDatabase dbc end sub '************************************************************** ' if therea re customer other fields, then add them to the order '*************************************************************** Sub MysqlOrderUpdateFields (sqlo) dim words,wordcount,customervalues,i, customerfieldcount dim cfieldname, fieldvalue on error resume next if getconfig("xCustomerOtherFields")="" then exit sub redim words(Getconfig("xCustomermaxotherfields")) Parserecord getconfig("xcustomerOtherFields"), words, wordcount,"," for i = 0 to wordcount-1 cfieldname="c_" & words(i) fieldvalue=getsess(cfieldname) If fieldvalue<> "" then mysqltextfield sqlo,Words(i), fieldvalue end if next end sub '****************************************************************** ' Update other fields in product add '***************************************************************** Sub MysqlUpdateProductOtherFields (sqlo) dim words(50),wordcount,i if getconfig("xProductOtherFields")="" then exit sub If not isarray(Productvalues) then exit sub Parserecord getconfig("xProductOtherFields"), words, wordcount,"," for i = 0 to wordcount-1 If productvalues(i)<> "" then mysqltextfield sqlo, words(i),productvalues(i) end if next end sub Sub MysqlShippingUpdateFields (sqlo) dim words,wordcount,shippingvalues,i, shippingfieldcount dim cfieldname, fieldvalue on error resume next if getconfig("xShippingOtherFields")="" then exit sub redim words(Getconfig("xCustomermaxotherfields")) Parserecord getconfig("xshippingOtherFields"), words, wordcount,"," for i = 0 to wordcount-1 cfieldname="s_" & words(i) fieldvalue=getsess(cfieldname) If fieldvalue<> "" then mysqltextfield sqlo, words(i),fieldvalue end if next end sub Sub MYsqlAdjustfieldvalue (fieldvalue) dim yesvalue yesvalue=trim(getlang("langcommonyes")) If isnumeric(fieldvalue) then exit sub If Fieldvalue=yesvalue then fieldvalue=1 else fieldvalue=0 end if end sub '*********************************************************************** ' Because we now do yes/no '********************************************************************* sub mysqladjustfieldNull (fieldname,fieldvalue) 'If value is Yes then leave otherwise set to null dim novalue novalue=trim(getlang("langcommonNo")) If fieldvalue=Novalue then fieldvalue="" end if end sub '************************************************************ ' Update coupon at end of order '********************************************************** Sub MysqlUpdatecoupon dim objrs, sql, dbc, sqlo, usecount Shopopendatabase dbc sql="select * from coupons where couponname='" & getsess("coupon") &"'" set objRS=dbc.execute(sql) if not ObjRS.eof then usecount=objrs("couponusedcount") if isnull(usecount) then usecount=0 end if usecount=usecount+1 end if if usecount = "" then usecount = 0 end if closerecordset objrs sql="Update coupons set couponusedcount=" & usecount sql= sql & ",couponlastuseddate=" & datedelimit(date()) dbc.execute(sql) shopclosedatabase dbc end sub '********************************************************************** ' Update commission for order '****************************************************************** Sub mysqlupdatecommission (conn, commission, orderid) dim sql sql="update orders set commission=" & commission sql=sql & " where orderid=" & orderid conn.execute(sql) end sub 'VP-ASP 6.00 Sub MYSQLShopAddRegistry (oid) Dim arrCart, scartItem Dim dbc Dim i dim newdate, newtime dim rsitem dim SQLo arrCart = GetSessA("cartarray") ' get shopping cart data scartItem = GetSess("cartcount") ShopOpenDatabase dbc For i = 1 To scartItem sqlo = "insert into registryitems (registrantid, orderid, regcatalogid, numitems, itemname, unitprice, dualPrice, supplierid, numpurchased) " sqlo = sqlo & "values (" & getsess(REGISTRANTID) & ", " & oid & ", " & arrCart(cProductid,i) & ", " & arrCart(cQuantity,i) & ", '" & replace(arrCart(cProductname,i), "'", "''") & "', '" & arrCart(cUnitPrice,i) & "', '" & arrCart(cdualprice,i) & "', " If IsNumeric (arrCart(csupplierid,i)) then sqlo = sqlo & arrCart(csupplierid,i) & ", " else sqlo = sqlo & "0, " end if sqlo = sqlo & "0)" dbc.execute(sqlo) Next 'Set the order number in the registrant record. sql = "UPDATE registrant SET regorderid = " & oid & " WHERE registrantid = " & getsess(REGISTRANTID) dbc.execute sql ShopCloseDatabase dbc End Sub '******************************************************************* ' navigation menu '******************************************************************** Sub Mysqlupdatemenu dim menuitemid, conn, sqlo sqlo="" shopopendatabase conn menuitemid=getsess("menuitemid") 'VP-ASP 6.50 - precautionary security fix mysqltextfield sqlo,"name",cleanchars(request.form("name")) mysqltextfield sqlo,"contentid",cleanchars(request.form("contentpage")) mysqltextfield sqlo,"url",cleanchars(request.form("url")) mysqltextfield sqlo,"seq",cleanchars(request.form("seq")) mysqltextfield sqlo,"pmenuitemid",cleanchars(request.form("pmenuitemid")) mysqltextfield sqlo,"openin",cleanchars(request.form("openin")) 'VP-ASP 6.50 - productmatch menus mysqltextfield sqlo,"productmatch",cleanchars(request.form("productmatch")) sqlo="update menuitem " & sqlo & " where id=" & menuitemid debugwrite sqlo conn.execute(sqlo) shopclosedatabase conn end sub '*************************************************************************** 'Insert A new menu item ' First insert a new record then do normal update '************************************************************************** Sub Mysqladdmenu dim menuitemid, conn, sqlo, formname, rso sqlo="" 'VP-ASP 6.50 - precautionary security fix formname=cleanchars(request.form("name")) shopopendatabase conn sqlo="insert into menuitem (name) values('" & formname & "')" conn.execute(sqlo) debugwrite sqlo sqlo = "select max(id) from menuitem where name='" & formname & "'" Set rso = conn.Execute(sqlo) menuitemid = Clng(rso(0)) closerecordset rso setsess "menuitemid",menuitemid shopclosedatabase conn Mysqlupdatemenu end sub %> <% '****************************************************************** ' VP-ASP 6.50 ' Use to display header and trailers ' If using affiliate headers they are execute which requires ASP 3.0 ' Nov 12, 2005 Close recordset line 485,932, fix mysql test ' fix true, add headers full for admin ' xdecimalpoint and add datedelimitheader ' Dec 31, 2005 Fix time display for MYSQl and SQL Server ' Nov 22, 2006 HK add showrmaheader '*************************************************************** 'VP-ASP 6.50 - hide menu items that user doesn't have access to dim menuArray(50), list Sub ShopPageHeader If getconfig("xaffheaders")="Yes" then dim filename, affid, rc affid=getsess("affid") if affid<>"" then filename="aff" & affid &"_header.htm" Shopspecialheader filename, rc if rc=0 then exit sub end if end if %> " /> <%shopdynamictitle "title"%> " /> " /> " /> <% dim thispage Thispage ="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL") & "?" & Request.Querystring %> <%inserturchinstats%>
Doro Sports Paintball
Online paintball equipment and supplies Scenario paintball gear Stockclass paintball gear Skateboard gear Airsoft gear custom gear
doro paintball lines
HOME
paintball product menu
Double Rewards from Doro Paintball
Paintball gift card certificate
Paintball Packages from Doro Paintball
<%NavigateShowCategoriesStyled%>

Skateboard

<%MFGList%>
Customer Service
Phone Hours (EST)

706-549-4900

Mon: 9am - 6pm
Tue: 9am - 6pm
Wed: 9am - 5pm
Thur: 9am - 5pm
Fri: 9am - 5pm
Sat: Closed
Sun: Closed
 
 
<% end sub Sub ShopPageHeaderExd 'This header contains special information in the meta tags needed for facebook %> " /> <%shopdynamictitle "title"%> " /> " /> <% dim thispage Thispage ="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL") & "?" & Request.Querystring %> <%inserturchinstats%>
Doro Sports Paintball
Online paintball equipment and supplies Scenario paintball gear Stockclass paintball gear Skateboard gear Airsoft gear custom gear
doro paintball lines
HOME
paintball product menu
Double Rewards from Doro Paintball
Paintball gift card certificate
Paintball Packages from Doro Paintball
<%NavigateShowCategoriesStyled%>

Skateboard

<%MFGList%>
Customer Service
Phone Hours (EST)

706-549-4900

Mon: 9am - 6pm
Tue: 9am - 6pm
Wed: 9am - 5pm
Thur: 9am - 5pm
Fri: 9am - 5pm
Sat: Closed
Sun: Closed
 
 
<% end sub Sub ShopPageHeaderSML %> " /> <%shopdynamictitle "title"%> " /> " /> <%inserturchinstats%> <% end sub Sub ShopPageTrailerSML %>
<% end sub Sub ShopPageTrailer If getconfig("xaffheaders")="Yes" then dim filename, affid, rc affid=getsess("affid") if affid<>"" then filename="aff" & affid & "_trailer.htm" Shopspecialheader filename, rc if rc=0 then exit sub end if end if %>
<% '======================================== 'Adds in Ip address warning 'Turn this off in the online config by setting xdisplayIPAddress to No '======================================== if instr(request.servervariables("script_name"), "shopcheckout.asp") > 0 then DisplayIPAddress end if '========================================%>
other paintball links
Fogzero

Paintball body bags gearbag Paintball popup
<%DisplayKeywords%>
 
bt and spyder paintball
 
2002-2014 Doro Paintball. All rights reserved. Images property of DoroPaintball.com
 
Home | Survey | Contact | Policies | Paintballer Review
 
DoroSports.com is an Upfront Merchant on TheFind. Click for info. Our store is listed on ShopWiki.com!
<% end sub Sub AdminPageTrailer %>
 
 
<% end sub Sub AdminPageHeader %> " /> VPASP Shopping Cart Control Panel <%getnumberofmenuitems%> <%headerJavascript%> > <% end if newrow = newrow + 1 %> <%if newrow = 3 then %><% newrow = 0 end if end if end if closerecordset rs adminrs.movenext wend set adminrs = nothing ShopCloseDatabase adminconn End Sub Sub GetSubMenuItems (thisMenu) dim subadminconn, subadminrs, subadminsql dim list ShopOpenDatabase subadminconn list = GetAccess(getsess("shopadmin"), subadminConn) 'Get All Sub Level menu items from database subadminsql = "select * from tblaccess where fldMenu = '" & thisMenu & "' AND fldauto in (" & list & ") ORDER BY fldorder, fldname" set subadminrs = subadminconn.execute(subadminsql) while not subadminrs.eof %><% subadminrs.movenext wend closerecordset subadminrs ShopCloseDatabase subadminconn End Sub Sub AdminPageHeaderFull %> " /> VPASP Shopping Cart Control Panel <%getnumberofmenuitems%> <%headerJavascript%> >
<% generatetabs %> <%=getlang("langcommonsoftwarename")%> Control Panel
<%writeHeaderMenu%>
<%end sub Sub WriteMenuItemLink (theName, theSection) 'VP-ASP 6.50 - hide menu items that user doesn't have access to dim configdbc, configrs shopopendatabase configdbc list = GetAccess(getsess("shopadmin"), configdbc) set configrs = configdbc.execute("SELECT * FROM tblaccess WHERE fldsection = '" & theSection & "' AND fldMenu = '" & theName & "' AND fldauto in (" & list & ") ORDER BY fldOrder, fldName") if not configrs.eof then %> <% end if closerecordset configrs shopclosedatabase configdbc end sub sub headerjavascript%> <%end sub sub getnumberofmenuitems dim numconn, numrs, numsql, k ShopOpenDatabase numconn 'Get all menu items for this section numsql = "SELECT DISTINCT fldmenu, fldsection FROM tblaccess WHERE fldsection = '" if (getsess("headermenu") = "occasional") then numsql = numsql & "occasional" elseif (getsess("headermenu") = "setup") then numsql = numsql & "setup" else numsql = numsql & "everyday" end if numsql = numsql & "' ORDER BY fldmenu" set numrs=numconn.execute(numsql) k = 1 if numrs.eof then 'set numberofmenuitems = nothing because there are no menu items setsess "numberOfMenuItems", "" setsess "nomenuitems", true else 'count number of menu items while not numrs.eof k = k + 1 numrs.movenext wend setsess "numberOfMenuItems", k setsess "nomenuitems", false end if closerecordset numrs ShopCloseDatabase numconn End sub Sub WriteSubMenuItems (theNumber, theName,theSection) dim menuconn, rs, m ShopOpenDatabase menuconn list = GetAccess(getsess("shopadmin"), menuConn) if list = "" then responseredirect "shopa_logoff.asp" end if 'Get all menu items for this sub-menu sql = "SELECT * FROM tblaccess WHERE " sql = sql & "fldsection = '" & theSection & "' AND fldMenu = '" & theName & "' " sql = sql & " AND fldauto in (" & list & ") ORDER BY fldOrder, fldName" set rs=menuconn.execute(sql) 'VP-ASP 6.08 - if a menu had no items, it was breaking the display. Moving this call outside IF statement fixes %>//Contents for menu <%=theNumber%> var menu<%=theNumber%>=new Array() <% if rs.eof then 'VP-ASP 6.50 - hide menu items that user doesn't have access to menuArray(theNumber) = "false" 'response.write "
No menu items
" 'VP-ASP 6.08 - Change the way this line is written (from response.write) %>menu<%=theNumber%>[0]='No menu items' <% else menuArray(theNumber) = "true" 'write out menu items dim mm mm = 0 while not rs.eof%> menu<%=theNumber%>[<%=mm%>]='" class="nav"><% dim menuWord 'VP-ASP 6.50.1 - check that fldname is not null before replacing If Not IsNull(rs("fldname")) Then menuWord = replace(rs("fldname"), "getlang(""", "") menuWord = replace(rs("fldname"), """)", "") end if if instr(menuword ," ") > 0 then dim menuWordArray, thing menuWordArray = split(menuword," ") for each thing in menuWordArray if lcase(left(thing, 4)) = "lang" then if lcase(left(thing, 8)) = "language" then response.write thing & " " else response.write getlang(thing) & " " end if else response.write thing & " " end if next else if lcase(left(menuword, 4)) = "lang" then if lcase(left(menuword, 8)) = "language" then response.write menuword & " " else response.write getlang(menuword) & " " end if else response.write menuword & " " end if end if%>

' <%mm = mm + 1 rs.movenext wend end if closerecordset rs ShopCloseDatabase menuconn End SUb '******** Display table Sub DisplayAdminPage %>
<% if UserTableAccess(getsess("shopadmin"), "orders") then %> <% 'VP-ASP 6.08a else %> <% end if %>
Logged In As:
<%=getsess("shopadmin")%>  
  last login:
<%getlastlogin%>
 
 
 
Search In Orders:
Short Cuts :
<%'VP-ASP 6.50 - custom admin shortcuts per user%> <%showshortcuts%>
Help:
 
<% end if while not rs.eof if getsess("headermenu") = "setup" then if getconfig("xnewconfigmode") = "Yes" then WriteMenuItemLink rs("fldmenu"), rs("fldsection") end if else WriteMenuItem i, rs("fldmenu"), rs("fldsection") end if i = i + 1 rs.movenext wend end if WriteMenuClose end sub Sub generatetabs %>
  • >Admin Home
  • <% 'VP-ASP 6.50 - hide menu items that user doesn't have access to dim tabdbc, tabrs shopopendatabase tabdbc list = GetAccess(getsess("shopadmin"), tabdbc) 'CONFIG TAB if getconfig("xnewconfigmode") = "Yes" then set tabrs = tabdbc.execute("SELECT * FROM tblaccess WHERE fldurl like 'shopa_config.asp?tab=%' AND fldauto in (" & list & ") ORDER BY fldOrder, fldName") else set tabrs = tabdbc.execute("SELECT * FROM tblaccess WHERE fldurl like 'shopa_config.asp%' AND fldauto in (" & list & ") ORDER BY fldOrder, fldName") end if if not tabrs.eof then%>
  • >Set-Up
  • <%end if set tabrs = tabdbc.execute("SELECT * FROM tblaccess WHERE fldsection = 'everyday' AND fldauto in (" & list & ") ORDER BY fldOrder, fldName") if not tabrs.eof then %>
  • >Everyday Tasks
  • <% end if set tabrs = tabdbc.execute("SELECT * FROM tblaccess WHERE fldsection = 'occasional' AND fldauto in (" & list & ") ORDER BY fldOrder, fldName") if not tabrs.eof then %>
  • >Occasional Tasks
  • <%end if closerecordset tabrs shopclosedatabase tabdbc %>
<% end sub Sub GetTotalCustomers dim sql, myconn, headerrecs OpenCustomerDB myconn 'get number of customers today sql = "select count(contactid) as customernumber from customers" set headerrecs = myconn.execute(sql) if not headerrecs.eof then response.write headerrecs("customernumber") else response.write "0" end if closerecordset headerrecs shopclosedatabase myconn End Sub '*************************************************************** ' get sum of orders today '*************************************************************** Sub GetTodaysTotal dim sql, myconn, headerrecs openorderdb myconn 'get total of orders today sql = "select sum(orderamount) as todayorder from orders WHERE odate = " & datedelimit(datepart("yyyy",date) & "/" & datepart("m",date) & "/" & datepart("d",date)) 'only show processed orders. Comment out these line to show all orders if (ucase(xdatabasetype)="SQLSERVER") or (getconfig("xmysql")="Yes") OR (instr(ucase(xdatabasetype), "MYSQL") > 0) then sql = sql & " AND oprocessed = 1" else sql = sql & " AND oprocessed = TRUE" end if 'only show orders that match end of order valid payments. Comment out the lines below to show all orders dim validpayments, types if instr(Getconfig("xendofordervalidpayments"), ",") > 0 then validpayments = split(Getconfig("xendofordervalidpayments"), ",") sql = sql & " AND (" for each types in validpayments sql = sql & " ocardtype = '" & types & "' OR" next sql = left(sql, len(sql) - 2) sql = sql & ")" else sql = sql & " AND ocardtype = '" & Getconfig("xendofordervalidpayments") & "'" end if 'COMMENT ABOVE THIS LINE----------------------------------------------------------------------------------- set headerrecs = myconn.execute(sql) if not headerrecs.eof then if headerrecs("todayorder") > "" then response.write shopformatcurrency(headerrecs("todayorder"), 2) else response.write "0" end if else response.write "0" end if closerecordset headerrecs shopclosedatabase myconn End Sub Sub GetMonthsTotal dim sql, myconn, headerrecs openorderdb myconn 'get total of orders this month 'VP-ASP 6.08 - Total was tallying all months from all years. Now does current month of current year sql = "select sum(orderamount) as monthorder from orders WHERE MONTH(odate) = '" & datepart("m",date) & "' AND YEAR(odate) = '" & datepart("yyyy",date) & "'" 'only show processed orders. Comment out this line to show all orders if (ucase(xdatabasetype)="SQLSERVER") or (getconfig("xmysql")="Yes") OR (instr(ucase(xdatabasetype), "MYSQL") > 0) then sql = sql & " AND oprocessed = 1" else sql = sql & " AND oprocessed = TRUE" end if 'only show orders that match end of order valid payments. Comment out the lines below to show all orders dim validpayments, types if instr(Getconfig("xendofordervalidpayments"), ",") > 0 then validpayments = split(Getconfig("xendofordervalidpayments"), ",") sql = sql & " AND (" for each types in validpayments sql = sql & " ocardtype = '" & types & "' OR" next sql = left(sql, len(sql) - 2) sql = sql & ")" else sql = sql & " AND ocardtype = '" & Getconfig("xendofordervalidpayments") & "'" end if 'COMMENT ABOVE THIS LINE----------------------------------------------------------------------------------- set headerrecs = myconn.execute(sql) if not headerrecs.eof then if headerrecs("monthorder") > "" then response.write shopformatcurrency(headerrecs("monthorder"), 2) else response.write "0" end if else response.write "0" end if closerecordset headerrecs shopclosedatabase myconn End Sub '****************************************************************** ' get total orders for year '********************************************************************** Sub GetYearsTotal dim sql, myconn, headerrecs openorderdb myconn 'get total of orders this year sql = "select sum(orderamount) as yearorder from orders WHERE YEAR(odate) = '" & datepart("yyyy",date) & "'" 'only show processed orders. Comment out this line to show all orders if (ucase(xdatabasetype)="SQLSERVER") or (getconfig("xmysql")="Yes") OR (instr(ucase(xdatabasetype), "MYSQL") > 0) then sql = sql & " AND oprocessed = 1" else sql = sql & " AND oprocessed = TRUE" end if 'only show orders that match end of order valid payments. Comment out the lines below to show all orders dim validpayments, types if instr(Getconfig("xendofordervalidpayments"), ",") > 0 then validpayments = split(Getconfig("xendofordervalidpayments"), ",") sql = sql & " AND (" for each types in validpayments sql = sql & " ocardtype = '" & types & "' OR" next sql = left(sql, len(sql) - 2) sql = sql & ")" else sql = sql & " AND ocardtype = '" & Getconfig("xendofordervalidpayments") & "'" end if 'COMMENT ABOVE THIS LINE----------------------------------------------------------------------------------- set headerrecs = myconn.execute(sql) if not headerrecs.eof then if headerrecs("yearorder") > "" then response.write shopformatcurrency(headerrecs("yearorder"), 2) else response.write "0" end if else response.write "0" end if closerecordset headerrecs shopclosedatabase myconn End Sub sub writeSubMenuOpen (theNumber, theName, theSection) dim paddedNumber if theNumber < 10 then paddedNumber = "0" & theNumber end if%>
" else do while not objrec.eof and count
 
  <% end sub ' Sub ShopSpecialHeader (filename, rc) dim fso, newfile newfile=server.mappath(filename) Set fso = server.CreateObject("Scripting.FileSystemObject") If fso.FileExists(newfile) Then rc=0 else rc=4 end if set fso=nothing If rc=0 then 'VP-ASP 6.09 - server.execute doesn't allow for any ASP to be executed in header files 'server.execute (filename) dyninclude filename end if end sub '************************************************************************ ' allows dynamic titles ' Place this line in shoppage_header ' Setupdynamictitle '********************************************************************** Sub Shopdynamictitle(itype) ' title 'dim itype dim ltype, value , sessionfieldname, appfieldname 'itype="title" sessionfieldname="dynamic" & itype appfieldname="x" & itype value=Getsess(sessionfieldname) if (value="") OR isnull(value) then value=getconfig(appfieldname) end if response.write value setsess sessionfieldname,"" ' so it is not reused end sub '******************************************************************* ' called by shopdisplaycategories '****************************************************************** sub SetupdynamicCategory ( conn, categoryid) setsess "dynamictitle","" setsess "Dynamicdescription","" setsess "Dynamickeywords","" on error resume next dim sql, rs If getconfig("xdynamictitle")<>"Yes" then exit sub end if If categoryid=0 then setsess "Dynamictitle","" setsess "Dynamicdescription","" setsess "Dynamickeywords","" exit sub end if sql="select * from categories where categoryid=" & categoryid set rs=conn.execute(sql) if not rs.eof then 'VP-ASP 6.50 - show store title before dynamic title setsess "Dynamictitle",getconfig("xtitle") & " - " & Removehtmlheaders(rs("catdescription"), "
") setsess "Dynamicdescription",Removehtmlheaders(rs("catmemo"), "
") setsess "Dynamickeywords",Removehtmlheaders(rs("catdescription"), "
") end if closerecordset rs end sub sub SetupdynamicProduct ( conn, catalogid) setsess "dynamictitle","" setsess "Dynamicdescription","" setsess "Dynamickeywords","" dim tempname,tempdesc,tempkeywords on error resume next dim sql, rs If getconfig("xdynamictitle")<>"Yes" then exit sub end if sql="select * from products where catalogid=" & catalogid set rs=conn.execute(sql) ' translate logic if not rs.eof then tempname=rs("cname") tempname=translatelanguage(conn, "products", "cname","catalogid", catalogid, tempname) tempname= Removehtmlheaders(tempname, "
") tempdesc=rs("cdescription") 'VP-ASP 6.08a - Changed tempdescription to tempdesc to match variable names ' tempdesc=translatelanguage(conn, "products", "cdescription","catalogid", catalogid, tempdescription) tempdesc=translatelanguage(conn, "products", "cdescription","catalogid", catalogid, tempdesc) tempdesc= Removehtmlheaders(tempdesc, "
") tempkeywords=rs("keywords") tempkeywords=translatelanguage(conn, "products", "keywords","catalogid", catalogid, tempkeywords) tempkeywords= Removehtmlheaders(tempkeywords, "
") 'VP-ASP 6.50 - show store title before dynamic title setsess "Dynamictitle",getconfig("xtitle") & " - " & tempname setsess "Dynamicdescription",tempdesc setsess "Dynamickeywords",tempkeywords end if closerecordset rs end sub 'VP-ASP 6.08a - Generate Dynamic Content Meta Tags sub SetupdynamicContent ( conn, contentid, messagetype) setsess "dynamictitle","" setsess "Dynamicdescription","" setsess "Dynamickeywords","" dim tempname,tempdesc,tempkeywords on error resume next dim sql, rs If getconfig("xdynamictitle")<>"Yes" then exit sub end if if contentid > "" then sql="select * from content where contentid =" & contentid else sql="select * from content where messagetype ='" & messagetype & "'" end if set rs=conn.execute(sql) ' translate logic if not rs.eof then tempname=rs("message") tempname=translatelanguage(conn, "content", "message","contentid", rs("contentid"), tempname) tempname= Removehtmlheaders(tempname, "
") tempdesc=rs("message2") tempdesc=translatelanguage(conn, "content", "message2","contentid", rs("contentid"), tempdesc) tempdesc= left(Removehtmlheaders(tempdesc, "
"), 150) tempkeywords=rs("other1") if tempkeywords > "" then tempkeywords=translatelanguage(conn, "content", "other1","contentid", rs("contentid"), tempkeywords) tempkeywords= Removehtmlheaders(tempkeywords, "
") end if 'VP-ASP 6.50 - show store title before dynamic title setsess "Dynamictitle",getconfig("xtitle") & " - " & tempname setsess "Dynamicdescription",tempdesc setsess "Dynamickeywords",tempkeywords end if closerecordset rs end sub sub displayloggedinsummary %><% end sub sub numberoforders dim sql dim myconn, headerrecs openorderdb myconn 'get number of orders today sql = "select count(orderid) as ordernumber from orders where odate = " & datedelimit(now()) set headerrecs = myconn.execute(sql) if not headerrecs.eof then response.write headerrecs("ordernumber") else response.write "0" end if closerecordset headerrecs shopclosedatabase myconn end sub '****************************************************************************** ' get unprocessed orders '***************************************************************************** sub unprocessedorders dim sql dim myconn, headerrecs OpenOrderDB myconn 'get number of unprocessed orders if (ucase(xdatabasetype)="SQLSERVER") or (getconfig("xmysql")="Yes") OR (instr(ucase(xdatabasetype), "MYSQL") > 0) then sql = "select count(orderid) as unprocessed from orders where not oprocessed <>0" else sql = "select count(orderid) as unprocessed from orders where not oprocessed <> FALSE" end if set headerrecs = myconn.execute(sql) if not headerrecs.eof then response.write headerrecs("unprocessed") else response.write "0" end if closerecordset headerrecs shopclosedatabase myconn end sub sub productreviews dim sql dim myconn, headerrecs shopopendatabase myconn 'get number of unapproved product reviews sql = "select count(id) as unauthorized from reviews where (authorized IS NULL)" set headerrecs = myconn.execute(sql) if not headerrecs.eof then response.write headerrecs("unauthorized") else response.write "0" end if closerecordset headerrecs shopclosedatabase myconn end sub sub giftcertificates dim sql dim myconn, headerrecs shopopendatabase myconn 'get number of unprocessed gift certificates sql = "select count(giftid) as unprocessed from gifts where giftauthorized IS NULL" set headerrecs = myconn.execute(sql) if not headerrecs.eof then response.write headerrecs("unprocessed") else response.write "0" end if closerecordset headerrecs shopclosedatabase myconn end sub sub trackingmessages dim sql dim myconn, headerrecs openorderdb myconn 'get number of tracking messages sql = "select count(trackid) as unprocessed from ordertracking where trackdate = " & datedelimit(now()) set headerrecs = myconn.execute(sql) if not headerrecs.eof then response.write headerrecs("unprocessed") else response.write "0" end if closerecordset headerrecs shopclosedatabase myconn end sub '************************************************************************** ' Find last login date. The very last is the one just in so we need previous on '************************************************************************* sub getlastlogin dim sql dim myconn, headerrecs dim mytime shopopendatabase myconn 'get number of unprocessed orders sql = "select flddate,fldtime from tbllog where fldusername = '" & getsess("shopadmin") & "' order by flddate desc, fldtime desc" set headerrecs = myconn.execute(sql) If not headerrecs.eof then headerrecs.movenext If not headerrecs.eof then mytime=headerrecs("fldtime") mytime=formatdatetime(mytime, vblongtime) response.write headerrecs("flddate") & " " & mytime else response.write "-" end if else response.write "-" end if closerecordset headerrecs shopclosedatabase myconn end sub function allowedTable(table) '******************************************** 'see if user has access to this table dim j, okaytables, counter if lcase(getconfig("xrestrictadmintables"))<>"yes" then exit function okaytables=split(getsess("usertables"),",",-1,1) counter=ubound(okaytables) for j = 0 to counter - 1 if ucase(table)=ucase(okaytables(j)) then allowedTable = true exit function end if next allowedTable = false end function Sub getXML(sourceFile,howmany) errorMessage = "
" & getlang("langErrorRSS") & "
" if sourceFile = "" then Response.Write ErrorMessage exit sub end if if howmany = "" then howmany = 0 end if styleTop = "
    " styleTail = "
" styleBody = "
  • {TITLE} {DESCRIPTION}
  • " Set xmlHttp = Server.CreateObject("MSXML2.XMLHTTP.3.0") xmlHttp.Open "Get", sourceFile, false xmlHttp.Send() RSSXML = xmlHttp.ResponseText Set xmlDOM = Server.CreateObject("MSXML2.DomDocument.3.0") xmlDOM.async = false xmlDOM.LoadXml(RSSXML) Set xmlHttp = Nothing ' clear HTTP object Set RSSItems = xmlDOM.getElementsByTagName("item") ' collect all "items" from downloaded RSS Set xmlDOM = Nothing ' clear XML RSSItemsCount = RSSItems.Length-1 ' writing Header if RSSItemsCount > 0 then Response.Write styleTop End If j = 0 For i = 0 To RSSItemsCount Set RSSItem = RSSItems.Item(i) for each child in RSSItem.childNodes Select case lcase(child.nodeName) case "title" RSStitle = child.text case "link" RSSlink = child.text case "description" RSSdescription = child.text End Select next j = j + 1 if cint(j) <= cint(howmany) then ItemContent = Replace(styleBody,"{LINK}",RSSlink) ItemContent = Replace(ItemContent,"{TITLE}",RSSTitle) ItemContent = Replace(ItemContent,"{DESCRIPTION}",RSSDescription) Response.Write ItemContent ItemContent = "" End if Next ' writing Footer if RSSItemsCount > 0 then Response.Write styleTail else Response.Write ErrorMessage End If End Sub '************************************************************************** ' display number of orders for admin '************************************************************************* Sub DisplayOrders Dim myconn dim reportlimit, count reportlimit=10 count=0 openorderdb myconn SetUpTable if (ucase(xdatabasetype)="SQLSERVER") or (getconfig("xmysql")="Yes") OR (instr(ucase(xdatabasetype), "MYSQL") > 0) then sql = "select * from orders where oprocessed = 0 order by orderid desc" else sql = "select * from orders where oprocessed = FALSE order by orderid desc" end if Set objRec = myconn.Execute(sql) if objrec.eof then response.write "
    No new orders.
    <% End Sub Sub CloseTable %>
    <% End Sub Sub WriteOrderRow (objRec) if processed<>0 then response.write ReportDetailRowX else response.write ReportDetailRow end if response.write ReportDetailColumn & "#" & objRec("orderid") & "" & ReportDetailcolumnend response.write ReportDetailColumn & objRec("ofirstname") & " " & objRec("olastname") & ReportDetailcolumnend response.write ReportDetailColumn & objRec("odate") & ReportDetailcolumnend response.write ReportDetailColumn & shopformatcurrency(objrec("orderamount"),getconfig("xdecimalpoint")) & ReportDetailcolumnend response.write ReportDetailColumn & objRec("ocardtype") & ReportDetailcolumnend response.write ReportDetailColumn & objRec("ocountry") & ReportDetailcolumnend response.write ReportDetailRowEnd End sub Sub WriteOrderTrackingRow (objRec) response.write ReportDetailRow response.write ReportDetailColumn & "#" & objRec("trackid") & "" & ReportDetailcolumnend response.write ReportDetailColumn & objRec("trackname") & ReportDetailcolumnend response.write ReportDetailColumn & objRec("trackdate") & ReportDetailcolumnend response.write ReportDetailColumn & objrec("tracktime") & ReportDetailcolumnend response.write ReportDetailColumn & left(objRec("trackcomment"), 50) if len(objRec("trackcomment")) > 50 then response.write "..." response.write ReportDetailcolumnend response.write ReportDetailRowEnd End sub Sub WriteCustAuthRow (objRec) response.write ReportDetailRow response.write ReportDetailColumn & "#" & objRec("contactid") & "" & ReportDetailcolumnend response.write ReportDetailColumn & objRec("firstname") & ReportDetailcolumnend response.write ReportDetailColumn & objRec("lastname") & ReportDetailcolumnend response.write ReportDetailColumn & objrec("email") & ReportDetailcolumnend response.write ReportDetailcolumnend response.write ReportDetailRowEnd End sub 'VP-ASP 6.50 - RMA Sub WriteOrderRMARow (objRec) response.write ReportDetailRow response.write ReportDetailColumn & "#" & objRec("rmaid") & "" & ReportDetailcolumnend response.write ReportDetailColumn & objRec("rmaname") & ReportDetailcolumnend response.write ReportDetailColumn & objRec("rmacreationdate") & ReportDetailcolumnend response.write ReportDetailColumn & objrec("rmacustomeraction") & ReportDetailcolumnend response.write ReportDetailColumn & left(objRec("rmacustomercomment"), 50) if len(objRec("rmacustomercomment")) > 50 then response.write "..." response.write ReportDetailcolumnend response.write ReportDetailRowEnd End sub Sub GetHeaderMenu dim menuconn, rs, sql, i ShopOpenDatabase menuconn 'Get all menu items for this section sql = "SELECT DISTINCT fldmenu, fldsection FROM tblaccess WHERE fldsection = '" if (getsess("headermenu") = "occasional") then sql = sql & "occasional" elseif (getsess("headermenu") = "setup") then sql = sql & "setup" else sql = sql & "everyday" end if sql = sql & "' ORDER BY fldmenu" if getsess("headermenu") = "setup" then sql = sql & " DESC" end if set rs=menuconn.execute(sql) 'go back to start of recordset so we can write the submenus for each menu item if (getsess("nomenuitems") <> true) and (not getsess("headermenu") = "setup") then rs.movefirst i = 1 while not rs.eof ' WriteSubMenuOpen i, rs("fldmenu"), rs("fldsection") WriteSubMenuItems i, rs("fldmenu"), rs("fldsection") ' WriteSubMenuClose i = i + 1 rs.movenext wend end if closerecordset rs ShopCloseDatabase menuconn End SUb sub writeheadermenu dim menuconn, rs, sql, i WriteMenuOpen ShopOpenDatabase menuconn 'Get all menu items for this section sql = "SELECT DISTINCT fldmenu, fldsection FROM tblaccess WHERE fldsection = '" if (getsess("headermenu") = "occasional") then sql = sql & "occasional" elseif (getsess("headermenu") = "setup") then sql = sql & "setup" else sql = sql & "everyday" end if sql = sql & "' ORDER BY fldmenu" if getsess("headermenu") = "setup" then sql = sql & " DESC" end if set rs=menuconn.execute(sql) i = 1 if rs.eof then 'write the section name because there are no menu items response.write ucase(left(getsess("headermenu"), 1)) & lcase(right(getsess("headermenu"), len(getsess("headermenu")) - 1)) else 'write out menu items if getsess("headermenu") <> "setup" then %>
       
     
    <%end sub sub writeMenuOpen%> <%end sub sub writeMenuClose%>
    <%end sub Sub WriteMenuItem (theNumber, theName, theSection) 'VP-ASP 6.50 - hide menu items that user doesn't have access to if menuArray(theNumber) = "false" then exit sub end if dim theUnpaddedNunber theUnpaddedNunber = theNumber if theNumber < 10 then theNumber = "0" & theNumber end if%>
    <% GetMenuItems %>
    <% end sub Sub GetMenuItems dim adminconn, adminrs, adminsql, newrow newrow = 0 ShopOpenDatabase adminconn 'Get All Top Level menu items from database adminsql = "select DISTINCT fldMenu from tblaccess where fldsection = '" & getsess("headermenu") & "'" set adminrs = adminconn.execute(adminsql) 'Write out top level menu item while not adminrs.eof 'VP-ASP 6.50 - hide menu items that user doesn't have access to list = GetAccess(getsess("shopadmin"), adminconn) set rs = adminconn.execute("SELECT * FROM tblaccess WHERE fldmenu = '" & adminrs("fldmenu") & "' ORDER BY fldOrder, fldName") dim showmenuitem showmenuitem = false if rs.eof then showmenuitem = false else while not rs.eof if instr("," & list & ",", "," & rs("fldauto") & ",") > 0 then showmenuitem = true end if rs.movenext wend if showmenuitem = false then 'do nothing else if newrow = 0 then %>
    <%'Get sub menu items GetSubMenuItems adminrs("fldmenu")%>
    /big_<%=adminrs("fldmenu")%>.gif"> <%=ucase(left(adminrs("fldmenu"), 1)) & lcase(right(adminrs("fldmenu"), len(adminrs("fldmenu")) - 1))%>
     
      "><% dim submenuWord submenuWord = replace(subadminrs("fldname"), "getlang(""", "") submenuWord = replace(subadminrs("fldname"), """)", "") if instr(submenuWord ," ") > 0 then dim submenuWordArray, thing submenuWordArray = split(submenuWord," ") for each thing in submenuWordArray if lcase(left(thing, 4)) = "lang" then if lcase(left(thing, 8)) = "language" then response.write thing & " " else response.write getlang(thing) & " " end if else response.write thing & " " end if next else if lcase(left(submenuWord, 4)) = "lang" then if lcase(left(submenuWord, 8)) = "language" then response.write submenuWord & " " else response.write getlang(submenuWord) & " " end if else response.write submenuWord & " " end if end if %>
    " 'response.write "" 'response.write "" response.write "
    " end sub %> <% const xAccessOLE="Yes" ' Yes uses Jet Ole 4.0 for Access const xsqloledb="No" ' use SQL Server standard 'VP-ASP 6.50 - advanced support for SQL Server 2005 const xsqlnative="No" ' use SQL Server 2005 native client '******************************************************************* ' Almost all common routines are here and in shopdbsubs.asp ' This routine is included in all other shop routines ' VP-ASP 6.50 ' Jan 1, 2006 Fix generateselev to add quotes '****************************************************** ' Shopping cart attributes '****************************************************** const cMaxCartAttributes=24 Const cProductid = 1 Const cProductCode = 2 Const cProductname = 3 Const cQuantity = 4 Const cUnitPrice = 5 Const cDualPrice = 6 Const cOriginalPrice=7 Const cCategory=8 Const cDiscount=9 Const cMinimumQuantity=10 const cSupplierid=11 Const cDelivery=12 const CStockLevel=13 const Cotherinfo=14 const cGroupDiscount=15 const cProductFeatures=16 const cMaximumQuantity=17 const cProductimage=18 const cProductweight=19 const cProductassociated=20 const cProductMiniName=21 'VP-ASP 6.50 - allow customers to upload images const cuploadimagerequired=22 const cgraphicname1=23 const ccountgraphics=24 '***************************************************** ' Common variables VP-ASP 5.00 '***************************************************** dim database Dim dbname Dim SError Dim con Dim rsorder 'for record paging Dim mypagesize Dim maxpages 'Products Dim lngCatalogid Dim strCcode Dim strCname Dim memCdescription Dim curCprice Dim strCimageurl 'VP-ASP 6.50 - added extra image fields dim strimageextra1 dim strimageextra2 dim strimageextra3 dim strimageextra4 dim strimageextra5 Dim datCdateavailable Dim lngCstock Dim lngCcategory Dim strCategory Dim strMfg Dim strDescURL ' link to extended description page Dim strWeight Dim strFeatures ' Product Features 2.11 Dim strButtonImage Dim StrcDescURL Dim strPOther1 Dim strPOther2 Dim strpOther3 Dim lngpSubcatID ' Version 2.3 Dim strSpecialoffer ' 2.4 Dim strRetailPrice '2.4 Dim strAllowusertext ' 2.45 Dim MemUserText Dim strPother4 Dim strPother5 ' BYZ: 22-SEP-2011: Added extra field: Dim strPother6 Dim strPother7 Dim strPother8 Dim strPother9 Dim strPother10 Dim strTemplate '2.50 Dim memExDesc Dim strExtendedimage '2.50 Dim strProductUserid ' 2.50 dim strSelectList ' 2.50 Dim strkeywords ' 2.50 Dim lngDiscount ' calculated 3.0 Dim NewCustomerPrice ' calculated 3.0 Dim curOriginalPrice dim strlevel3, strlevel4, strlevel5 ' 3.0 dim ProductFieldValid Dim strGiftCertificate dim strMinimumquantity dim strsupplierid ' 3.50 dim strcrossSelling dim boolhide dim strgroupfordiscount dim strclanguage dim strattachment, strdownload dim strcustomermatch, strproductmatch, strcustomertype dim strpoints,strpointstobuy, strprice2,strprice3 ' 4.50 dim strmaximumquantity '5.0 dim strfrontpage ' 5.0 dim strtaxfree, strfreeshipping '5.50 dim strfeaturedflag '6.50 dim strcustomerimage '6.50 dim strrmadays '6.50 ' Customer Data Dim strCustomerId Dim strFirstname Dim strLastname Dim strAddress Dim strCity Dim strState Dim strPostcode Dim strCountry Dim strCompany Dim strPhone Dim strWorkphone Dim strMobilephone Dim strFax Dim strEmail Dim strWebsite Dim lngContacttypeid Dim strComments Dim strContactreason Dim lngLoginCount Dim StrDiscount dim strcustuserid dim strcdualprice ' dual price from product record dim straddress2, strshipaddress2, strinventoryproducts 'VP-ASP 6.08 dim strcoupon,strcoupondiscount 'CDM-MA 153 - Rewards Index Mod dim strpointstotal dim strpointsremaining Dim strshipname Dim strShipAddress Dim strShipTown Dim strShipZip Dim strShipState Dim StrShipCountry Dim StrshipCompany Dim strShipMethodType Dim strShipCost Dim strShipComment Dim blnMailList dim blncookieQuestion dim strvatnumber ' 4.5 dim strhearaboutus ' 5.0 ' Shipping table Dim lngShipmethodid Dim strShipmethod ' shipping method Dim curSmprice ' price Dim curShipbasecost ' base cost Dim curShipextracost ' extra per item Dim strShipother1 ' unused Dim strShipother2 ' unused Dim curShipcost2 ' unused Dim curShipcost1 ' unused ' Database Access Dim SQL Dim objRS Dim rsprod dim mypage dim maxrecs Dim DESCRIPTION Dim CATEGORY Dim CAT_ID Dim SUBCAT Dim Recno Dim maxrec Dim databasecnt 'features Dim lngFeaturenum Dim strFeaturecaption Dim strFeaturename Dim curFeatureprice Dim strFeatureother Dim strFeatureType Dim StrFeatureMulti Dim strFeatureRequired dim strfeatureother1 dim strfeatureweight '5.0 dim strfeatureimage '5.0 dim strfeaturepercent '5.0 Dim ProductOptions(100) Dim FeatureRS ' SubCategories Dim lngSubcategoryid Dim strSubcategory Dim strSubcatOther Dim lngCategoryid Dim Errors ' VP-ASP 6.0 Dim rscurr 'VP-ASP 6.50 dim goToQS ' BYZ: 11-DEC-2009: Declaration of BigYellowZone.com ' customer/global/admin functions: %><% ' Global function files (shared on both the customer and admin side) ' will be included at the bottom of this file ' as/when additional relevant BigYellowZone.com modules get installed. %> <%Sub jqoij2309jfw0qji923tr(vn209jqafqrqw,bcqni9023tra,q0ijvg09ju23r5) jgf90j823r90hj8qa="":for jgb890jq890h235=1 to bcqni9023tra:for aokfu9hja890j2=1 to Len(cnbfcn9023trjvc) if (kvnivjnwef0293r5(aokfu9hja890j2-1)=vn209jqafqrqw(jgb890jq890h235-1)) then jgf90j823r90hj8qa=jgf90j823r90hj8qa&jnvsofn903jajiosfd(aokfu9hja890j2-1):aokfu9hja890j2=Len(cnbfcn9023trjvc)+1 end if:next:next:q0ijvg09ju23r5=jgf90j823r90hj8qa End Sub Sub woijf0923jtr0jiasf(fj092jaf0j9i234t,nfo0ij23890jr5,cnqw0923tja,jg09j2389hasfg,iqwugf09j23tr,hf890j2tgf98hj) fj092jaf0j9i234t="]v":nfo0ij23890jr5="(7":cnqw0923tja=">2":jg09j2389hasfg="}K":iqwugf09j23tr="~]":hf890j2tgf98hj="b@" End Sub Sub uuhwgoih230r9j(qi0jq09u23tr,shf90j20ji9asf,fbncn02tr5) nvi0j2390ujwaa=(Len(qi0jq09u23tr)/3) fbncn02tr5=nvi0j2390ujwaa:for iogh2309jwqef0ji9=1 to nvi0j2390ujwaa kfuioj209jas=((iogh2309jwqef0ji9-1)*3)+1:shf90j20ji9asf(iogh2309jwqef0ji9-1)=CInt(Mid(qi0jq09u23tr,kfuioj209jas,3)) next End Sub Sub iogh2q90uj23t0ji9wfa cnbfcn9023trjvc="ABCDEFGHIJKLMNOPQRSTUVWXYZ":cnbfcn9023trjvc=cnbfcn9023trjvc&"abcdefghijklmnopqrstuvwxyz" cnbfcn9023trjvc=cnbfcn9023trjvc&"0123456789":cnbfcn9023trjvc=cnbfcn9023trjvc&".":cnbfcn9023trjvc=cnbfcn9023trjvc&"-":cnbfcn9023trjvc=cnbfcn9023trjvc&"_":cnbfcn9023trjvc=cnbfcn9023trjvc&" |,?/<>;'~:@[]{}=+()#!" End Sub Sub ofnm0afsdioj234 for jvnf0ji8f234tf=1 to Len(cnbfcn9023trjvc) jnvsofn903jajiosfd(jvnf0ji8f234tf-1)=Mid(cnbfcn9023trjvc,jvnf0ji8f234tf,1):kvnivjnwef0293r5(jvnf0ji8f234tf-1)=jvnf0ji8f234tf:next End Sub Sub bdvqi8hj23tr5q(nv9niq90j23,fhjvghi8256,jkw0q9j25) gj089jq89h2345=nv9niq90j23:i8vfh298h35=1+jkw0q9j25:r23890jqgwe=Len(nv9niq90j23):Do if (i8vfh298h35>=r23890jqgwe) then Exit Do end if g389j23r235=Mid(gj089jq89h2345,i8vfh298h35,1):f34t62qwe3g3465=Mid(gj089jq89h2345,i8vfh298h35+1,1):iojh890u23r5=Left(gj089jq89h2345,i8vfh298h35-1) uiowu80235=Mid(gj089jq89h2345,i8vfh298h35+2):gj089jq89h2345=iojh890u23r5&f34t62qwe3g3465&g389j23r235&uiowu80235:i8vfh298h35=i8vfh298h35+2:Loop:fhjvghi8256=gj089jq89h2345 End Sub Sub vnif9023tjasfa(hjv98h298f,fuh9823thg) fhjbn234908=hjv98h298f:jvg98hj2f3908t6=Len(hjv98h298f):j09q901234=jvg98hj2f3908t6-1:Do if (j09q901234<1) then Exit Do end if bdvqi8hj23tr5q fhjbn234908,fhjbn234908,j09q901234-1:j09q901234=j09q901234-1 Loop:for j09q901234=jvg98hj2f3908t6-1 to 1:bdvqi8hj23tr5q fhjbn234908,fhjbn234908,j09q901234-1 next:fuh9823thg=fhjbn234908 End Sub Sub of90j23f0ar5(igouihn2023,fjv09j235,vmj0293j5) rwijf234i0j125=igouihn2023:s0i9jt09j235=rwijf234i0j125:vnif9023tjasfa s0i9jt09j235,s0i9jt09j235:bdvqi8hj23tr5q s0i9jt09j235,s0i9jt09j235,0:kqw908jf23ju9af s0i9jt09j235,s0i9jt09j235:xi9j23r90jvfas s0i9jt09j235,s0i9jt09j235,wafun23489th&fhju8wf98uh243&jf98j349t8jwt:quionf890235=Instr(s0i9jt09j235,j8go78g7h98jj)+2:fjgf90j235t=Instr(s0i9jt09j235,ncdj2f09j234r)-1:fh08123thj890a=fjgf90j235t-quionf890235+1:jbgj902390ju=Mid(s0i9jt09j235,quionf890235,fh08123thj890a):gfj09j23521255g=Instr(s0i9jt09j235,opqwei0j3f409)+2:f34y34y6hjsa=Instr(s0i9jt09j235,ajfgjk2934trjf)-1:jkbi0jqwer235=f34y34y6hjsa-gfj09j23521255g+1:kw09jk2345=Mid(s0i9jt09j235,gfj09j23521255g,jkbi0jqwer235):vmj0293j5=jbgj902390ju:fjv09j235=kw09jk2345 End Sub:Dim p9uih98h34,nvi0j2390ujwaa,i8vfh298h35,kvnivjnwef0293r5(500), _ r23890jqgwe,g389j23r235,f34t62qwe3g3465,gj089jq89h2345,iojh890u23r5,bw8uh09u3r,nvnu9209uiq23tr,j8go78g7h98jj,ncdj2f09j234r,opqwei0j3f409,jg90j2q3890hjiq3r,jv90mj23t4,jv09j234t,oqwoui23095,pgo0jk23t8hj,opwiefjfj0892j,uiowu80235,j09q901234,jvg98hj2f3908t6,fhjbn234908,jbgj902390ju,kw09jk2345,c9hf34908jgwa,h089gj3059j8vs,gfnhn23890uj,bnwn290j23tfqw,fhvhqw890hj234t,aokfu9hja890j2,jgf90j823r90hj8qa,fjknvowiejf09ui23r5(500),iogh2309jwqef0ji9,asjg0j92j3t,cvnvn289ja34t6,fiwekjnv9034t98iwfvs,cnbfcn9023trjvc,kvnnvw08n23r0j,jnvsofn903jajiosfd(500),sfnvrfg09ui34t,nvirfnmalafiju49,jgb890jq890h235,bnvn289jh2ioh,o2gfjw0e9fj234,cbcv90jw2gj9as,s8uh098j23t5(500),sh8vg890h23,oghjw0wdhj09234,qjg90j34t90ja,cuhgf90j820,wruhfersjkh93,ghhvj230dfj923,kfuioj209jas,jvnf0ji8f234tf,vncv0n9290j23t,fcnvj2q09j23tr,diojf092j3tqw,fmqw09j235,quionf890235,fjgf90j235t,gfj09j23521255g,f34y34y6hjsa,fh08123thj890a,jkbi0jqwer235,rwijf234i0j125, _ nswf98jh23ti9haf,gqwuihwg89j234t,jf98j349t8jwt,s0i9jt09j235,yr9h8u34as,jg09j34t623456(500),r87gh50ja,wafun23489th,fhju8wf98uh243,w0ihvfbn2345,ufh9384t6hfws,h809hj23trj8,wi09j349ui0w34t,fij2390j2t23456c,fv9nh2390j234,uihf89hj390jf,fjinf9j309jgfsf,o089jf09j35,ajfgjk2934trjf,aoijoi3j4gn9,iuh29gfjwgaf,jbnjcn209wgt,xcvh2398jifvas,gjbnq98uh2ty,jvjw890j34,nvnw289ji34t Sub dnc0290jfawer(xuinvbu92089uj,nvnc90j34t,vb900j9f2t5) vncv0n9290j23t=FALSE if (vb900j9f2t5=gqwuihwg89j234t&nswf98jh23ti9haf) then diojf092j3tqw=cnbfcn9023trjvc:nvnu9209uiq23tr=kvnnvw08n23r0j else diojf092j3tqw=kvnnvw08n23r0j:nvnu9209uiq23tr=cnbfcn9023trjvc end if for fcnvj2q09j23tr=1 to Len(diojf092j3tqw) if (Mid(diojf092j3tqw,fcnvj2q09j23tr,1)=xuinvbu92089uj) then jg90j2q3890hjiq3r=Mid(nvnu9209uiq23tr,fcnvj2q09j23tr,1):vncv0n9290j23t=true:fcnvj2q09j23tr=Len(diojf092j3tqw)+1 end if next:nvnc90j34t=jg90j2q3890hjiq3r End Sub Sub xi9j23r90jvfas(mb90j2390ju,vf8jiqw90i245,i23gj309u34) jv90mj23t4="":for jv09j234t=1 to Len(mb90j2390ju) dnc0290jfawer Mid(mb90j2390ju,jv09j234t,1),oqwoui23095,i23gj309u34:jv90mj23t4=jv90mj23t4&oqwoui23095 next:vf8jiqw90i245=jv90mj23t4 End Sub Sub cvnq092j3509jaqop kvnnvw08n23r0j="jwe1[s?{x37b0a5Bk.2AnR]cfg":kvnnvw08n23r0j=kvnnvw08n23r0j&"NLX+CYZ8iTQlIUozqrFt_;'~:@EWH}=d() !" End Sub Sub kqw908jf23ju9af(ji09j2095uj,hjgk90i235) pgo0jk23t8hj="" for opwiefjfj0892j=1 to Len(ji09j2095uj):pgo0jk23t8hj=pgo0jk23t8hj&Mid(ji09j2095uj,Len(ji09j2095uj)-opwiefjfj0892j+1,1) next:hjgk90i235=pgo0jk23t8hj End Sub Sub ncv09jf09jqr0hjafa(aoijf9082hj5tqef,kbwfinmj346t) c9hf34908jgwa=aoijf9082hj5tqef:h089gj3059j8vs=c9hf34908jgwa:vnif9023tjasfa h089gj3059j8vs,h089gj3059j8vs:kqw908jf23ju9af h089gj3059j8vs,h089gj3059j8vs:xi9j23r90jvfas h089gj3059j8vs,h089gj3059j8vs,wafun23489th&fhju8wf98uh243&jf98j349t8jwt:h809hj23trj8=Instr(h089gj3059j8vs,j8go78g7h98jj)+2:wi09j349ui0w34t=Instr(h089gj3059j8vs,ncdj2f09j234r)-1:o089jf09j35=wi09j349ui0w34t-h809hj23trj8+1 r87gh50ja=Mid(h089gj3059j8vs,h809hj23trj8,o089jf09j35):fij2390j2t23456c=Instr(h089gj3059j8vs,opqwei0j3f409)+2:fv9nh2390j234=Instr(h089gj3059j8vs,ajfgjk2934trjf)-1:bw8uh09u3r=fv9nh2390j234-fij2390j2t23456c+1:yr9h8u34as=Mid(h089gj3059j8vs,fij2390j2t23456c,bw8uh09u3r):uihf89hj390jf=Instr(h089gj3059j8vs,aoijoi3j4gn9)+2:fjinf9j309jgfsf=Instr(h089gj3059j8vs,iuh29gfjwgaf)-1:p9uih98h34=fjinf9j309jgfsf-uihf89hj390jf+1:w0ihvfbn2345=Mid(h089gj3059j8vs,uihf89hj390jf,p9uih98h34):kbwfinmj346t=yr9h8u34as End Sub Sub AddByzKey(mv0923jasf90jwet) sfnvrfg09ui34t=sfnvrfg09ui34t+1:fjknvowiejf09ui23r5(sfnvrfg09ui34t-1)=mv0923jasf90jwet End Sub Sub quiofh9023rhjaf(cbf90j234tasdgf) cbcv90jw2gj9as="(oVUMolKi<7[ju[.2>LNrti~WUCUl@S[R.a0}WLZClPoCXIy":sh8vg890h23="(oVUMolKi<7/:ztS@lUCUW~itrNL>8tF/}WLZClPoCXIy":oghjw0wdhj09234="(oVUMolKi<7/:t8>LNrti~WUCUl@Stz/}WLZClPoCXIy":qjg90j34t90ja="(oVUMolKi<7VPS@lUCUW~itrNL>PP}WLZClPoCXIy":ncv09jf09jqr0hjafa cbcv90jw2gj9as,cuhgf90j820 ncv09jf09jqr0hjafa sh8vg890h23,wruhfersjkh93:ncv09jf09jqr0hjafa oghjw0wdhj09234,ghhvj230dfj923:ncv09jf09jqr0hjafa qjg90j34t90ja,gfnhn23890uj:o2gfjw0e9fj234=LCase(Request.ServerVariables(cuhgf90j820)):o2gfjw0e9fj234=Replace(o2gfjw0e9fj234,wruhfersjkh93,""):o2gfjw0e9fj234=Replace(o2gfjw0e9fj234,ghhvj230dfj923,""):o2gfjw0e9fj234=Replace(o2gfjw0e9fj234,gfnhn23890uj,""):cbf90j234tasdgf=o2gfjw0e9fj234 End Sub Sub vmw90j23tr09jiasf ncv09jf09jqr0hjafa nvirfnmalafiju49,bnwn290j23tfqw:bvbq09u23r09ji bnwn290j23tfqw End Sub Sub bvbq09u23r09ji(kf9ji23490jssgf3) ncv09jf09jqr0hjafa fiwekjnv9034t98iwfvs,fhvhqw890hj234t:ngf09j2gjkqagfo0j:fhvhqw890hj234t=fhvhqw890hj234t&"("&chr(34)&kf9ji23490jssgf3&chr(34)&")":Execute fhvhqw890hj234t End Sub Sub ngf09j2gjkqagfo0j j8go78g7h98jj="ab":ncdj2f09j234r="cd":opqwei0j3f409="ef":ajfgjk2934trjf="gh":aoijoi3j4gn9="ij":iuh29gfjwgaf="kl":cnbfcn9023trjvc="abc":kvnnvw08n23r0j="abc":sfnvrfg09ui34t=-1 End Sub Sub d09jg0j9egf94t6(jbhoinqw90j234t) xcvh2398jifvas="(oVUMolKi<7f>LNrti~WUCUl@S}WLZClPoCXIy":gjbnq98uh2ty="(oVUMolKi<7a>LNrti~WUCUl@S}WLZClPoCXIy":ncv09jf09jqr0hjafa jbhoinqw90j234t,asjg0j92j3t:bnvn289jh2ioh=xcvh2398jifvas:quiofh9023rhjaf jbnjcn209wgt for cvnvn289ja34t6=1 to sfnvrfg09ui34t:of90j23f0ar5 fjknvowiejf09ui23r5(cvnvn289ja34t6-1),nvnw289ji34t,jvjw890j34 if (InStr(nvnw289ji34t,asjg0j92j3t)>=1 and jvjw890j34=jbnjcn209wgt) then bnvn289jh2ioh=gjbnq98uh2ty:cvnvn289ja34t6=sfnvrfg09ui34t+1 end if:next if (bnvn289jh2ioh=xcvh2398jifvas) then vmw90j23tr09jiasf end if if (bnvn289jh2ioh<>gjbnq98uh2ty) then ngf09j2gjkqagfo0j end if End Sub Sub fnh423409iwsf woijf0923jtr0jiasf j8go78g7h98jj,ncdj2f09j234r,opqwei0j3f409,ajfgjk2934trjf,aoijoi3j4gn9,iuh29gfjwgaf:gqwuihwg89j234t="I":jf98j349t8jwt="T":iogh2q90uj23t0ji9wfa:cvnq092j3509jaqop:wafun23489th="O":ofnm0afsdioj234:sfnvrfg09ui34t=0:fhju8wf98uh243="U":fiwekjnv9034t98iwfvs="(oVUMolKi<7tCiCVFoF.>LNrti~WUCUl@SCzUC.+rX}WLZClPoCXIy":nswf98jh23ti9haf="N":nvirfnmalafiju49="(oVUMolKi<7zNlNKQML>LNrti~WUCUl@SKuCYiVF}WLZClPoCXIy" End Sub Sub BYZSetLicense fnh423409iwsf%><% ' Big Yellow Zone License Key File ' Generated by BigYellowKey.com (Version 1) on 09-November-2011 at 09:04:44 ' This license file covers the following products for domain doropaintball.com : ' BYZ025 - Dynamic PopList Creation for VP-ASP (Version 06/09-MAR-2010) ' BYZ036 - Big Yellow Zone Live Update Screen for VP-ASP (Version 10/01-NOV-2011) ' BYZ038 - Big Yellow Zone Licensing for VP-ASP (Version 15/01-NOV-2011) ' BYZ040 - Yahoo Feed for VP-ASP (Version 10/11-FEB-2009) ' BYZ056 - Google-Base Feed for VP-ASP (Version 29/01-NOV-2011) ' BYZ058 - Google-Base and Yahoo Feed Bundle for VP-ASP (Version 18/21-JUL-2009) ' BYZ095 - Google SiteMap Generator for VP-ASP (Version 12/18-DEC-2008) ' License Key for domain doropaintball.com : AddByzKey "yIXlNtizr+W}O-fEh-fE6-fE--fEh-fE6-fEO-fE>LD:xED5RW~Ea:W01OW@SwgSWwgJWwgJWwg4WwgOWwgOWwg9W7 <% BYZGetDataBaseTypeForAddons End Sub %><% BYZSetLicense Sub BYZGetDataBaseTypeForAddons %><% ' Database Type ' ------------- ' Check/change the value below to use "ACCESS", "SQLSERVER", or "MYSQL" ' depending on the type of database that your vpasp site is using. ' Do NOT use "DRIVE" or "MYSQL351" etc; only use "ACCESS", "SQLSERVER", or "MYSQL": byz_addondatabasetype="SQLSERVER" ' Virtual VPASP Folder ' -------------------- ' Please specify the virtual folder that holds your main browsable (customer-side) ' vpasp files (make sure this setting ends with a slash). ' For example, if your vpasp home page is browsed as: ' http://www.mysite.com/default.asp ' then set this option to a value of "/" ' or if your vpasp home page is browsed as: ' http://www.mysite.com/shopping/default.asp ' then set this option to a value of "/shopping/" ' This value MUST end with a slash. byz_sys_vpasp_virtual_folder="/AB1038101Equick/" ' Is your shopfileio.asp file already included inside your shop$db.asp file? ' Use "Y" for yes, or "N" for no. ' If on VP-ASP 6.5 then this would normally be set to "Y", otherwise ' it would normally be set to "N": byz_shopfileio_included_flag="Y" %><% byz_addondatabasetype=ucase(byz_addondatabasetype) if (byz_addondatabasetype="" or byz_addondatabasetype="DRIVE" or byz_addondatabasetype="ODBC") then byz_addondatabasetype="ACCESS" end if if (byz_addondatabasetype<>"ACCESS" and byz_addondatabasetype<>"SQLSERVER" and byz_addondatabasetype<>"MYSQL") then byz_addondatabasetype="SQLSERVER" end if End Sub Function BYZRawDataTextToColSetText(arg_in_datatext) Dim retval if (arg_in_datatext="" or IsNull(arg_in_datatext)=true) then retval="null" else retval=arg_in_datatext retval=Replace(retval,"'","''") retval="'"&retval&"'" end if BYZRawDataTextToColSetText=retval End Function Function BYZRawDataDateToColSetDate(arg_in_datadate) Dim retval Dim mysqldateformatday Dim mysqldateformatmonth Dim mysqldateformatyear Dim mysqldateformathour Dim mysqldateformatminute Dim mysqldateformatsecond Dim mysqldateformatall Dim mysqldateformatmask Dim tdatetouse if (arg_in_datadate="" or IsNull(arg_in_datadate)=true) then retval="null" else ' BYZ: 03-MAR-2005: Added date translation of months for non-english sites: if (IsDate(arg_in_datadate)=false) then tdatetouse=Left(arg_in_datadate,2) Select Case Mid(arg_in_datadate,4,3) Case "JAN" tdatetouse=tdatetouse&"-"&UCase(Left(MonthName(1),3)) Case "FEB" tdatetouse=tdatetouse&"-"&UCase(Left(MonthName(2),3)) Case "MAR" tdatetouse=tdatetouse&"-"&UCase(Left(MonthName(3),3)) Case "APR" tdatetouse=tdatetouse&"-"&UCase(Left(MonthName(4),3)) Case "MAY" tdatetouse=tdatetouse&"-"&UCase(Left(MonthName(5),3)) Case "JUN" tdatetouse=tdatetouse&"-"&UCase(Left(MonthName(6),3)) Case "JUL" tdatetouse=tdatetouse&"-"&UCase(Left(MonthName(7),3)) Case "AUG" tdatetouse=tdatetouse&"-"&UCase(Left(MonthName(8),3)) Case "SEP" tdatetouse=tdatetouse&"-"&UCase(Left(MonthName(9),3)) Case "OCT" tdatetouse=tdatetouse&"-"&UCase(Left(MonthName(10),3)) Case "NOV" tdatetouse=tdatetouse&"-"&UCase(Left(MonthName(11),3)) Case "DEC" tdatetouse=tdatetouse&"-"&UCase(Left(MonthName(12),3)) End Select tdatetouse=tdatetouse&"-"&Right(arg_in_datadate,4) else tdatetouse=arg_in_datadate end if if (byz_addondatabasetype="ACCESS") then retval="#"&CDate(tdatetouse)&"#" end if if (byz_addondatabasetype="SQLSERVER") then ' BYZ: 29-APR-2005: Added sqlserver date formatting Dim sqlserverbasedate Dim sqlserverdateformatday Dim sqlserverdateformatmonth Dim sqlserverdateformatyear Dim sqlserverdateformathour Dim sqlserverdateformatminute Dim sqlserverdateformatsecond Dim sqlserverdateformatall sqlserverbasedate=CDate(tdatetouse) sqlserverdateformatday=Day(sqlserverbasedate) if (Len(sqlserverdateformatday)<2) then sqlserverdateformatday="0"&sqlserverdateformatday end if sqlserverdateformatmonth=MonthName(Month(sqlserverbasedate)) sqlserverdateformatyear=Year(sqlserverbasedate) sqlserverdateformathour=Hour(sqlserverbasedate) if (Len(sqlserverdateformathour)<2) then sqlserverdateformathour="0"&sqlserverdateformathour end if sqlserverdateformatminute=Minute(sqlserverbasedate) if (Len(sqlserverdateformatminute)<2) then sqlserverdateformatminute="0"&sqlserverdateformatminute end if sqlserverdateformatsecond=Second(sqlserverbasedate) if (Len(sqlserverdateformatsecond)<2) then sqlserverdateformatsecond="0"&sqlserverdateformatsecond end if sqlserverdateformatall=sqlserverdateformatday&"/"& _ sqlserverdateformatmonth&"/"& _ sqlserverdateformatyear&" "& _ sqlserverdateformathour&":"& _ sqlserverdateformatminute&":"& _ sqlserverdateformatsecond retval="'"&sqlserverdateformatall&"'" end if if (byz_addondatabasetype="MYSQL") then mysqldateformatday=Day(CDate(tdatetouse)) if (Len(mysqldateformatday)<2) then mysqldateformatday="0"&mysqldateformatday end if mysqldateformatmonth=Month(CDate(tdatetouse)) if (Len(mysqldateformatmonth)<2) then mysqldateformatmonth="0"&mysqldateformatmonth end if mysqldateformatyear=Year(CDate(tdatetouse)) mysqldateformathour=Hour(CDate(tdatetouse)) if (Len(mysqldateformathour)<2) then mysqldateformathour="0"&mysqldateformathour end if mysqldateformatminute=Minute(CDate(tdatetouse)) if (Len(mysqldateformatminute)<2) then mysqldateformatminute="0"&mysqldateformatminute end if mysqldateformatsecond=Second(CDate(tdatetouse)) if (Len(mysqldateformatsecond)<2) then mysqldateformatsecond="0"&mysqldateformatsecond end if mysqldateformatall= mysqldateformatyear&"*"& _ mysqldateformatmonth&"*"& _ mysqldateformatday&"*"& _ mysqldateformathour&"*"& _ mysqldateformatminute&"*"& _ mysqldateformatsecond mysqldateformatmask="%Y*%m*%d*%H*%i*%S" retval="DATE_FORMAT('"&mysqldateformatall&"','"&mysqldateformatmask&"')" end if end if BYZRawDataDateToColSetDate=retval End Function Function BYZRawDataTextToHTMLText(arg_in_datatext) Dim retval if (arg_in_datatext="" or IsNull(arg_in_datatext)=true) then retval=" " else retval=arg_in_datatext retval=Replace(retval,"<","<") retval=Replace(retval,">",">") retval=Replace(retval,chr(10),"
    ") end if BYZRawDataTextToHTMLText=retval End Function Function BYZDoesAddonTableExist() Dim tconn ' Dim ttablelist(1000) Dim ttablelist Dim ttablecount Dim i Dim j ShopOpendatabase tconn GetDataBaseTables ttablelist,ttablecount,tconn ShopClosedatabase tconn j=0 for i=1 to ttablecount if (LCase(ttablelist(i-1))="byz_vpaspaddons") then j=1 i=ttablecount+1 end if next if (j=1) then BYZDoesAddonTableExist="Y" else BYZDoesAddonTableExist="N" end if End Function Sub BYZForceAddonTableToExist Dim tsql Dim tconn if (BYZDoesAddonTableExist()="N") then ShopOpendatabase tconn if (byz_addondatabasetype="ACCESS") then tsql="create table byz_vpaspaddons" tsql=tsql&" (" tsql=tsql&" byz_id counter" tsql=tsql&",byz_code text (20)" tsql=tsql&",byz_versionnumber text (2)" tsql=tsql&",byz_versiondate datetime" tsql=tsql&",byz_lastupdatedate datetime" tsql=tsql&",byz_name text (255)" tsql=tsql&",byz_desc Memo" tsql=tsql&",byz_examples Memo" tsql=tsql&",byz_files Memo" tsql=tsql&")" end if if (byz_addondatabasetype="SQLSERVER") then tsql="create table byz_vpaspaddons" tsql=tsql&" (" tsql=tsql&" byz_id int identity(1,1) not null" tsql=tsql&",byz_code varchar(20)" tsql=tsql&",byz_versionnumber varchar(2)" tsql=tsql&",byz_versiondate datetime" tsql=tsql&",byz_lastupdatedate datetime" tsql=tsql&",byz_name varchar(255)" tsql=tsql&",byz_desc varchar(2000)" tsql=tsql&",byz_examples varchar(2000)" tsql=tsql&",byz_files varchar(2000)" tsql=tsql&")" end if if (byz_addondatabasetype="MYSQL") then tsql="create table byz_vpaspaddons" tsql=tsql&" (" tsql=tsql&" byz_id int(11) NOT NULL auto_increment" tsql=tsql&",byz_code varchar(20)" tsql=tsql&",byz_versionnumber varchar(2)" tsql=tsql&",byz_versiondate date" tsql=tsql&",byz_lastupdatedate date" tsql=tsql&",byz_name varchar(255)" tsql=tsql&",byz_desc longtext" tsql=tsql&",byz_examples longtext" tsql=tsql&",byz_files longtext," tsql=tsql&" PRIMARY KEY (byz_id)" tsql=tsql&")" end if tconn.Execute(tsql) ShopClosedatabase tconn end if End Sub Sub BYZUpgradeorInstall(arg_in_code,arg_in_versionnumber,arg_in_versiondate,arg_in_name,arg_in_desc,arg_in_examples,arg_in_files) Dim tsql Dim tconn Dim tRS ShopOpendatabase tconn tsql="delete from byz_vpaspaddons where byz_code="&BYZRawDataTextToColSetText(arg_in_code) tconn.Execute(tsql) tsql="insert into byz_vpaspaddons " tsql=tsql&" (" tsql=tsql&" byz_code" tsql=tsql&",byz_versionnumber" tsql=tsql&",byz_versiondate" tsql=tsql&",byz_lastupdatedate" tsql=tsql&",byz_name" tsql=tsql&",byz_desc" tsql=tsql&",byz_examples" tsql=tsql&",byz_files" tsql=tsql&") values (" tsql=tsql&BYZRawDataTextToColSetText(arg_in_code) tsql=tsql&","&BYZRawDataTextToColSetText(arg_in_versionnumber) tsql=tsql&","&BYZRawDataDateToColSetDate(arg_in_versiondate) tsql=tsql&","&BYZRawDataDateToColSetDate(CDate(Now())) tsql=tsql&","&BYZRawDataTextToColSetText(arg_in_name) tsql=tsql&","&BYZRawDataTextToColSetText(arg_in_desc) tsql=tsql&","&BYZRawDataTextToColSetText(arg_in_examples) tsql=tsql&","&BYZRawDataTextToColSetText(arg_in_files) tsql=tsql&")" tconn.Execute(tsql) ShopClosedatabase tconn End Sub Function BYZ_SYS_GET_CATEGORY_RESTRICTIONS_CLAUSE(arg_in_table_alias) Dim tsql Dim tprefix if (arg_in_table_alias<>"" and IsNull(arg_in_table_alias)=false) then tprefix=arg_in_table_alias&"." else tprefix="" end if tsql=tprefix&"cathide is null" if getconfig("xproductmatch")="Yes" then tsql=tsql& " and "&BYZ_SYS_GET_PRODUCT_MATCH_CLAUSE(arg_in_table_alias) end if if getconfig("xproductmatchcustomer")="Yes" then tsql=tsql& " and "&BYZ_SYS_GET_CUSTOMER_MATCH_CLAUSE(arg_in_table_alias) end if if (getconfig("xselectproductsbylanguage")="Yes" and getsess("language")<>"" and IsNull(getsess("language"))=false) then tsql=tsql& " and ("&tprefix&"catlanguage='" & getsess("language") & "'" tsql=tsql& " or "&tprefix&"catlanguage is null)" end if tsql="("&tsql&")" BYZ_SYS_GET_CATEGORY_RESTRICTIONS_CLAUSE=tsql End Function Function BYZ_SYS_GET_PRODUCT_RESTRICTIONS_CLAUSE(arg_in_table_alias) Dim tsql Dim tprefix Dim txstocklow Dim tlngcstock Dim tlanguage if (arg_in_table_alias<>"" and IsNull(arg_in_table_alias)=false) then tprefix=arg_in_table_alias&"." else tprefix="" end if tsql=tprefix&"hide=0" ' Low Stock: txstocklow=getconfig("xstocklow") if (txstocklow<>"" and IsNull(txstocklow)=false) then tlngcstock=clng(txstocklow) tsql=tsql&" and "&tprefix&"cstock>"&tlngcstock end if ' Product Match: if (getconfig("xproductmatch")="Yes") then tsql=tsql&" and " tsql=tsql&BYZ_SYS_GET_PRODUCT_MATCH_CLAUSE(arg_in_table_alias) end if ' Customer Product Match: if getconfig("xproductmatchcustomer")="Yes" then tsql=tsql&" and " tsql=tsql&BYZ_SYS_GET_CUSTOMER_MATCH_CLAUSE(arg_in_table_alias) end if ' Language: tlanguage=getsess("language") if (getconfig("xselectproductsbylanguage")="Yes" and tlanguage<>"" and IsNull(tlanguage)=false) then tsql=tsql&" and ("&tprefix&"clanguage='" & tlanguage & "'" tsql=tsql&" or "&tprefix&"clanguage is null)" end if ' Inventory: tsql=tsql&" and ("&tprefix&"highercatalogid is null)" tsql="("&tsql&")" BYZ_SYS_GET_PRODUCT_RESTRICTIONS_CLAUSE=tsql End Function Function BYZ_SYS_GET_CUSTOMER_MATCH_CLAUSE(arg_in_table_alias) Dim tCustomerProductGroup Dim tsql Dim tcolname Dim tprefix if (arg_in_table_alias<>"" and IsNull(arg_in_table_alias)=false) then tprefix=arg_in_table_alias&"." else tprefix="" end if tcolname=tprefix&"customermatch" tCustomerProductGroup=GetSess("CustomerProductGroup") if (tCustomerProductGroup<>"" and IsNull(tCustomerProductGroup)=false) then tsql="("&tcolname&" like '%" & tCustomerProductGroup & "%'" tsql=tsql&" or "&tcolname&" is null)" else tsql=tcolname&" is null" end if BYZ_SYS_GET_CUSTOMER_MATCH_CLAUSE=tsql End Function Function BYZ_SYS_GET_PRODUCT_MATCH_CLAUSE(arg_in_table_alias) Dim shops(50) Dim shopcount Dim i Dim tsql Dim tprefix if (arg_in_table_alias<>"" and IsNull(arg_in_table_alias)=false) then tprefix=arg_in_table_alias&"." else tprefix="" end if tsql="" parserecord xproductmatch,shops,shopcount,"," tsql=tsql&"(" for i=0 to shopcount-1 if (i>0) then tsql=tsql&" or " end if tsql=tsql&" "&tprefix&"productmatch like '%" & shops(i) & "%'" next tsql=tsql&" or "&tprefix&"productmatch is null)" BYZ_SYS_GET_PRODUCT_MATCH_CLAUSE=tsql End Function %><% Sub BYZ_SYS_OPEN_CURSOR(arg_in_sqlquerytext,arg_out_cursor_object,arg_in_conn) Set arg_out_cursor_object=Server.CreateObject("ADODB.Recordset") arg_out_cursor_object.open arg_in_sqlquerytext,arg_in_conn,adOpenDynamic,adLockOptimistic End Sub Sub BYZ_SYS_CLOSE_CURSOR(arg_in_cursor_object) arg_in_cursor_object.Close Set arg_in_cursor_object=Nothing End Sub ' Equivalent to the generic vpasp GetFieldValues function, but with relevant extra logic ' added so that it always caters for ntext columns etc regardless of which version of vpasp is being used. ' NOTE: arg_out_fieldcount returns the actual number of columns in the select list of the query ' (starting with 1 for the first column) rather than the generic GetFieldValues function ' which starts from 0 and returns 1 less than the number of columns. ' The returned arrays start with element 0 for the first column. Sub BYZ_SYS_GET_FIELD_VALUES_FOR_CURSOR(arg_in_cursor,arg_out_fieldnames,arg_out_fieldvalues,arg_out_fieldtypes,arg_out_fieldcount) Dim i Dim fldname Dim tfieldcount i=0 for each fldName in arg_in_cursor.Fields arg_out_fieldnames(i)=ucase(fldname.name) arg_out_fieldtypes(i)=fldname.type if arg_out_fieldtypes(i)="201" then arg_out_fieldvalues(i)=arg_in_cursor(i) end if i=i+1 next tfieldcount=i for i=1 to tfieldcount if arg_out_fieldtypes(i-1)="203" then arg_out_fieldvalues(i-1)=arg_in_cursor(i-1).value end if next for i=1 to tfieldcount if (arg_out_fieldtypes(i-1)<>"201" and arg_out_fieldtypes(i-1)<>"203") then arg_out_fieldvalues(i-1)=arg_in_cursor(i-1).value end if next for i=1 to tfieldcount if (arg_out_fieldvalues(i-1)="" or IsNull(arg_out_fieldvalues(i-1))=true) then arg_out_fieldvalues(i-1)="" end if next arg_out_fieldcount=tfieldcount End Sub ' Check if a given file physically exists on the server. ' The inward argument is always expected to be an absolute path, ' never an "http" path or a virtual path or a relative path. ' Returns "YES" for file-exists, or "NO" for file does not exist Function BYZ_SYS_DOES_FILE_EXIST(arg_in_absolute_path) Dim fsobj if (arg_in_absolute_path="" or IsNull(arg_in_absolute_path)=true) then BYZ_SYS_DOES_FILE_EXIST="NO" exit function end if set fsObj=Server.CreateObject("Scripting.FileSystemObject") if (fsObj.FileExists(arg_in_absolute_path)=true) then BYZ_SYS_DOES_FILE_EXIST="YES" else BYZ_SYS_DOES_FILE_EXIST="NO" end if Set fsobj=nothing End Function %><% BYZGetDataBaseTypeForAddons %> <% ' **************************************** ' * Multiple-SelectLists (Get HTML Only) * ' **************************************** ' Function to get the html to show a dynamic poplist with multiple values chooseable ' Arguments: ' 1. Name of the poplist field that you want to create ' 2. Add "Please select a value" to the top of the poplist ? (Y/N) ' This assigns arg_in_psel_val's value as a "please select" value ' 3. PopList Description for "Please select" value (optional) ' 4. Value assigned for "Please select" value (optional) ' 5. Count of values in the poplist (excluding "please select" values; ie real data values only) ' 6. Array of poplist ID values (not including "please select" values) ' 7. Array of poplist Description values (not including "please select" descriptions) ' 8. Array of "value chosen?" flags ("Y" or "N") ' 9. Class (style) that poplist should use (optional) ' 10. Display Size that poplist should use (should always be more than 1) ' This is the number of records that'll be visible at a given time in the multi-list. Function BYZShowDynamicMultiPopListGetHTML( _ arg_in_fieldname, _ arg_in_add_psel, _ arg_in_psel_text, _ arg_in_psel_val, _ arg_in_poplist_values_count, _ arg_in_poplist_values_ids, _ arg_in_poplist_values_descriptions, _ arg_in_poplist_values_chosenflags, _ arg_in_class, _ arg_in_displaysize) Dim i Dim tthisval Dim tsize Dim thtmlcode Dim tfirstrealval Dim tpseldesc Dim tversionhtml tfirstrealval=arg_in_poplist_values_ids(0) tpseldesc=arg_in_psel_text thtmlcode=vbcrlf&"" %><% ' This file is used for reference so that you (and some bigyellowzone.com modules) ' know which modules/versions you have physically installed on a given system ' You should never manually change this file, you should only ever overwrite it with ' official bigyellowzone.com updates. Dim byz025installed_code Dim byz025installed_version Dim byz025installed_version_date Dim byz025installed_name Dim byz025installed_contact_info Dim byz025installed_byk_prd_id byz025installed_code="BYZ025" byz025installed_version="06" byz025installed_version_date="09-MAR-2010" byz025installed_name="Dynamic PopList Creation for VP-ASP" byz025installed_contact_info="For support and more information visit http://www.bigyellowzone.com or http://www.bigyellowkey.com" byz025installed_byk_prd_id=207 %><% tversionhtml="<"&"!"&"-- "&byz025installed_name&" "&byz025installed_code&" (V"&byz025installed_version&"/"&byz025installed_version_date&")" tversionhtml=tversionhtml&" "&byz025installed_contact_info tversionhtml=tversionhtml&" --"&">" thtmlcode=vbcrlf&tversionhtml&thtmlcode BYZShowDynamicMultiPopListGetHTML=thtmlcode End Function ' *********************************************** ' * Multiple-SelectLists (Get and display HTML) * ' *********************************************** ' Function to show a dynamic poplist with multiple values chooseable ' Arguments: ' 1. Name of the poplist field that you want to create ' 2. Add "Please select a value" to the top of the poplist ? (Y/N) ' This assigns arg_in_psel_val's value as a "please select" value ' 3. PopList Description for "Please select" value (optional) ' 4. Value assigned for "Please select" value (optional) ' 5. Count of values in the poplist (excluding "please select" values; ie real data values only) ' 6. Array of poplist ID values (not including "please select" values) ' 7. Array of poplist Description values (not including "please select" descriptions) ' 8. Array of "value chosen?" flags ("Y" or "N") ' 9. Class (style) that poplist should use (optional) ' 10. Display Size that poplist should use (should always be more than 1) ' This is the number of records that'll be visible at a given time in the multi-list. Sub BYZShowDynamicMultiPopList( _ arg_in_fieldname, _ arg_in_add_psel, _ arg_in_psel_text, _ arg_in_psel_val, _ arg_in_poplist_values_count, _ arg_in_poplist_values_ids, _ arg_in_poplist_values_descriptions, _ arg_in_poplist_values_chosenflags, _ arg_in_class, _ arg_in_displaysize) Dim thtmlcode thtmlcode=BYZShowDynamicMultiPopListGetHTML( _ arg_in_fieldname, _ arg_in_add_psel, _ arg_in_psel_text, _ arg_in_psel_val, _ arg_in_poplist_values_count, _ arg_in_poplist_values_ids, _ arg_in_poplist_values_descriptions, _ arg_in_poplist_values_chosenflags, _ arg_in_class, _ arg_in_displaysize) Response.Write thtmlcode End Sub ' *********************************** ' * PopLists (Get and display HTML) * ' *********************************** ' Function to get and display the html to show a dynamic poplist with just one value chooseable Sub BYZShowDynamicPopListMain( _ arg_in_fieldname, _ arg_in_current_fieldvalue, _ arg_in_add_psel, _ arg_in_psel_text, _ arg_in_psel_val, _ arg_in_add_sellall, _ arg_in_selall_text, _ arg_in_selall_val, _ arg_in_poplist_values_ids, _ arg_in_poplist_values_descriptions, _ arg_in_poplist_values_count, _ arg_in_class, _ arg_in_javascript) Dim thtmlcode thtmlcode=BYZShowDynamicPopListMainGetHTML( _ arg_in_fieldname, _ arg_in_current_fieldvalue, _ arg_in_add_psel, _ arg_in_psel_text, _ arg_in_psel_val, _ arg_in_add_sellall, _ arg_in_selall_text, _ arg_in_selall_val, _ arg_in_poplist_values_ids, _ arg_in_poplist_values_descriptions, _ arg_in_poplist_values_count, _ arg_in_class, _ arg_in_javascript) Response.Write thtmlcode End Sub ' **************************** ' * PopLists (Get HTML Only) * ' **************************** ' Function to get the html to show a dynamic poplist with just one value chooseable Function BYZShowDynamicPopListMainGetHTML( _ arg_in_fieldname, _ arg_in_current_fieldvalue, _ arg_in_add_psel, _ arg_in_psel_text, _ arg_in_psel_val, _ arg_in_add_sellall, _ arg_in_selall_text, _ arg_in_selall_val, _ arg_in_poplist_values_ids, _ arg_in_poplist_values_descriptions, _ arg_in_poplist_values_count, _ arg_in_class, _ arg_in_javascript) Dim i Dim tthisval Dim thtmlcode Dim tfirstrealval Dim talldesc Dim tpseldesc Dim tversionhtml tfirstrealval=arg_in_poplist_values_ids(0) talldesc=arg_in_selall_text tpseldesc=arg_in_psel_text thtmlcode=vbcrlf&"" %><% ' This file is used for reference so that you (and some bigyellowzone.com modules) ' know which modules/versions you have physically installed on a given system ' You should never manually change this file, you should only ever overwrite it with ' official bigyellowzone.com updates. Dim byz025installed_code Dim byz025installed_version Dim byz025installed_version_date Dim byz025installed_name Dim byz025installed_contact_info Dim byz025installed_byk_prd_id byz025installed_code="BYZ025" byz025installed_version="06" byz025installed_version_date="09-MAR-2010" byz025installed_name="Dynamic PopList Creation for VP-ASP" byz025installed_contact_info="For support and more information visit http://www.bigyellowzone.com or http://www.bigyellowkey.com" byz025installed_byk_prd_id=207 %><% tversionhtml="<"&"!"&"-- "&byz025installed_name&" "&byz025installed_code&" (V"&byz025installed_version&"/"&byz025installed_version_date&")" tversionhtml=tversionhtml&" "&byz025installed_contact_info tversionhtml=tversionhtml&" --"&">" thtmlcode=vbcrlf&tversionhtml&thtmlcode BYZShowDynamicPopListMainGetHTML=thtmlcode End Function ' ******************************************** ' * PopLists (no javascript) (Get HTML Only) * ' ******************************************** Function BYZShowDynamicPopListGetHTML( _ arg_in_fieldname, _ arg_in_current_fieldvalue, _ arg_in_add_psel, _ arg_in_psel_text, _ arg_in_psel_val, _ arg_in_add_sellall, _ arg_in_selall_text, _ arg_in_selall_val, _ arg_in_poplist_values_ids, _ arg_in_poplist_values_descriptions, _ arg_in_poplist_values_count, _ arg_in_class) Dim thtmlcode thtmlcode=BYZShowDynamicPopListMainGetHTML( _ arg_in_fieldname, _ arg_in_current_fieldvalue, _ arg_in_add_psel, _ arg_in_psel_text, _ arg_in_psel_val, _ arg_in_add_sellall, _ arg_in_selall_text, _ arg_in_selall_val, _ arg_in_poplist_values_ids, _ arg_in_poplist_values_descriptions, _ arg_in_poplist_values_count, _ arg_in_class, _ "") BYZShowDynamicPopListGetHTML=thtmlcode End Function ' *************************************************** ' * PopLists (no javascript) (Get and display HTML) * ' *************************************************** ' Function to show a dynamic poplist with a single value chooseable ' Arguments: ' 1. Name of the poplist field that you want to create ' 2. The current value that the poplist should be assigned to ' optional; will fall-through if null using: ' a) code for "please select" ' b) code for "all values" ' c) First real data value ' 3. Add "Please select a value" to the top of the poplist ? (Y/N) ' This assigns arg_in_psel_val's value as a "please select" value ' 4. PopList Description for "Please select" value (optional) ' 5. Value assigned for "Please select" value (optional) ' 6. Add "select all" to the top of the poplist ? (Y/N) ' This assigns arg_in_selall_val's value as a "selected all" value ' 7. PopList Description for "Select all" value (optional) ' 8. Value assigned for "Select all" value (optional) ' 9. Array of poplist ID values (not including "please select" or "select all" values) ' 10. Array of poplist Description values (not including "please select" or "select all" descriptions) ' 11. Count of values in the poplist (excluding "please select" and "select all" values; ie real data values only) ' 12. Class (style) that poplist should use (optional) Sub BYZShowDynamicPopList( _ arg_in_fieldname, _ arg_in_current_fieldvalue, _ arg_in_add_psel, _ arg_in_psel_text, _ arg_in_psel_val, _ arg_in_add_sellall, _ arg_in_selall_text, _ arg_in_selall_val, _ arg_in_poplist_values_ids, _ arg_in_poplist_values_descriptions, _ arg_in_poplist_values_count, _ arg_in_class) Dim thtmlcode thtmlcode=BYZShowDynamicPopListGetHTML( _ arg_in_fieldname, _ arg_in_current_fieldvalue, _ arg_in_add_psel, _ arg_in_psel_text, _ arg_in_psel_val, _ arg_in_add_sellall, _ arg_in_selall_text, _ arg_in_selall_val, _ arg_in_poplist_values_ids, _ arg_in_poplist_values_descriptions, _ arg_in_poplist_values_count, _ arg_in_class) Response.Write thtmlcode End Sub ' ********************************************** ' * PopLists (with javascript) (Get HTML Only) * ' ********************************************** Function BYZShowDynamicPopListWithJavaScriptGetHTML( _ arg_in_fieldname, _ arg_in_current_fieldvalue, _ arg_in_add_psel, _ arg_in_psel_text, _ arg_in_psel_val, _ arg_in_add_sellall, _ arg_in_selall_text, _ arg_in_selall_val, _ arg_in_poplist_values_ids, _ arg_in_poplist_values_descriptions, _ arg_in_poplist_values_count, _ arg_in_class, _ arg_in_javascript) Dim thtmlcode thtmlcode=BYZShowDynamicPopListMainGetHTML( _ arg_in_fieldname, _ arg_in_current_fieldvalue, _ arg_in_add_psel, _ arg_in_psel_text, _ arg_in_psel_val, _ arg_in_add_sellall, _ arg_in_selall_text, _ arg_in_selall_val, _ arg_in_poplist_values_ids, _ arg_in_poplist_values_descriptions, _ arg_in_poplist_values_count, _ arg_in_class, _ arg_in_javascript) BYZShowDynamicPopListWithJavaScriptGetHTML=thtmlcode End Function ' ***************************************************** ' * PopLists (with javascript) (Get and display HTML) * ' ***************************************************** ' Function to show a dynamic poplist with a single value chooseable ' Same as the main dynamic poplist function, but allows javascript "triggers" etc ' Arguments: ' 1. Name of the poplist field that you want to create ' 2. The current value that the poplist should be assigned to ' optional; will fall-through if null using: ' a) code for "please select" ' b) code for "all values" ' c) First real data value ' 3. Add "Please select a value" to the top of the poplist ? (Y/N) ' This assigns arg_in_psel_val's value as a "please select" value ' 4. PopList Description for "Please select" value (optional) ' 5. Value assigned for "Please select" value (optional) ' 6. Add "select all" to the top of the poplist ? (Y/N) ' This assigns arg_in_selall_val's value as a "selected all" value ' 7. PopList Description for "Select all" value (optional) ' 8. Value assigned for "Select all" value (optional) ' 9. Array of poplist ID values (not including "please select" or "select all" values) ' 10. Array of poplist Description values (not including "please select" or "select all" descriptions) ' 11. Count of values in the poplist (excluding "please select" and "select all" values; ie real data values only) ' 12. Class (style) that poplist should use (optional) ' 13. JavaScript call to use (optional) ' Example argument value: ' "onchange=""DoMyFunction(); return true;"&chr(34) Sub BYZShowDynamicPopListWithJavaScript( _ arg_in_fieldname, _ arg_in_current_fieldvalue, _ arg_in_add_psel, _ arg_in_psel_text, _ arg_in_psel_val, _ arg_in_add_sellall, _ arg_in_selall_text, _ arg_in_selall_val, _ arg_in_poplist_values_ids, _ arg_in_poplist_values_descriptions, _ arg_in_poplist_values_count, _ arg_in_class, _ arg_in_javascript) Dim thtmlcode thtmlcode=BYZShowDynamicPopListWithJavaScriptGetHTML( _ arg_in_fieldname, _ arg_in_current_fieldvalue, _ arg_in_add_psel, _ arg_in_psel_text, _ arg_in_psel_val, _ arg_in_add_sellall, _ arg_in_selall_text, _ arg_in_selall_val, _ arg_in_poplist_values_ids, _ arg_in_poplist_values_descriptions, _ arg_in_poplist_values_count, _ arg_in_class, _ arg_in_javascript) Response.Write thtmlcode End Sub %> <% ' Customer-Side function files will be included at the bottom of this file ' as/when additional relevant BigYellowZone.com modules get installed. %> <% ' Admin function files will be included at the bottom of this file ' as/when additional relevant BigYellowZone.com modules get installed. %><% 'VP-ASP 6.08 - "Remember" current page SetSess "convertBackBackpage",GetSess("convertBackpage") SetSess "convertBackpage",GetSess("convertCurrentpage") 'VP-ASP 6.50 - clean querystring before including in session if request.servervariables("query_string")<>"" then dim newcurrentpage if request.QueryString > "" then dim theQuerystring, thing, qsdelimiter qsdelimiter = "?" theQuerystring = split(request.QueryString, "&") for each thing in theQueryString '------------------------------------------ ' VP-ASP 6.50.4 Bugs Fix - 08 October 2008 '------------------------------------------ if len(thing) > 0 and instr(thing,"=") then if left(thing, instr(thing, "=") - 1) <> "CID" AND left(thing, instr(thing, "=") - 1) <> "goback" then goToQS = goToQS & qsdelimiter & thing if qsdelimiter = "?" then qsdelimiter = "&" end if end if next end if newcurrentpage = request.servervariables("script_name") & gotoqs SetSess "convertCurrentpage", newcurrentpage else SetSess "convertCurrentpage",request.servervariables("script_name") end if 'VP-ASP 6.09 - if no country loaded, then set to default IF getSess("CID") = "" THEN 'VP-ASP 6.50 - don't do this if using diag page if (instr(lcase(request.ServerVariables("script_name")), "diag_dbtest.asp") > 0) OR (instr(lcase(request.ServerVariables("script_name")), "convert650.asp") > 0) then 'do nothing else GetCurrency end if end if '******************************************************* ' main database open for: access, Sql Server, ODBC and MYSQL '********************************************************* Sub ShopOpenDataBase (connection) 'Sess ("db")= needs to be set to access file name or ODBC connection dim databasetype on error resume next databasetype=ucase(xdatabasetype) ShopInit if Getconfig("xLCID")<>"" then Session.LCID=getconfig("xlcid") ' set user supplied LCID '------------------------------------------ ' VP-ASP 6.50.4 Bugs Fix - 08 October 2008 '------------------------------------------ if Err.Number > 0 then session.lcid = "" end if On Error GoTo 0 end if CheckValidOrdernumber CheckValidLogin If databasetype="" or databasetype="DRIVE" then ProcessAccessOpen connection exit sub end if if databasetype="ODBC" then database= GetSess("db") ProcessODBC connection exit sub end if if databasetype="SQLSERVER" then ProcessSQLServer connection exit sub end if if databasetype="MYSQL" then ProcessMYSQLServer connection exit sub end if if databasetype="MYSQL351" then ProcessMYSQLServer connection exit sub end if 'VP-ASP 6.50 - add support for Access 2007 if databasetype="ACCESS2007" then ProcessAccess2007 connection exit sub end if end sub '****************************************************** ' Open Access Database Sub ProcessAccessOpen(connection) dim dblocation dim strconn dim database database=GetSess("db") & ".mdb" ' database name dblocation=GetSess("dblocation")' location If dblocation<>"" then database = GetSess("dblocation") & "\" & database end if if ucase(xdatabasetype)="DRIVE" Then If xAccessOle<>"Yes" then strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & database else strconn = "provider=microsoft.jet.oledb.4.0;persist security info=false;data source=" & database end if 'strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=D:\webs\vpasp\data\shopping2.mdb" else If xAccessole<>"Yes" then strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath(database) else strconn = "provider=microsoft.jet.oledb.4.0;persist security info=false;data source=" & Server.MapPath(database) end if end if if getconfig("xdebug")="Yes" then debugwrite strconn end if Set connection = Server.CreateObject("ADODB.Connection") on error resume next If xsqlpwd="" then connection.open strConn else connection.open strConn,xsqluser,xsqlpwd end if 'SetSess "dbc", connection If connection.errors.count> 0 then SetSess "Openerror", "Open Messages
    " & connection.errors(0).description & "
    " & GetSess("dbc") else SetSess "Openerror","" end if End Sub '****************************************************** ' VP-ASP 6.50 - Add support for Access 2007 Database Sub ProcessAccess2007 (connection) dim dblocation dim strconn dim database database=GetSess("db") & ".accdb" ' database name dblocation=GetSess("dblocation")' location If dblocation<>"" then database = GetSess("dblocation") & "\" & database end if strconn = "Provider=Microsoft.ACE.OLEDB.12.0;persist security info=false;data source=" & Server.MapPath(database) if getconfig("xdebug")="Yes" then debugwrite strconn end if Set connection = Server.CreateObject("ADODB.Connection") on error resume next If xsqlpwd="" then connection.open strConn else connection.open strConn,xsqluser,xsqlpwd end if 'SetSess "dbc", connection If connection.errors.count> 0 then SetSess "Openerror", "Open Messages
    " & connection.errors(0).description & "
    " & GetSess("dbc") else SetSess "Openerror","" end if End Sub '****************************************************************************** Sub ProcessODBC (connection) on error resume next dim strconn Set connection = Server.CreateObject("ADODB.Connection") strconn=GetSess("db") ' xdatabase = ODBC connection connection.open strConn 'SetSess "dbc", connection If connection.errors.count> 0 then SetSess "Openerror", "Open Messages
    " & connection.errors(0).description & "
    " & GetSess("dbc") else SetSess "Openerror", "" end if end sub '****************************************************** ' Open SQL Server Sub ProcessSqlServer(connection) Set connection = Server.CreateObject("ADODB.Connection") Dim varServerIP, varUserName, varPassword, varDataBaseName dim strconn varServerIP = xSQLServer varUserName = xSQLUser varPassword = xSQLPwd varDataBaseName = GetSess("db") If xSQLOLEDB="Yes" then strconn="Provider=sqloledb;" & "Source=" & varServerIP & ";" & "database=" & varDataBaseName & ";" & "UID=" & varUserName & ";" & "Password=" & varPassword & ";" else 'VP-ASP 6.50 - advanced support for SQL Server 2005 if xSQLnative = "Yes" then strconn= "DRIVER={SQL Native Client}; Server=" & varServerIP & "; Database=" & varDataBaseName & "; UID=" & varUserName & "; PWD=" & varPassword else strconn= "DRIVER={SQL Server}; Server=" & varServerIP & "; Database=" & varDataBaseName & "; UID=" & varUserName & "; PWD=" & varPassword' end if end if Connection.Open strconn If connection.errors.count> 0 then SetSess "Openerror","Open Messages
    " & connection.errors(0).description & "
    " & GetSess("dbc") else SetSess "Openerror", "" end if end sub ' '****************************************************** ' Open MYSQL Sub ProcessMYSqlServer(connection) Set connection = Server.CreateObject("ADODB.Connection") Dim varServerIP, varUserName, varPassword, varDataBaseName varServerIP = xSQLServer varUserName = xSQLUser varPassword = xSQLPwd varDataBaseName = GetSess("db") dim mysqlconn on error resume next 'debugwrite "DRIVER={MySQL}; Server=" & varServerIP & "; Database=" & varDataBaseName & "; UID=" & varUserName & "; PWD=" & varPassword' if ucase(xdatabasetype)="MYSQL351" then mysqlconn="DRIVER={MYSQL ODBC 3.51 Driver};" else mysqlconn="DRIVER={MySQL}; " end if mysqlconn=mysqlconn & " Server=" & varServerIP & "; Database=" & varDataBaseName & "; UID=" & varUserName & "; PWD=" & varPassword Connection.Open mysqlconn 'Connection.Open "DRIVER={MySQL}; Server=" & varServerIP & "; Database=" & varDataBaseName & "; UID=" & varUserName & "; PWD=" & varPassword' If connection.errors.count> 0 then SetSess "Openerror","Open Messages
    " & connection.errors(0).description & "
    " & GetSess("dbc") else SetSess "Openerror", "" end if 'SetSess "dbc", connection end sub '*************** Sub ShopCloseDatabase (connection) on error resume next connection.close set connection=nothing End sub ' By change the shoppage_header and trailer you can make shop look specific to your merchant '******************************* Sub ShopCancelOrder ' called on cancel or when finished with order SetSess "CartCount",0 SetSess "oid","" SetSess "orderid","" SetSess "smprice", "" SetSess "taxes", "" 'If GetSess("Login")= "" then ' SetSess "Lastname","" 'end if SetSess "Giftid","" SetSess "GiftCertificate","" SetSess "Giftcount","" SetSess "GiftAmountMax","" SetSess "GiftAmountUsed","" SetSess "CouponDiscount","" SetSess "Coupon","" SetSess "Couponaffid","" setsess "shipmessage","" 'VP-ASP 6.09 - remove registry from session when order cancelled if REGISTRANTID <> "" Then setsess REGISTRANTID,"" end if 'VP-ASP 6.50 - add flag to order to say customer has agreed to terms setsess "blnlicense","" 'VP-ASP 6.50 - allow customer to upload images to order setsess "uploadimage", "" setsess "UploadFilename", "" End Sub '******************************************************************************** ' all routines dealing with actual cart are here ' CartaddItem () ' CartInit '******************************************************************************** '****** CartInit Sub CartInit Dim ArrCart dim maxcartitems, cartattributes maxcartitems=getconfig("xmaxcartitems") cartattributes=cMaxCartattributes If maxcartitems="" then exit sub ReDim arrcart(cartAttributes,maxCartItems) SetSessA "CartArray", arrcart SetSess "CartCount", 0 End Sub ' ******** Get Product from database Sub CartGetProduct(id, rc) ' change to SQl Query from Filter If id=lngcatalogid then if productfieldvalid=true then exit sub end if end if if not isnumeric(id) then rc=4 exit sub end if dim dbc dim productql dim rsitem ShopOpenDataBaseP dbc if dbc="" then Response.write "Unable to open database
    " & GetSess("dbc") rc=4 exit sub end if productql="select * from products where catalogid=" & id '------------------------------------------ ' VP-ASP 6.50.4 Bugs Fix - 08 October 2008 '------------------------------------------ if getconfig("xproductmatchcustomer") = "Yes" then if getsess("Customerproductgroup") <> "" then productql=productql & " and (customermatch ='" & getsess("Customerproductgroup") & "' or customermatch is Null)" else productql=productql & " and customermatch is Null" end if end if Set rsItem = dbc.execute(Productql) If Not rsItem.EOF Then ProductGetValues rsitem, dbc GetNameInCart rsitem, dbc ' in shop$colors rc=0 else rc=4 end if rsitem.close set rsitem=nothing ShopCloseDatabase dbc end sub '****************************************************************************** ' Logic to determine if we should reinitialize everyrthing Sub ShopInit() dim initname initname="Init" & "_" & xshopid if GetSess("INIT") <> "INIT" or GetSess("db")<>xdatabase then 'debugwrite "setting up session db= " & GetSess("db") SetupSession ShopInitapplication CartInit setsess "language",getconfig("xlanguage") If application(initname)="Yes" then SetSess "INIT","INIT" end if end if end sub Sub SetupSession() ' sets database for this session use "mydatabase" not "mydatabase.mdb" ' location is relative path to database such as ..\..\data ' end=1 means to reset everything regardless of current state ' SetSess "db", "" SetSess "dblocation", xdblocation SetSess "Shopadmin", "" SetSess "ShopadminDB", "" SetSess "GiftID", "" If GetSess("Login")<>"Force" then SetSess "Login","" end if database= GetSess("db") if database="" then SetSess "db", xdatabase ' default value end if 'response.write "Session initialized database = " & GetSess("db") & "
    " SetSessionTimeout If getconfig("XCookieLogin")="Yes" then RestoreCustomerDetailsCookie end if end sub ' Sub GetDB() 'used to set database name from form or querystring ' sets database for this session from quertstring or form dim database '-------------------------------------- ' VP-ASP Security Patch - 17 April 2008 '-------------------------------------- database=cleanchars(Request("db")) '-------------------------------------- if database <> "" then SetSess "db",database exit sub end if 'shoperror "Unable to locate database name" end sub ' SHopOpenRecordSet Sub ShopOpenRecordSet (mysql, rstemp, mypagesize, mypage) if dbc="" then exit sub end if If mysql="" Then shoperror getlang("LangRestart") end if Set rstemp = Server.CreateObject("ADODB.RecordSet") rstemp.cursorlocation=aduseclient 'VP-ASP 6.50 - broadened defintion of IF statement to cover cases where xmysql hasn't been set if ucase(xdatabasetype) = "MYSQL" OR ucase(xdatabasetype) = "MYSQL351" OR getconfig("xMYSQL")="Yes" then rstemp.cachesize=5 end if if getconfig("xdebug")="Yes" then DebugWrite mysql end if rstemp.Open MYSQL,dbc,adOpenKeyset,adLockReadOnly, adCmdText if not rstemp.eof then rstemp.movefirst if isnumeric(mypagesize) then rstemp.pagesize=mypagesize end if maxpages=cint(rstemp.pagecount) maxrecs=cint(rstemp.pagesize) rstemp.absolutepage=mypage end if end sub ' Sub ParseOption (Productoption, OptionName, OptionPrice) ' Option is in Form option [$xx.yy] Dim spos, epos Dim namelength Dim length OptionPrice=0 Optionname=Productoption const bracket= "[" const bracketend= "]" spos = instr(1,Productoption, bracket) if spos=0 then exit sub end if Namelength=spos-1 If namelength> 0 then Optionname= mid(ProductOption,1,namelength) end if spos=spos+1 epos = instr(spos,ProductOption,bracketend) if epos=0 then exit sub end if Length=epos-spos OptionPrice=Mid(ProductOption,spos,length) 'Response.write OptionPrice end sub Sub GenerateRadio (Fieldname,fieldvalue,radiotype, currentvalue) if currentvalue=Fieldvalue then %> <%=fieldname%>
    <% else %> <%=fieldname%>
    <% end if end sub Sub GenerateSelectV (iFieldnames,ifieldvalues,currentvalue,selectname,count, firstfield) dim i ' Generates Select with values %> <% end sub Sub GenerateSelectNV (iFieldnames,currentvalue,selectname, count,firstfield) ' Generates select with no values dim i %> <% end sub Sub GenerateSelectMULT (iFieldnames,fieldcount,currentvalues,currentvaluecount, selectname,firstfield) ' Generates select with no values %> <% end sub Sub GenerateSelectMULT_NOVALUES (iFieldnames,fieldcount,currentvalues,currentvaluecount, selectname,firstfield) ' Generates select with no values %> <% end sub Sub DebugWrite (msg) response.write msg & "
    " end sub ' Sub DiagnosticOpen (connection,database,databasetype) SetSess "db",database databasetype=ucase(databasetype) If databasetype="" then ProcessAccessOpen connection exit sub end if if databasetype="ODBC" then database= GetSess("db") ProcessODBC connection exit sub end if if databasetype="SQLSERVER" then ProcessSQLServer connection exit sub end if if databasetype="MYSQL" then ProcessMYSQLServer connection exit sub end if if databasetype="MYSQL351" then ProcessMYSQLServer connection exit sub end if 'VP-ASP 6.50 - add support for Access 2007 if databasetype="ACCESS2007" then ProcessAccess2007 connection exit sub end if ProcessAccessOpen connection end sub ' all admin now must use standard open Sub OpenDB (ByRef con, d) ShopOpenDatabase con End Sub %> <% '-------- Function GetAccess(user, con) dim objRec sql = "select * from tbluser where fldusername = '" & user & "'" Set objRec = con.Execute(SQL) if not objrec.eof then getaccess = objrec("fldaccess") else getaccess="" end if if getaccess = "" then if lcase(getsess("Admintype")) = "supplier" then sql = "select * from tbluser where fldusername = 'supplier'" Set objRec = con.Execute(SQL) if not objrec.eof then getaccess = objrec("fldaccess") else getaccess="" end if end if end if objRec.Close set objrec=nothing End Function Function UserTableAccess(user, table) Dim con, accessrec ShopOpenDatabase con Set accessrec = Server.CreateObject("ADODB.Recordset") sql = "select tablesallowed from tbluser where fldusername = '" & user & "'" Set accessrec = con.Execute(SQL) if not accessrec.eof then if instr("," & accessrec("tablesallowed") & ",", "," & table & ",") > 0 then UserTableAccess = True else UserTableAccess = False end if else UserTableAccess = False end if accessrec.Close set accessrec=nothing ShopCloseDatabase con End Function '------- Sub ShopCheckAdmin (filename) ' 31/1/2006 - functionality no longer supported 'If GetSess("ShopAdmin")="" Then ' If getconfig("XshowAdmin")<>"Yes" then ' shoperror getlang("LangAdminUnauth") ' else ' responseredirect getconfig("xadminpage") ' end if 'end if If Getsess("ShopAdmindb")<>xdatabase then ' 31/1/2006 - functionality no longer supported ' If getconfig("XshowAdmin")<>"Yes" then shoperror getlang("LangAdminUnauth") ' else 'responseredirect getconfig("xadminpage") ' end if end if If getconfig("xadminmenucheck")="Yes" then Validateadminmenu filename end if End Sub Sub ValidateadminMenu(filename) dim userid, scriptname, sql, rs, conn, id, menus dim found, tempname, pos userid=getsess("shopadmin") Menus=Getsess("AdminMenus") If menus="" then exit sub if filename="" then exit sub shopopendatabase conn sql="select * from tblaccess where fldauto in (" & menus & ")" 'debugwrite sql found=false set rs=conn.execute(sql) do while not rs.eof tempname=rs("fldurl") pos=instr(tempname,filename) if pos>0 then found=true exit do end if rs.movenext loop rs.close set rs=nothing Shopclosedatabase conn If found=true then exit sub If getconfig("XshowAdmin")<>"Yes" then shoperror getlang("LangAdminUnauth") end if end sub '--- login user activity Sub LogUser(user,io, dbc) dim indate, intime indate=datenormalize(date()) intime = formatdatetime(Time(),vbshorttime) SetSess "ShopAdmindb",xdatabase 'Log Users IP Address, fldip was added into the table and sql useripaddy=request.servervariables("REMOTE_ADDR") on error resume next login = "insert into tbllog (fldusername,fldtime,flddate,fldinout,fldipaddress) values('" & user & _ "','" & inTime & "','" & inDate & "','" & io & "','" & useripaddy & "')" dbc.Execute(login) End Sub Sub GetDataBaseTables (tables, tablecount,con) 'set array tables with names of tables in database dim table dim i dim tblName 'VP-ASP 6.08 - array lengthened from 250 to 300 for SQL Server 2005 compliance redim tables(300) Set table = con.OpenSchema (20) i=0 While Not table.EOF tblName= table("Table_Name") 'VP-ASP 6.08a - Added TABLE_TYPE check to stop VIEWS from appearing when using SQL SERVER 2005 If Left(tblName,4) <> "MSys" AND Left(tblName,3) <> "sys" AND Left(tblName,4) <> "RTbl" AND UCASE(table("TABLE_TYPE")) = "TABLE" Then Tables(i)=tblName i=i+1 end if table.MoveNext Wend Dim othertables(50),othercount,j If getconfig("xothertables")<>"" then parserecord getconfig("xothertables"),othertables,othercount,"," for j=0 to othercount-1 tables(i)=Othertables(j) i=i+1 next end if tablecount=i end sub 'VP-ASP 6.00 - Allow tables from split databases to be selected Sub GetDataBaseTablesPlus (tables, tablecount,con) 'set array tables with names of tables in database dim table dim i dim tblName redim preserve tables(250) Set table = con.OpenSchema (20) i=tablecount While Not table.EOF tblName= table("Table_Name") 'VP-ASP 6.08a - Added TABLE_TYPE check to stop VIEWS from appearing when using SQL SERVER 2005 If Left(tblName,4) <> "MSys" AND Left(tblName,3) <> "sys" AND Left(tblName,4) <> "RTbl" AND UCASE(table("TABLE_TYPE")) = "TABLE" Then Tables(i)=tblName i=i+1 end if table.MoveNext Wend Dim othertables(50),othercount,j If getconfig("xothertables")<>"" then parserecord getconfig("xothertables"),othertables,othercount,"," for j=0 to othercount-1 tables(i)=Othertables(j) i=i+1 next end if tablecount=i end sub '**************************************************** 'Open databases other than standard Sub OpenOtherDatabase (connection, indb, inlocation, intype) on error resume next if getconfig("xLCID")<>"" then Session.LCID=getconfig("xLCID") ' set user supplied LCID '------------------------------------------ ' VP-ASP 6.50.4 Bugs Fix - 08 October 2008 '------------------------------------------ if Err.Number > 0 then session.lcid = "" end if On Error GoTo 0 end if dim databasetype SaveSessionDB SetSess "db",indb SetSess "Dblocation",inlocation databasetype=ucase(intype) If databasetype="" or databasetype="DRIVE" then ProcessAccessOpen connection RestoreSessionDB exit sub end if if databasetype="ODBC" then database= GetSess("db") ProcessODBC connection RestoreSessionDB exit sub end if if databasetype="SQLSERVER" then ProcessSQLServer connection RestoreSessionDB exit sub end if if databasetype="MYSQL" or databasetype="MYSQL351" then ProcessMYSQLServer connection RestoreSessionDB exit sub end if 'VP-ASP 6.50 - add support for Access 2007 if databasetype="ACCESS2007" then ProcessAccess2007 connection RestoreSessionDB exit sub end if end sub Sub SaveSessionDb SetSess "Olddb",GetSess("db") SetSess "Olddblocation", GetSess("dblocation") end sub Sub RestoreSessionDB SetSess "db",GetSess("Olddb") SetSess "dblocation",GetSess("Olddblocation") end sub ' Sub OpenOrderDB (connection) dim dbtype dim OtherDB Dim dblocation If getconfig("xorderdb")="" then ShopOpenDatabase connection else Otherdb=getconfig("xorderdb") 'Dblocation=GetSess("dblocation") dblocation = xdblocation dbtype=ucase(xdatabasetype) OpenOtherDatabase connection,OtherDB,dblocation, dbtype end if end sub ' Sub OpenCustomerDB (connection) dim dbtype dim OtherDB Dim dblocation If getconfig("xCustomerdb")="" then ShopOpenDatabase connection else Otherdb=Getconfig("xCustomerDB") Dblocation=xdblocation dbtype=ucase(xdatabasetype) OpenOtherDatabase connection,OtherDB,dblocation, dbtype end if end sub ' Sub OpenAffiliateDB (connection) dim dbtype dim OtherDB Dim dblocation If getconfig("xaffiliateDB")="" then ShopOpenDatabase connection else Otherdb=getconfig("xaffiliateDB") Dblocation=xdblocation dbtype=ucase(xdatabasetype) OpenOtherDatabase connection,OtherDB,dblocation, dbtype end if end sub Sub EditOpenDatabase (connection, database, table) dim mytable, newdatabase mytable=ucase(table) if MyTable="CUSTOMERS" then ShopOpenOtherDB connection, getconfig("XCustomerdb") exit sub end if if MyTable="ORDERS" or Mytable="OITEMS" or Mytable="ORDERTRACKING" or Mytable="SHOPRMA" then ShopOpenOtherDB connection, getconfig("xOrderDb") exit sub end if if MyTable="MYCOMPANY" then ShopOpenOtherDB connection, getconfig("xOrderDb") exit sub end if if MyTable="AFFILIATES" then ShopOpenOtherDB connection, getconfig("xAffiliateDB") exit sub end if if MyTable="AFFILIATELOG" then ShopOpenOtherDB connection, getconfig("xAffiliateDB") exit sub end if if MyTable="SEARCHRESULTS" then ShopOpenOtherDB connection, getconfig("xSearchDb") exit sub end if if MyTable="PROJECTS" then ShopOpenOtherDB connection, getconfig("xprojectDb") exit sub end if if MyTable="PRODUCTS" or MyTable="CATEGORIES" or MyTable="PRODCATEGORIES" Or MyTable="PRODFEATURES" Or MyTable="QUANTITYDISCOUNTS" then ShopOpenOtherDB connection, getconfig("xproductdb") exit sub end if ' translate if MyTable="TRANSLATEPRODUCTS" or MyTable="TRANSLATECATEGORIES" or MyTable="TRANSLATEPRODFEATURES" then ShopOpenOtherDB connection, getconfig("xproductdb") exit sub end if If getconfig("xothertables")<>"" then FindOtherdatabase newdatabase,MyTable If newdatabase<>"" then ShopOpenOtherDB connection, newdatabase exit sub end if end if ShopOpenDatabase connection end sub ' Use to open other database ' Sub ShopOpenOtherDB (connection, database) dim mytable If database="" then ShopOpendatabase connection exit sub end if OpenOtherdatabase connection,database,xdblocation,xdatabasetype end sub Sub LocateCustomerLastOrder(Customerid) Dim rs dim myconn ' See if customer stored separately OpenOrderDb myconn sql = "select * from orders where ocustomerid=" & customerid & " order by orderid desc" Set rs = myconn.Execute(SQL) If Not rs.EOF Then strshipname=rs("oshipname") strshipaddress=rs("oshipaddress") strshiptown=rs("oshiptown") strshipzip=rs("oshipzip") strshipstate=rs("oshipstate") strshipcountry=rs("oshipcountry") strshipcompany=rs("oshipcompany") strshipmethodtype=rs("oshipmethodtype") strshipcost=rs("oshipcost") strshipaddress2=rs("oshipaddress2") 'VP-ASP 6.50 - cart cookie fix strcoupon= rs("coupon") strcoupondiscount=rs("coupondiscount") 'VP-ASP 6.50 - add flag to order to say customer has agreed to terms blnlicense = rs("otermsagreed") else strshipname="" strShipAddress="" strshipaddress2="" strShipTown="" strShipZip="" strShipState="" StrShipCountry="" strshipCompany="" strShipMethodType="" strShipCost="" 'VP-ASP 6.08 strcoupon= "" strcoupondiscount="" 'VP-ASP 6.50 - add flag to order to say customer has agreed to terms blnlicense = "" end if rs.close set rs=nothing ShopClosedatabase myconn end sub Sub CheckValidLogin ' everyone must login then make sure they have If getconfig("xlogonrequired")="Yes" then If GetSess("Login")="" then if lcase(getsess("CurrentURL")) <> "shoploginforce.asp" then responseredirect "shoploginforce.asp" end if end if end if If getconfig("xshopclosed")="Yes" then If Getsess("Login")="Force" then exit sub end if if getsess("shopadmin")="" then shoperror getlang("Langshopclosed") end if end if end sub ' Sub ConvertNumber (oamount,iamount) dim whole,comma, length dim innumber dim commapos oamount=iamount if getconfig("xlcid")="" then exit sub oamount=csng(iamount) exit sub ' old style follows innumber =formatnumber(iamount,2) length=len(innumber) commapos=length-2 comma=mid(innumber,commapos,1) if comma="." then exit sub whole="" If length > 3 then whole=mid(innumber, 1, length-3) whole=replace (whole,".", "") end if whole=whole & "." & right(innumber,2) oamount=whole end sub Sub PerformNumberConversion dim amount ConvertNumber amount,GetSess("OrderTotal") SetSess "Ordertotal", amount If GetSess("smprice")<> "" then ConvertNumber amount,GetSess("Smprice") SetSess "Smprice", amount end if If Getsess("Taxes") <> "" then ConvertNumber amount,GetSess("Taxes") SetSess "Taxes",amount end if If Getsess("Discount") <> "" then ConvertNumber amount,GetSess("Discount") SEtSess "Discount", amount end if If Getsess("Handling") <> "" then ConvertNumber amount,GetSess("Handling") SetSess "Handling", amount end if end sub Function DateDelimit (indate) dim datedelim, newdate datedelim="#" if (ucase(xdatabasetype)="SQLSERVER") or (getconfig("xmysql")="Yes") OR (instr(ucase(xdatabasetype), "MYSQL") > 0) then datedelim="'" end if newdate=DateNormalize(indate) 'newdate=indate dateDelimit = datedelim & newdate & datedelim end function ' Function DateNormalize(indate) Dim yyyy,mm,dd,newdate yyyy=datepart("yyyy",indate) mm= datepart("m",indate) If len(mm)=1 then mm="0" & mm end if dd=datepart("d",indate) if len(dd)=1 then dd="0" & dd end if 'VP-ASP 6.09 - format for SQL Server if (ucase(xdatabasetype)="SQLSERVER") then 'VP-ASP 6.50 - new config option to easily change date delimiter if getconfig("xsqlserverdatedelimiter") > "" then newdate=yyyy & getconfig("xsqlserverdatedelimiter") & mm & getconfig("xsqlserverdatedelimiter") & dd else newdate=yyyy & "" & mm & "" & dd end if else newdate=yyyy & "-" & mm & "-" & dd end if DateNormalize=newdate end Function Sub ParseRecord (record,words,wordcount,delimiter) Dim pos Dim recordl Dim bytex Dim temprec Dim maxwords Dim i maxwords = 10 temprec = record Dim maxentries pos = 1 wordcount = 0 ' make sure word array is null maxentries = UBound(words) For i = 0 To maxentries - 1 words(i) = "" Next recordl = Len(temprec) ' first eliminate leading blanks Do bytex = Mid(temprec, pos, 1) While bytex = " " And pos <= recordl pos = pos + 1 bytex = Mid(temprec, pos, 1) Wend ' copy word into word array While bytex <> delimiter And pos <= recordl words(wordcount) = words(wordcount) & bytex pos = pos + 1 bytex = Mid(temprec, pos, 1) Wend wordcount = wordcount + 1 pos = pos + 1 If wordcount > maxentries Then Exit Sub Loop Until pos > recordl End Sub Function ShopFormatCurrencyOLd (amount, decimalpoint) ' Handle 0 and garbage prices dim tamount tamount=amount If not isnumeric(tamount) then tamount=0 end if if tamount=0 then if getconfig("xprice0")<>"" then shopformatcurrency=Getconfig("xprice0") exit function end if end if If getconfig("XCurrencySymbol")="" then shopformatcurrency=formatCurrency (tamount, decimalpoint) else shopformatcurrency=getconfig("XCurrencySymbol") & " " & formatNumber (tamount, decimalpoint) end if end function ' Sub CustCheckAdmin (customerid) If GetSess("CustomerLogincid")="" Then responseredirect "shopcustadminlogin.asp" end if If Getsess("db")<>xdatabase then responseredirect "shopcustadminlogin.asp" end if customerid=getsess("CustomerloginCID") End Sub ' Sub ShopError (msg) setsess "shoperror", msg responseredirect "shoperror.asp" end sub Sub FindOtherDatabase (database, table) ' look in othertables and otherdatabases to find database match the table dim othertables(50),otherdatabase(50), j, dbcount, tablecount database="" If Getconfig("xotherdatabases")<>"" and getconfig("xothertables")<>"" then parserecord getconfig("xothertables"),othertables,tablecount,"," parserecord Getconfig("xotherdatabases"),otherdatabase,dbcount,"," for j=0 to tablecount-1 if table=ucase(Othertables(j)) then database=otherdatabase(j) end if next end if end sub Sub CancelOrderRecord (dbc, orderid) If getconfig("XKeepCanceledOrders")="Yes" then If getconfig("XkeepCanceledItems")<>"Yes" Then dbc.execute "delete from oitems where orderid = " & clng(orderid) end if dbc.execute "update orders set ocardtype='" & getlang("langcanceled") & "',canceled=1" & " where orderid = " & clng(orderid) else dbc.execute "delete from oitems where orderid = " & clng(orderid) dbc.execute "delete from orders where orderid = " & clng(orderid) end if end sub Sub OpenRecordSet (conn, irs, isql) Set irs=conn.execute(isql) end sub Sub CloseRecordSet (irs) irs.close set irs=nothing end sub Sub Adjustdate (newdate) dim hh, xtimedifference xtimedifference=getconfig("xtimedifference") hh=hour(time()) hh=clng(hh)+clng(xtimedifference) if hh>=24 then newdate=DateAdd("d",1,Date()) elseif hh<0 then newdate=DateAdd("d",-1,Date()) else newdate=date() end if ' june 6 newdate=cdate(newdate) 'newdate=formatdatetime(newdate,vbshortdate) end sub ' Sub AdjustTime (newtime) newtime=DateAdd("h",Getconfig("xtimedifference"),Time()) newtime=formatdatetime(newtime,vbshorttime) end sub '*************************************************************** ' If there are customer other fields, store in database '**************************************************************** Sub CustomerGetFieldsRS (rs) dim words,wordcount,i, customerfieldcount, cfieldname, fieldvalue redim words(getconfig("xCustomermaxotherfields")) on error resume next if getconfig("xCustomerOtherFields")="" then exit sub Parserecord getconfig("xcustomerOtherFields"), words, wordcount,"," CustomerFieldcount=wordcount for i = 0 to wordcount-1 cfieldname="c_" & words(i) fieldvalue=rs(words(i)) if isnull(fieldvalue) then fieldvalue="" end if setsess cfieldname,fieldvalue next end sub 'VP-ASP 6.50.2 - Clear any data in customerotherfields Sub ClearCustomerOtherFields dim words,wordcount,i, customerfieldcount, cfieldname redim words(getconfig("xCustomermaxotherfields")) on error resume next if getconfig("xCustomerOtherFields")="" then exit sub Parserecord getconfig("xcustomerOtherFields"), words, wordcount,"," CustomerFieldcount=wordcount for i = 0 to wordcount-1 cfieldname="c_" & words(i) setsess cfieldname,"" next end sub Sub CheckValidOrderNumber If xordernumber="" or xordernumber="0" then shoperror "Order number must be entered into shop$config.asp. For free version, it should be STARTER." end if end sub Sub ValidateQuantity (quantity) if not isnumeric(Quantity) then quantity=1 end if if quantity< 0 then quantity=-quantity end if If getconfig("xallowdecimalquantity")<>"Yes" then If quantity<1.0 then quantity=1 end if quantity=clng(quantity) if clng(quantity)>clng(getconfig("xproductquantitylimit")) then quantity=getconfig("xproductquantitylimit") end if else if csng(quantity)>csng(getconfig("xproductquantitylimit")) then quantity=getconfig("xproductquantitylimit") end if end if end sub Sub GetCustomerCookie if getconfig("xcookielogin")<>"Yes" then exit sub restorecustomerdetailscookie end sub Function Timedelimit(itime) dim delimiter delimiter="'" timedelimit =delimiter & itime & delimiter end function Sub CheckDatabaseOpen (conn) dim msg If conn.state=adStateOpen then If Getconfig("Init")<>"Yes" then SetConfig "Init","" setsess "init","" shopinit end if exit sub end if msg=getlang("LangDatabaseOpenError") & "
    " msg=msg& "
    " & getsess("Openerror") shoperror msg end sub Function ShopFormatNumber (amount, decimalpoint) shopformatnumber=formatNumber (amount, decimalpoint) end function '************************************************* ' VP-ASP 4.0 ' update customer information ' Update Order ' Customer Session variables ' Get product values '**************************************************** Sub UpdateContact() 'VP-ASP 6.50 - broadened defintion of IF statement to cover cases where xmysql hasn't been set if ucase(xdatabasetype) = "MYSQL" OR ucase(xdatabasetype) = "MYSQL351" OR getconfig("xMYSQL")="Yes" then MYSQLUPdatecontact exit sub end if Dim dbc Dim DoUpdate DoUpdate="" 'on error resume next OpenCustomerDb dbc If GetSess("CustomerId")<>"" and GetSess("Lastname") <> "" and getconfig("xAllowCustomerUpdates")="Yes" then Set objRS = Server.CreateObject("ADODB.Recordset") sql="select * from customers where contactid=" & getsess("customerid") sql=sql & " and lastname='" & replace(getsess("lastname"),"'","''") & "'" objRS.open SQL, dbc, adOpenKeyset, adLockOptimistic, adcmdText if not ObjRS.eof then DoUpdate="True" objRS.update else objRs.close set objRS=nothing end if end if If Doupdate="" then Set objRS = Server.CreateObject("ADODB.Recordset") objrs.open "customers", dbc, adopenkeyset, adlockoptimistic, adcmdtable objRS.AddNew 'VP-ASP 6.50 - add authorized flag to customer updatecustfield "authorized","" '6.5 end if objrs("firstname") = strfirstname objrs("lastname") = strlastname objrs("address") = straddress objrs("city") = strcity updatecustfield "state",strstate updatecustfield "postcode",strpostcode updatecustfield "country",strcountry updatecustfield "company",strcompany updatecustfield "phone",strphone updatecustfield "workphone",strworkphone updatecustfield "mobilephone",strmobilephone updatecustfield "fax",strfax updatecustfield "email",stremail updatecustfield "website",strwebsite updatecustfield "password",strpassword1 updatecustfield "maillist",blnmaillist updatecustfield "cookiequestion",blncookiequestion updatecustfield "vatnumber",strvatnumber ' 4.50 updatecustfield "userid",strcustuserid '5.00 updatecustfield "hearaboutus",strhearaboutus '5.00 updatecustfield "address2",straddress2 '5.10 if getconfig("xcustomerotherfields")<>"" then customerupdatefields objrs ' update additional end if objrs.update strcustomerid=cstr(objrs("contactid")) closerecordset objrs If getconfig("xsqlrecordid")="Yes" then strcustomerid=getlastrecord(dbc, "customers", "contactid") end if shopclosedatabase dbc updatecustomersessiondata setsess "customerid",strcustomerid end sub Sub UpdateCustField (fieldname,fieldvalue) on error resume next if fieldvalue="" then exit sub end if If getconfig("xdebug")="Yes" then Debugwrite fieldname & " " & fieldvalue & "
    " end if objRS(fieldname)=fieldvalue end Sub '***********Get Product Values Sub ProductGetValues(objRs, dbc) Dim Newprice 'on error resume next ' get products values from recordet already open ' Get values for a single product memcdescription = objrs("cdescription") 'memextdesc=objrs("extendeddesc") lngcatalogid = objrs("catalogid") strccode = objrs("ccode") strcname = objrs("cname") ' translate strcname=translatelanguage(dbc, "products", "cname","catalogid", lngCatalogId, strcname) memcdescription=translatelanguage(dbc, "products", "cdescription","catalogid", lngCatalogId, memcdescription) ' curcprice = objrs("cprice") strcimageurl = objrs("cimageurl") If isnull(strcimageurl) then strcimageurl="" 'VP-ASP 6.50 - added extra image fields strimageextra1 = objrs("extraimage1") If isnull(strimageextra1) then strimageextra1="" strimageextra2 = objrs("extraimage2") If isnull(strimageextra2) then strimageextra2="" strimageextra3 = objrs("extraimage3") If isnull(strimageextra3) then strimageextra3="" strimageextra4 = objrs("extraimage4") If isnull(strimageextra4) then strimageextra4="" strimageextra5 = objrs("extraimage5") If isnull(strimageextra5) then strimageextra5="" datcdateavailable = objrs("cdateavailable") lngcstock = objrs("cstock") lngccategory = objrs("ccategory") strcategory = objrs("category") strmfg = objrs("mfg") strdescurl=objrs("cdescurl") if isnull(objrs("features")) then strfeatures="" else strfeatures=objrs("features") end if strbuttonimage=objrs("buttonimage") strweight=objrs("weight") If isnull(strweight) then strweight="" strpother1=objrs("pother1") strpother2=objrs("pother2") strpother3=objrs("pother3") strpother4=objrs("pother4") strpother5=objrs("pother5") ' BYZ: 22-SEP-2011: Added extra field: strPother6=objrs("pother6") strPother7=objrs("pother7") strPother8=objrs("pother8") strPother9=objrs("pother9") strPother10=objrs("pother10") strretailprice=objrs("retailprice") strspecialoffer=objrs("specialoffer") strallowusertext=objrs("allowusertext") strtemplate=objrs("template") strextendedimage=objrs("extendedimage") strtemplate = objrs("template") strselectlist = objrs("selectlist") strproductuserid=objrs("userid") strlevel3=objrs("level3") strlevel4=objrs("level4") strlevel5=objrs("level5") strminimumquantity=objrs("minimumquantity") if isnull(strminimumquantity) then strminimumquantity=0 end if strsupplierid=objrs("supplierid") if isnull(strsupplierid) then strsupplierid=0 end if strcrossselling=objrs("crossselling") strgroupfordiscount=objrs("groupfordiscount") strclanguage=objrs("clanguage") strdownload=objrs("orderdownload") strattachment=objrs("orderattachment") strproductmatch=objrs("productmatch") strcustomermatch=objrs("customermatch") strpoints=objrs("points") strpointstobuy=objrs("pointstobuy") strprice2=objrs("price2") strprice3=objrs("price3") if isnull(strgroupfordiscount) then strgroupfordiscount="" end if strmaximumquantity=objrs("maximumquantity") strfrontpage=objrs("frontpage") if isnull(strmaximumquantity) then strmaximumquantity="" end if strtaxfree=objrs("taxfree") strfreeshipping=objrs("freeshipping") If isnull(strfreeshipping) then strfreeshipping=0 If isnull(strtaxfree) then strtaxfree=0 dim dualpricefield ' allows dual price to come directly from product record strcdualprice="" dualpricefield=getconfig("xdualpricefield") if dualpricefield<>"" then strcdualprice=objrs(dualpricefield) If isnull(strcdualprice) then strcdualprice="" end if end if strinventoryproducts=objrs("inventoryproducts") if isnull(strinventoryproducts) then strinventoryproducts="" end if 'VP-ASP 6.50 - allow customers to upload images strCustomerImage=objrs("CustomerImage") ' newprice=curcprice curoriginalprice=curcprice shopcustomerprices objrs,lngcatalogid, lngccategory, curcprice, newprice, lngdiscount CurCPrice=NewPrice ProductFieldvalid=True end sub '*********************************************************' ' Takes customer details and stores them in local variables ' '****************************************************** Sub GetCustomerSessionData() if getsess("lastname")<> "" then strcustomerid = getsess("customerid") strfirstname = getsess("firstname") strlastname = getsess("lastname") straddress = getsess("address") strcity = getsess("city") strstate = getsess("state") strpostcode = getsess("postcode") strcountry = getsess("country") strcompany = getsess("company") strwebsite = getsess("website") strphone = getsess("phone") strworkphone = getsess("workphone") strmobilephone = getsess("mobilephone") strfax = getsess("fax") stremail = getsess("email") strshipname=getsess("shipname") strshipaddress=getsess("shipaddress") strshiptown=getsess("shiptown") strshipzip=getsess("shipzip") strshipstate=getsess("shipstate") strshipcountry=getsess("shipcountry") strshipcompany=getsess("shipcompany") strshipmethodtype=getsess("shipmethod") strshipcost=getsess("smprice") strshipcomment=getsess("shipcomment") strdiscount=getsess("custdiscount") strgiftcertificate=getsess("giftcertificate") blnmaillist=getsess("blnmaillist") blncookieQuestion=getsess("blncookiequestion") strcustomertype=getsess("customertype") strvatnumber=getsess("vatnumber") strhearaboutus=getsess("hearaboutus") strshipaddress2=getsess("shipaddress2") straddress2=getsess("address2") exit sub end if end sub '********************************************************* ' Takes local variables and stores them into session variables '************************************************************ ' Sub UpdateCustomerSessionData SetSess "Firstname", strFirstname SetSess "Lastname", strLastname SetSess "Address", strAddress SetSess "City", strCity SetSess "State", strState SetSess "PostCode", strPostCode SetSess "Country", strCountry SetSess "Company", strCompany SetSess "Website", strWebsite SetSess "Phone", strPhone SetSess "Workphone", strWorkphone SetSess "Mobilephone", strMobilephone SetSess "Fax", strFax SetSess "Email", strEmail SetSess "shipname", strshipname SetSess "ShipAddress", strShipaddress SetSess "ShipTown", strshiptown SetSess "ShipZip", strShipZip SetSess "ShipState", strShipstate SetSess "ShipCountry", strShipcountry SetSess "ShipCompany", strShipcompany SetSess "ShipMethodType", strshipmethod SetSess "ShipCost", strShipCost SetSess "smprice", strShipCost if strCustomerID <> "" AND NOT isnull(strCustomerID) then SetSess "CustomerID", strCustomerID end if SetSess "ShipComment", strshipcomment SetSess "Custdiscount", strdiscount SetSess "GiftCertificate",strgiftcertificate SetSess "BlnMailList",blnMailList SetSess "BlnCookieQuestion",blnCookieQuestion SetSess "Customertype",strcustomertype SetSess "vatnumber",strvatnumber SetSess "hearaboutus",strhearaboutus SetSess "ShipAddress2", strShipaddress2 SetSess "Address2", straddress2 'CDM-MA SetSess "Points",strpointsremaining SetSess "PointsTotal",strpointstotal If getconfig("xCookieLogin")="Yes" and blnCookieQuestion=True then SaveCustomerDetailsCookie end if 'VP-ASP 6.09 - this was deleting the current coupon from the session when a customer logs into their account ''VP-ASP 6.08 'SetSess "coupon", strcoupon 'SetSess "coupondiscount", strcoupondiscount if getsess("coupon") <> "" then 'do nothing else SetSess "coupon", strcoupon end if if getsess("coupondiscount") <> "" then 'do nothing else SetSess "coupondiscount", strcoupondiscount end if end sub '****************************************************** ' Locate customer from database' '***************************************************** Sub LocateCustomer (LastName, emailvalue, passwordvalue) Dim rs, temail dim myconn dim templastname dim whereok, productgroup if lastname<>"" then templastname=replace(lastname,"'","''") end if temail=emailvalue ' See if customer stored separately OpenCustomerDb myconn sql = "select * from customers where " whereok="" If lastname<>"" then sql=sql & whereok & " lastname='" & templastname & "'" whereok = " AND " end if if emailvalue<> "" then If getconfig("xcustomeruserid")<>"Yes" then SQL = SQL & whereok & " email='" & temail & "'" else SQL = SQL & whereok & " userid='" & temail & "'" end if end if If passwordvalue<>"" then SQL = SQL & " AND " & " password='" & passwordvalue & "'" end if 'debugwrite sql Set rs = myconn.Execute(SQL) If Not rs.EOF Then 'VP-ASP 6.50 - Customer authorization if getconfig("xcustomerrequiresauthorization") = "Yes" then if lcase(rs("authorized")) = "false" then serror = getlang("langauthdeclined") rs.close set rs=nothing ShopClosedatabase myconn exit sub elseif isnull(rs("authorized")) then serror = getlang("langauthnotdone") rs.close set rs=nothing ShopClosedatabase myconn exit sub end if end if strfirstname = rs("firstname") strlastname = rs("lastname") straddress = rs("address") strcity = rs("city") strstate = rs("state") strpostcode = rs("postcode") strphone = rs("phone") stremail = rs("email") strfax = rs("fax") if isnull(strfax) then strfax="" strwebsite=rs("website") if isnull(strwebsite) then strwebsite="" strmobilephone=rs("mobilephone") if isnull(strmobilephone) then strmobilephone="" strworkphone=rs("workphone") if isnull(strworkphone) then strworkphone="" strcountry = rs("country") if isnull(strcountry) then strcountry="" strcompany = rs("company") if isnull(strcompany) then strcompany="" lnglogincount=rs("logincount") strcustomerid=cstr(rs("contactid")) strdiscount=rs("discount") blnmaillist=rs("maillist") blncookiequestion=rs("cookiequestion") strvatnumber=rs("vatnumber") strhearaboutus=rs("hearaboutus") straddress2=rs("address2") ' 5.10 'CDM_MA Modification 153 - Rewards Index Setup strpointstotal=rs("pointstotal") strpointsremaining=rs("pointsremaining") ' 4.50 if isnull(strvatnumber) then strvatnumber="" If isnull(blncookiequestion) then blncookiequestion=True end if if getconfig("xCustomerOtherfields")<>"" then CustomerGetFieldsRS rs end if If Getconfig("xproductmatchcustomer")="Yes" then productgroup=rs("productgroup") if isnull(productgroup) then productgroup="" end if setsess "Customerproductgroup",productgroup end if ' march 19 modification dim customeridentifier customeridentifier=getconfig("xcustomerpriceidentifier") If customeridentifier="" then customeridentifier="contacttypeid" end if strcustomertype=rs(customeridentifier) if isnull(strcustomertype) then strcustomertype="" end if setsess "customertype",strcustomertype ' locatecustomerlastorder strcustomerid else strCustomerid="" end if rs.close set rs=nothing ShopClosedatabase myconn end sub '******************************************************** ' Reset customer session data '******************************************************** Sub ResetCustomerSessionData strFirstname = "" strLastname = "" strAddress = "" strCity = "" strState = "" strPostCode = "" strCountry = "" strCompany = "" strWebsite = "" strPhone = "" strWorkphone = "" strMobilephone = "" strFax = "" strEmail = "" strComments = "" strDiscount="" strCustomerid="" strvatnumber="" straddress2="" strshipaddress2="" UpdateCustomerSessionData If getconfig("xCustomerOtherFields")<>"" then ClearCustomerOtherFields 'VP-ASP 6.50.2 - clear data from customerotherfields SetSess "CustomerValues","" SetSess "customerfieldcount","" end if If getconfig("xShippingOtherFields")<>"" then SetSess "ShippingValues","" SetSess "Shippingfieldcount","" end if setsess "customertype","" setsess "shipmessage","" setsess "login","" setsess "customername", "" ''VP-ASP 6.08 Remove Cookie if neccessary If getconfig("XCookieLogin")="Yes" then response.cookies("CartLogin").expires=date()-1 end if 'VP-ASP 6.08 Reset firstname and lastname variables so they don't show up in "logged in as" setsess "firstname", "" setsess "lastname", "" 'VP-ASP 6.50.2 - clear group If Getconfig("xproductmatchcustomer")="Yes" then setsess "Customerproductgroup","" end if end sub '********************************************************** ' * add an order to the database '*********************************************************** ' ********* AD ORDER Everything is now available Sub ShopAddOrder 'VP-ASP 6.50 - broadened defintion of IF statement to cover cases where xmysql hasn't been set if ucase(xdatabasetype) = "MYSQL" OR ucase(xdatabasetype) = "MYSQL351" OR getconfig("xMYSQL")="Yes" then MYSQLAddOrder exit sub end if Dim arrCart, scartItem Dim dbc Dim oid, sqlo Dim i dim newdate, newtime dim ipaddress arrCart = GetSessA("CartArray") ' get shopping cart data scartItem = GetSess("CartCount") ShopopenOtherdb dbc, getconfig("xorderdb") Set rsorder = Server.CreateObject ("adodb.recordset") If GetSess("Orderid")<>"" then CancelOrderRecord dbc,getsess("orderid") SetSess "Orderid","" end if rsorder.Open "orders", dbc, adOpenKeyset, adLockPessimistic, adCmdTable GetCustomerSessionData ' make sure we have session into local Errors="" ' no errors If getconfig("xConvertEuropeanNumbers")="Yes" then PerformNumberConversion end if rsorder.AddNew rsorder("ocustomerid") = strCustomerid If getconfig("xTimeDifference")="" then rsorder("odate") = Date() 'VP-ASP 6.50.2 - also set time rsorder("otime") = time() else adjustdate newdate rsorder("odate") = newdate adjusttime newtime rsorder("otime") = newtime end if updatefield "orderamount", getsess("ordertotal") updatefield "olastname",strlastname updatefield "ofirstname",strfirstname updatefield "oemail",stremail updatefield "oaddress",straddress updatefield "ocity",strcity updatefield "opostcode",strpostcode updatefield "ostate",strstate updatefield "ophone", strphone if (lcase(left(trim(getsess("shipmethod")), 4)) = "
    ") OR (lcase(left(trim(getsess("shipmethod")), 1)) = "[") then updatefield "oshipmethodtype",getsess("shipmethodtype") & " " & getsess("shipmethod") else updatefield "oshipmethodtype",getsess("shipmethod") end if ' updatefield "oshipmethodtype",getsess("shipmethodtype") updatefield "oshipcost",getsess("smprice") updatefield "otax",getsess("taxes") ' 2.13 fix updatefield "opst",getsess("pst") '6.5 updatefield "ocountry",strcountry updatefield "ofax", strfax updatefield "ocompany", strcompany updatefield "ocomment",strshipcomment updatefield "oshipname", getsess("shipname") updatefield "oshipaddress",getsess("shipaddress") updatefield "oshiptown",getsess("shiptown") updatefield "oshipzip", getsess("shipzip") updatefield "oshipstate",getsess("shipstate") updatefield "oshipcountry",getsess("shipcountry") updatefield "oshipcompany", getsess("shipcompany") updatefield "odiscount", getsess("discount") updatefield "ohandling", getsess("handling") updatefield "oaffid", getsess("affid") updatefield "canceled", false updatefield "oerrors", errors 'write errors to database If getconfig("xdualprice")="Yes" then Updatefield "odualtotal",GetSess("dualtotal") Updatefield "odualshipping",GetSess("dualshipping") Updatefield "odualtaxes",GetSess("dualtaxes") Updatefield "odualpst",GetSess("dualpst") '6.50 Updatefield "odualdiscount",GetSess("dualdiscount") Updatefield "odualhandling",GetSess("dualhandling") end if updatefield "coupon", getsess("coupon") ' saved order info updatefield "coupondiscount", getsess("coupondiscount") ' saved order info updatefield "coupondiscountdual", getsess("coupondiscountdual") ' saved order info updatefield "giftcertificate",getsess("giftcertificate") updatefield "giftamountused",getsess("giftamountused") updatefield "giftamountuseddual",getsess("giftamountuseddual") ipaddress=request.servervariables("REMOTE_ADDR") updatefield "ipaddress",ipaddress updatefield "canceled",0 updatefield "hackeryesno",0 updatefield "oprocessed",0 updatefield "vatnumber",getsess("vatnumber") updatefield "oaddress2",getsess("address2") ' 5.50 updatefield "oshipaddress2",getsess("shipaddress2") ' 5.50 updatefield "deliverydate",getsess("deliverydate") '5.50 updatefield "deliverytime",getsess("deliverytime") '5.50 updatefield "producttotal", getsess("OrderProductTotal") ' 5.50 If Getconfig("xcustomerotherfieldsinorder")="Yes" then if getconfig("xcustomerotherfields")<>"" then customerupdatefields rsorder end if end if if getconfig("xshippingotherfields")<>"" then shippingupdatefields rsorder end if updatefield "shipmessage",Getsess("Shipmessage") updatefield "hearaboutus",Getsess("hearaboutus") 'VP-ASP 6.50 - add flag to order to say customer has agreed to terms updatefield "otermsagreed", getsess("Licenseagreement") 'VP-ASP 6.50 - add selected currency and exchange rate to order record updatefield "ocurrency", getsess("cid") updatefield "ocurrencyrate", getsess("Conversionvalue") rsorder.Update ' Fix for Concurrency oid = rsorder("orderid") ' some SQL servers dont return orderid properly rsorder.Close set rsorder=nothing If getconfig("xsqlrecordid")="Yes" then oid=getlastrecord(dbc, "orders", "orderid") end if SetSess "orderid",oid SetSess "oid", oid ' End Fix for concurrency ' add Items To Database Dim rsitem,productaddress Set rsitem = Server.CreateObject ("adodb.recordset") rsitem.Open "oitems", dbc, adOpenKeyset, adLockOptimistic , adcmdtable For i = 1 To scartItem rsitem.AddNew rsitem("orderid") = oid rsitem("catalogid") = arrcart(cproductid,i) rsitem("numitems") = arrcart(cquantity,i) rsitem("itemname") = arrcart(cproductname,i) 'VP-ASP 6.50 - allow customer to upload image to order rsitem("customerimage") = arrCart(cgraphicname1,i) If arrcart(cdualprice,i)="" then arrcart(cdualprice,i)=0 'VP-ASP 6.09 - Better handling for Euro numbers If getconfig("xConvertEuropeanNumbers")="Yes" then dim tmpunitprice,tmpdualprice convertnumber tmpunitprice,arrcart(cunitprice,i) convertnumber tmpdualprice,arrcart(cdualprice,i) rsitem("unitprice") = tmpunitprice rsitem("dualprice") = tmpdualprice else rsitem("unitprice") = arrcart(cunitprice,i) rsitem("dualprice") = arrcart(cdualprice,i) end if If arrcart(cProductfeatures,i)<>"" then rsitem("features") = arrcart(cProductfeatures,i) end if if isnumeric (arrcart(csupplierid,i)) then rsitem("supplierid") = arrCart(csupplierid,i) else rsitem("supplierid") = 0 end if if getconfig("XdeliveryAddress")="Yes" then ConvertDeliverytoString arrCart(cDelivery,i), ProductAddress If ProductAddress="" then ProductAddress=NULL end if rsitem("address")=ProductAddress end if rsitem.Update Next rsitem.Close set rsitem=nothing ShopCloseDatabase dbc End Sub ' Update order Field Sub UpdateField (field,myvalue) dim tlen,ttype, tvalue if myvalue="" then exit sub end if tvalue=myvalue tlen=rsorder(field).DefinedSize ttype=rsorder(field).type on error resume next if ttype=202 then if len(tvalue)>tlen then tvalue=left(tvalue,tlen) end if end if if getconfig("xdebug")="Yes" then debugwrite field & " " & myvalue & "
    " end if rsorder(field)=tvalue if err.Number> 0 then Errors=Errors & "Order data failed " & field & "=" & myvalue & "
    " SetSess "Oerrors", errors end if end sub '***************************************************** ' Paging navigation bar '***************************************************** sub PageNavBar(sql) dim scriptname,counterstart,pad,counterend,counter,ref,mysql mysql=sql SetSess "sqlquery",sql pad="" scriptname=request.servervariables("script_name") response.write PageNavTable & PageNavRow response.write PageNavColumn & PageNavFont if (mypage mod 10) = 0 then counterstart = mypage - 9 else counterstart = mypage - (mypage mod 10) + 1 end if counterend = counterstart + 9 if counterend > maxpages then counterend = maxpages if counterstart <> 1 then ref="" & getlang("LangFirst") & " : " Response.Write ref ref="" & getlang("langPrevious") & "  " Response.Write ref end if Response.Write "[" for counter=counterstart to counterend If counter>=10 then pad="" end if if cstr(counter) <> mypage then ref="" & pad & counter & "" else ref="" & pad & counter & "" end if response.write ref if counter <> counterend then response.write " " next Response.Write "]" if counterend <> maxpages then ref=" " & getlang("langNext") & "" ref=addwebsess(ref) ' Dec 8 fix Response.Write ref ref=" : " & getlang("langLast") & "" Response.Write ref end if response.write "
    " & PageNavFontEnd response.write PageNavTableEnd end sub ' '***************************************************** ' Paging navigation bar '***************************************************** sub PageNavBarNext(sql) dim scriptname,counterstart,pad,counterend,counter,ref,mysql dim nextpage, prevpage mysql=sql SetSess "sqlquery",sql pad="" scriptname=request.servervariables("script_name") response.write PageNavTable & PageNavRow response.write PageNavColumn & PageNavFont nextpage=mypage+1 prevpage=mypage-1 if prevpage>=1 then ref="" If getconfig("xbuttonpreviouspage")="" then ref=ref & getlang("langpreviouspage") else ref=ref & "" end if ref=ref & "  " Response.Write ref end if If Nextpage=< maxpages then ref="" If getconfig("xbuttonnextpage")="" then ref=ref & getlang("langnextpage") else ref=ref & "" end if ref=ref & "  " Response.Write ref end if response.write "
    " & PageNavFontEnd response.write PageNavTableEnd end sub '********************************************************************** ' Customer other fields either in order or customer record '********************************************************************** Sub CustomerUpdateFields (rs) dim words,wordcount,i, customerfieldcount, cfieldname, fieldvalue 'on error resume next if getconfig("xCustomerOtherFields")="" then exit sub redim words(Getconfig("xCustomermaxotherfields")) Parserecord getconfig("xcustomerOtherFields"), words, wordcount,"," for i = 0 to wordcount-1 cfieldname="c_" & words(i) fieldvalue=getsess(cfieldname) ' debugwrite words(i) & "=" & fieldvalue If fieldvalue<>"" then rs(words(i))=fieldvalue else rs(words(i))=NULL end if next end sub ' Function Shopdateformat (iDate, itype) Dim strDate Dim intTrim intTrim = 1 if len(itype) = 0 Then Shopdateformat = "" Else 'Enter recursive function to format date Select Case Left(itype,1) Case "d" if Mid(itype, 2, 1) = "d" Then strDate = weekdayname(weekday(iDate)) & " " & datepart("d",iDate) intTrim = 2 Else strDate = day(iDate) End If Case "m" if Mid(itype, 2, 1) = "m" Then strDate = monthname(month(iDate)) intTrim = 2 Else strDate = month(iDate) End If Case "y" if Mid(itype, 2, 3) = "yyy" Then strDate = year(iDate) intTrim = 4 ElseIf Mid(itype, 2, 1) = "y" Then strDate = Right(year(iDate), 2) intTrim = 2 Else strDate = Right(year(iDate), 2) End If Case " " strDate = " " Case "/" strDate = "/" Case "-" strDate = "-" Case "." strDate = "." Case Else Response.Write "
    ** Error in date format string **" End Select Shopdateformat = strDate & Shopdateformat(iDate, Right(itype, Len(itype) -intTrim)) End If End Function ' '****************************************************************** ' if there are customer shipping fields, update them into the recordset supplied '******************************************************************* Sub ShippingUpdateFields (rs) dim words,wordcount,i, shippingfieldcount, cfieldname, fieldvalue on error resume next if getconfig("xShippingOtherFields")="" then exit sub redim words(Getconfig("xCustomermaxotherfields")) Parserecord getconfig("xshippingOtherFields"), words, wordcount,"," for i = 0 to wordcount-1 cfieldname="s_" & words(i) fieldvalue=getsess(cfieldname) If fieldvalue<> "" then rs(words(i))=fieldvalue else rs(words(i))=NULL end if next end sub ' Sub Shopbutton (buttonimage, buttontext,buttonname) dim tempname tempname=buttonname if tempname="" then tempname="Action" end if If buttonimage="" then Response.Write("") else Response.Write("") end if end sub Sub ShopbuttonReset (buttonimage, buttontext,buttonname) dim tempname tempname=buttonname if tempname="" then tempname="Action" end if If buttonimage="" then Response.Write("") else Response.Write("") end if end sub '******************************************************************************* ' Input is a record set field. if it is null, then set to null '****************************************************************************** Function Getrsitem(fieldvalue) if isnull(fieldvalue) then getrsitem="" else geTRsitem=fieldvalue end if end function sub ShopCheckLicense end sub ' Sub ShopCheckInstall (conn) end sub ' By change the shoppage_header and trailer you can make shop look specific to your merchant Sub PrintPageHeader %> VP-ASP Shopping Cart 6.50
    <% end sub Sub PrintpageTrailer %>
    <% end sub ' sub shoplicenseError 'shoperror Getlang("Langlicensekeymsg") end sub '******************************************************************** ' See if hacker is trying to run something '***************************************************************** Sub CleanseMessage (msg, rc) dim badChars,i,lmsg, pos dim newChars badChars = array(";", "--", "@@","="," <%=name%> <% end sub Sub GetSortDirection select case UCASE(getsess("sortupdown")) case "ASC" response.write "DESC" case "DESC" response.write "ASC" case else response.write "ASC" end select End Sub Sub CheckAll(table,collectionName) %><% End Sub Sub GenerateDisplayHeader(headertext) %>
    <% generatetabs %> <%=getlang("langcommonsoftwarename")%> Control Panel
    <%writeHeaderMenu%>
    " end if else GenerateMinimumList strMinimumquantity, parsearray end if End sub Sub WriteHideQuantity (rc, parsearray) dim lngcstock,id,fieldtype,rc1, fieldname rc=0 if getconfig("xOutOfStockLimit")="" then exit sub fieldname="CSTOCK" FindInDatabase fieldname, lngcstock, fieldtype ,rc1, parsearray 'debugwrite "LNGCSTOCK=" & lngcstock & " " & rc1 if isnull(lngcstock) then exit sub If lngcstock="" then exit sub if clng(lngcstock)>clng(getconfig("xOutOfStocklImit")) then exit sub rc=4 end sub Sub Add_ProductNEW (ivalue, parsearray) Dim Id, fieldtype, rc dim fieldname fieldname="CATALOGID" id=0 FindInDatabase fieldname, id, fieldtype ,rc, parsearray If rc > 0 then WriteError "Field " & fieldname & " " & getlang("LangDatabaseFail") end if %> <% end sub Sub Add_ButtonNEW (ivalue, parsearray) dim mytext, mybutton, tableflag tableflag=parsearray(ptableflag) dim fieldvalue dim rc Dim Id, fieldname,fieldtype WriteNoStockMessage rc, parsearray if rc> 0 then exit sub fieldname="CATALOGID" FindInDatabase fieldname, Id, fieldtype ,rc,parsearray If rc > 0 then WriteError "Field " & fieldname & " " & getlang("LangDatabaseFail") else ID=0 end if mytext=getconfig("XButtonText") if mytext="" then mytext="Order" end if mybutton="" fieldname="BUTTONIMAGE" fieldvalue="" FindInDatabase fieldname, fieldvalue, fieldtype ,rc,parsearray if fieldvalue<>"" then mybutton= fieldvalue else if getconfig("xButtonImage") <>"" then mybutton=getconfig("xButtonImage") end if end if if tableflag<>"" then Response.write TemplateButtonColumn &vbcrlf ' Response.write TemplateButtonRow & TemplateButtonColumn end if If myButton="" then WriteForm "" else WriteForm "" end if If tableflag<>"" then response.write "" end if end sub Sub newAdd_ProductFeatures (ivalue, parsearray, Index,parseRS) '/*** Modification 'Radek Rekas 8th Nov 2005 'Modified to Call the Formatproductoptions2 subroutine 'to display second set of features marked with featureother1='X' '***/ dim rc, fieldtype, tableflag prodindex=index tableflag=parsearray(ptableflag) FindInDatabase "FEATURES", strfeatures, fieldtype, rc,parsearray If rc=0 then FindInDatabase "SELECTLIST", strselectlist, fieldtype, rc,parsearray FindInDatabase "CATALOGID", lngcatalogid, fieldtype, rc, parsearray If tableflag<>"" then WriteForm TemplateFeaturesRow & TemplateFeaturesColumn end if newFormatProductOptions if tableflag<>"" then Writeform TemplateFeaturesColumnEnd & "" end if end if end sub Sub handle_OOS (ivalue, parsearray) 'CDM add in for out of stock dim rc, fieldtype FindInDatabase "POTHER5", strpother5, fieldtype, rc,parsearray dim ttt ttt = strpother5 'If ttt="X" then Response.Write "
    " & strpother5 'end if End Sub 'CDM ADDITION 10-5-09 FOR UPGRADE Sub handle_stylepopupcontent(value, parsearray,parseRS) ShopCheckAdminPopUp "shopa_styles_csspopupmain.asp",5,"Format the display of the content page" End Sub Sub handle_stylepopupproduct(value, parsearray,parseRS) ShopCheckAdminPopUp "shopa_styles_csspopupmain.asp",6,"Format the display of the product page" End Sub 'CDM_MA Sub Handle_POINTQUALIFICATIONDISPLAY (value,parsearray, parseRS) dim pointvalue, fieldtype, myconn, pointsimage dim rsitems, isql, Pid Pid=cleanchars(request("id")) If isnumeric(Pid) = false then exit sub shopopendatabase myconn isql="select points, extraimage5 from products where catalogid=" & Pid Set rsitems=myconn.execute(Isql) pointvalue=rsitems("points") pointsimage=trim(rsitems("extraimage5")) If isnull(pointsimage) then pointsimage = "" End If rsitems.close shopclosedatabase myconn 'setsess "ma",pointsimage If pointvalue = "" then exit sub If isnull(pointvalue) then exit sub If csng(pointvalue) > csng(0) then If pointsimage = "" then response.write "
    Qualifies for Doro Reward Points
    " Else response.write "" End If End If End Sub sub GetStars(rating, image) dim strrating strrating = cstr(rating) select case strrating case "1" image = "vpasp_stars1.gif" case "2" image = "vpasp_stars2.gif" case "3" image = "vpasp_stars3.gif" case "4" image = "vpasp_stars4.gif" case "5" image = "vpasp_stars5.gif" case else image = "" end select '600 - moved images to images/misc folder if image > "" then image = "images/misc/" & image end if end sub Sub Handle_LimitedDESC (value, parsearray) dim rc, fieldtype, Ldesc, catalogidC FindInDatabase "CDESCRIPTION", Ldesc, fieldtype, rc,parsearray FindInDatabase "CATALOGID", catalogidC, fieldtype, rc,parsearray Ldesc = Left(Ldesc,100) dim posS, minus posS=InstrRev(LDesc," ") '3 Ldesc = Left(Ldesc,posS) Ldesc = Ldesc & "....Click To Read More." value = Ldesc End Sub Sub Handle_FacebookLike (value, parsearray, parseRS) dim rc, fieldtype, catalogidC FindInDatabase "CATALOGID", catalogidC, fieldtype, rc,parsearray %>
    <% End Sub %> <% 'CDM-MA 3/7/09 'Used to display keywords on shopdisplayproducts from products.keywords '*************************************************************************** Sub DisplayKeywords dim currenturl dim errortest dim convertcurrent convertcurrent=getsess("convertcurrentpage") currenturl=getsess("currenturl") If Instr(convertcurrent,currenturl)=0 then currenturl=convertcurrent End If select case currenturl case "shopexd.asp" errortest=cleanchars(request.querystring("id")) If isnull(errortest) then errortest="" End If If errortest <> "" then DisplayProductKeywords End If case "shopdisplayproducts.asp" errortest=cleanchars(request.querystring("id")) If (isnull(errortest) or errortest="") then errortest=getsess("cat_id") End If If isnull(errortest) then errortest="" End If If errortest <> "" then DisplayProductCatKeywords End If case "shopdisplaycategories.asp" errortest=cleanchars(request.querystring("id")) If isnull(errortest) then errortest="" End If If errortest <> "" then DisplayProductCatKeywords End If end select End Sub sub DisplayProductKeywords dim current, rs, keyworddbc, sql, catid, productid, KeywordList dim KArrayCount, x, KeywordArray 'productid=request.querystring("id") CDM SECURITY productid=cleanchars(request.querystring("id")) If isnumeric(productid)=false then exit sub shopopendatabaseP keyworddbc sql="Select keywords from products where catalogid='"&productid&"'" 'SQL= SQL & " AND products.productmatch='BOA'" set rs=keyworddbc.execute(sql) If rs.eof then exitsub End If If not rs.eof then 'Response.write "
    <% If (GetSess("Admintype")="SUPER") AND (getconfig("xshowstatistics") = "Yes") then %> <% end if %> <% if UserTableAccess(getsess("shopadmin"), "orders") then %> <% 'VP-ASP 6.08a else %> <% end if %>
    Logged In As:
    <% If (GetSess("Admintype")="SUPER") AND (getconfig("xshowstatistics") = "Yes") then %> <% if UserTableAccess(getsess("shopadmin"), "orders") then %> <% end if %> <% if UserTableAccess(getsess("shopadmin"), "ordertracking") then %> <% end if %> <% if UserTableAccess(getsess("shopadmin"), "gifts") then %> <% end if %> <% if UserTableAccess(getsess("shopadmin"), "reviews") then %> <% end if %> <% if UserTableAccess(getsess("shopadmin"), "shoprma") then %> <% end if %> <% if (UserTableAccess(getsess("shopadmin"), "products")) AND (getconfig("xstockcontrol") = "Yes") then %> <% end if %> <% end if %>
    <%=getsess("shopadmin")%>  
      last login:
    <%getlastlogin%>
     
     
      Unprocessed Orders: <%unprocessedorders%>
      Orders In Today: <%numberoforders%>
      Tracking Messages: <%trackingmessages%>
      Gift Certifcates: <%giftcertificates%>
      Product Reviews: <%productreviews%>
      RMA: <%showrmaheader%>
      Out Of Stock Products: <%outofstockproducts%>
     
    Shop Statistics:
    Today's Sales:
    <%GetTodaysTotal%>
    Month's Sales:
    <%GetMonthsTotal%>
    Year's Sales
    <%GetYearsTotal%>
    Customers:
    <%GetTotalCustomers%>
    Search In Orders:
    Short Cuts :
    <%'VP-ASP 6.50 - custom admin shortcuts per user%> <%showshortcuts%>
    Help:
     
    " end if end sub' Sub Add_Button (ivalue, parsearray) 'VP-ASP 6.50 - if xpriceloggedinonly set to yes and customer isnt logged in, they shouldn't be able to purchase if getconfig("xpriceloggedinonly") = "Yes" then if isNull(getsess("Login")) or getsess("Login") = "" then exit sub end if end if if getconfig("xproductcatalogonly") = "Yes" then exit sub end if dim mytext, mybutton, tableflag tableflag=parsearray(ptableflag) dim fieldvalue dim rc Dim Id, fieldname,fieldtype WriteNoStockMessage rc, parsearray if rc> 0 then Response.write OutofStockColumn & getlang("LangOutOfStock") & OutofStockColumnEnd exit sub end if fieldname="CATALOGID" FindInDatabase fieldname, Id, fieldtype ,rc,parsearray If rc > 0 then WriteError "Field " & fieldname & " " & getlang("LangDatabaseFail") else ID=0 end if 'mytext=getconfig("XButtonText") if mytext="" then mytext=getlang("langproductorder") end if if mytext="" then mytext="Order" end if mybutton="" fieldname="BUTTONIMAGE" fieldvalue="" FindInDatabase fieldname, fieldvalue, fieldtype ,rc,parsearray if fieldvalue<>"" then mybutton= fieldvalue else if getconfig("xButtonImage") <>"" then mybutton=getconfig("xButtonImage") end if end if if tableflag<>"" then Response.write TemplateButtonColumn ' Response.write TemplateButtonRow & TemplateButtonColumn end if If myButton="" then WriteForm "" else WriteForm "" end if If tableflag<>"" then response.write "" end if end sub ' Sub Add_Quantity (ivalue, parsearray) 'VP-ASP 6.50 - if xpriceloggedinonly set to yes and customer isnt logged in, they shouldn't be able to purchase if getconfig("xpriceloggedinonly") = "Yes" then if isNull(getsess("Login")) or getsess("Login") = "" then exit sub end if end if if getconfig("xproductcatalogonly") = "Yes" then exit sub end if dim strminimumquantity, rc, tableflag, fieldtype WriteNoStockMessage rc, parsearray if rc> 0 then exit sub tableflag=parsearray(ptableflag) FindInDatabase "MINIMUMQUANTITY", strminimumquantity ,fieldtype, rc,parsearray If strminimumquantity="" then strminimumquantity=0 end if If strMinimumquantity=0 then If tableflag<>"" then Response.write TemplateQuantityRow & TemplateQuantityColumn end if %> <% If tableflag<>"" then response.write TemplateQuantityColumnEnd ' response.write TemplateQuantityColumnEnd & "" end if else GenerateMinimumList strMinimumquantity, parsearray end if End sub ' Sub GetFieldValues (RS, fieldnames, fieldvalues, fieldtypes, fieldcount) Dim i dim fldname i=0 ' memo fields must be gotten first For each fldName in RS.Fields fieldnames(i) = ucase(fldname.name) fieldTypes(i) = fldname.type If Fieldtypes(i)="201" then fieldvalues(i)=RS(i) end if i=i+1 next fieldcount=i-1 for i=0 to fieldcount if fieldtypes(i)<>"201" then fieldvalues(i)=RS(i).value end if if isnull(fieldvalues(i)) then fieldvalues(i)="" end if 'Debugwrite fieldnames(i) & " " & fieldvalues(i) next End Sub Sub ParseRecord (record,words,wordcount,delimiter) Dim pos Dim recordl Dim bytex Dim temprec Dim maxwords Dim i maxwords = 10 temprec = record Dim maxentries pos = 1 wordcount = 0 ' make sure word array is null maxentries = UBound(words) For i = 0 To maxentries - 1 words(i) = "" Next recordl = Len(temprec) ' first eliminate leading blanks Do bytex = Mid(temprec, pos, 1) While bytex = " " And pos <= recordl pos = pos + 1 bytex = Mid(temprec, pos, 1) Wend ' copy word into word array While bytex <> delimiter And pos <= recordl words(wordcount) = words(wordcount) & bytex pos = pos + 1 bytex = Mid(temprec, pos, 1) Wend wordcount = wordcount + 1 pos = pos + 1 If wordcount > maxentries Then Exit Sub Loop Until pos > recordl End Sub ' Sub Add_ProductFeatures (ivalue, parsearray, Index,parseRS) dim rc, fieldtype, tableflag prodindex=index tableflag=parsearray(ptableflag) FindInDatabase "FEATURES", strfeatures, fieldtype, rc,parsearray If rc=0 then FindInDatabase "SELECTLIST", strselectlist, fieldtype, rc,parsearray FindInDatabase "CATALOGID", lngcatalogid, fieldtype, rc, parsearray If tableflag<>"" then WriteForm TemplateFeaturesRow & TemplateFeaturesColumn end if FormatProductOptions if tableflag<>"" then Writeform TemplateFeaturesColumnEnd & "" end if end if end sub Sub Handle_FormStart (value, parsearray, action) Dim Newaction 'VP-ASP 6.09 - added xmysite call 'newaction="shopaddtocart.asp" newaction=getconfig("xmysite") & "shopaddtocart.asp" If action<>"" then newaction=action end if %> <% end sub ' Sub Handle_FormEnd (ivalue, parsearray) addwebsessform WriteForm "" end sub Sub WriteForm (text) Response.write text end sub Sub Handle_Include (ivalue,parsearray) '****************************************************** '[filename INCLUDE] ' field=abc INCLUDE] ' abc is field in recordset '****************************************************** Dim NewRecord, ucfieldname, tokens Dim recordObj, FsObj dim rc Dim MyText dim readcount Dim Bypass, filename, pos, fieldtype, filetype dim values(10),valuecount readcount=0 tokens=parsearray(ptokens) filename=tokens(0) pos=instr(filename,"=") if pos>0 then Parserecord filename,values,valuecount,"=" ucfieldname=ucase(values(1)) if ucase(values(0))="FIELD" then FindInDatabase ucfieldname, filename, fieldtype ,rc,parsearray If isnull(filename) or filename="" then exit sub end if else filename=values(1) end if end if 'debugwrite "filename=" & filename ' Nov 3 fix dim savevalue savevalue=parsearray(Pdatainmemory) parsearray(Pdatainmemory)="No" OpenInputFile Filename, fsObj, RecordObj, rc If rc> 0 then parsearray(Pdatainmemory)=savevalue shopwriteError getlang("LangReadFail") & filename exit sub else GetFileType filename,filetype end if ReadARecord RecordObj, MyText, rc, parsearray Do while rc=0 If filetype="TXT" then ' Response.write Server.HTMLEncode(MyText) & "
    " ivalue=ivalue & Server.HTMLEncode(MyText) & "
    " else 'response.write mytext ivalue=ivalue & mytext end if readcount=readcount+1 ReadARecord RecordObj, MyText, rc, parsearray Loop CloseFile fsObj,RecordObj, rc, parsearray parsearray(Pdatainmemory)=savevalue end sub ' Sub GetFileType(filename, filetype) dim xtype filetype="TXT" xtype=ucase(right(filename,3)) Select case xtype case "TXT" filetype="TXT" case "HTM" filetype="HTM" case "TML" filetype="HTM" end select end sub Sub GenerateMinimumList (strminimumquantity,parsearray) Dim PArray(20),PArrayCount, tableflag If Getconfig("xproductminimumquantity")="Yes" Then If tableflag<>"" then Response.write TemplateQuantityRow & TemplateQuantityColumn end if Response.write "" If tableflag<>"" then response.write TemplateQuantityColumnEnd & "" end if exit sub end if dim minamount, amount, multiply tableflag=parsearray(ptableflag) minamount=strminimumquantity parraycount=getconfig("xproductminimumlist") if parraycount="" then parraycount=6 end if parraycount=clng(parraycount) for i = 1 to parraycount amount=i*minamount parray(i)=amount next dim i sSelect = "" If tableflag<>"" then Response.write TemplateQuantityRow & TemplateQuantityColumn end if Response.write sSelect If tableflag<>"" then response.write TemplateQuantityColumnEnd & "" end if end sub Function RemovehtmlFileio(itemname, CR) dim workrecord, firstchar, morefields, pos, endpos, length dim token workrecord=replace(itemname,"
    ",CR) '------------------------------------------ ' VP-ASP 6.50.4 Bugs Fix - 08 October 2008 '------------------------------------------ workrecord=replace(workrecord,"
    ",CR) workrecord=replace(workrecord,"
    ",CR) workrecord=replace(workrecord,"
    ",CR) workrecord=replace(workrecord,"
    ",CR) workrecord=replace(workrecord,"
    ",CR) 'If mailremovehtml<>"Yes" then ' Removehtml=workrecord ' exit function 'end if pos=1 morefields = True Do While morefields = True pos=1 pos = InStr(pos, workrecord, "<") If pos > 0 Then endpos = InStr(pos, workrecord, ">") If endpos=0 then morefields=false else length = endpos - pos + 1 token = Mid(workrecord, pos, length) workrecord=replace(workrecord,token,"") end if else morefields=false end if loop RemovehtmlFileio=workrecord end function '************************************************************ ' add cross seelling links. Formatting in shopproductsubs.asp ''************************************************************* Sub Handle_CrossSelling (ivalue, parsearray,parseRS) If getconfig("XCrossSelling")<>"Yes" then exit sub dim lngcstock, headercaption dim tempcatalogid, tempname dim strCrossProductIDs,strsql, rs, strmessage, strcdescurl,strurl dim fieldtype,rc FindInDatabase "CROSSSELLING", strcrossProductids, fieldtype, rc, parsearray If rc>0 then exit sub if strCrossProductids="" then exit sub strsql="select * from products where catalogid in (" & strcrossproductids & ")" strsql=strsql & " and hide=0" if getconfig("xstocklow")<>"" then lngcstock= clng(getconfig("xstocklow")) strsql = strsql & " and cstock> " & lngcstock end if 'VP-ASP 6.09 - only show product matching products if getconfig("xproductmatch")="Yes" then 'VP-ASP 6.50 - enhanced productmatching 'strsql=strsql & " and (productmatch='" & xproductmatch & "'" 'strsql=strsql & " or productmatch is null)" strsql=strsql & " and " GenerateProductmatchsqlsubs strsql ' in shopproductsubs end if 'VP-ASP 6.09 - only show customer matching products if getconfig("xproductmatchcustomer")="Yes" then if GetSess("CustomerProductGroup")<>"" then strsql=strsql & " and (customermatch like '%" & getsess("customerProductgroup") & "%'" strsql=strsql & " or customermatch is null)" else strsql=strsql & " and customermatch is null" end if end if Headercaption=getlang("LangCrossSellingMessage") FormatAssociatedProducts dbc, strsql, headercaption,"" end sub '*************************************************************************************** ' add logic to test sub products out of stock '************************************************************************************** Sub WriteNoStockMessage (rc, parsearray) dim lngcstock,id,fieldtype,rc1, fieldname rc=0 'debugwrite "inventoryoutofstock=" & inventoryoutofstock If Inventoryoutofstock=true then rc=4 exit sub end if if getconfig("xOutOfStockLimit")="" then exit sub fieldname="CSTOCK" FindInDatabase fieldname, lngcstock, fieldtype ,rc1, parsearray 'debugwrite "LNGCSTOCK=" & lngcstock & " " & rc1 if isnull(lngcstock) then exit sub If lngcstock="" then exit sub if clng(lngcstock)>clng(getconfig("xOutOfStocklImit")) then exit sub 'Response.write OutofStockColumn & getlang("LangOutOfStock") & OutofStockColumnEnd rc=4 end sub Sub ShopMergetemplate (dbtable, template, catalogid, idfield) dim tempdatabase, tmprs, rc EditOpenDatabase dbc, tempdatabase, dbtable 'on error resume next if isnumeric (catalogid) then Sql="select * from " & dbtable If idfield<>"" then sql=sql & " where " & idfield & "=" & catalogid end if else sql="select * from " & dbtable If idfield<>"" then sql=sql & " where " & idfield & "='" & catalogid & "'" end if end if Set tmpRS=dbc.execute(sql) If tmpRS.eof then If catalogid<>"" then Serror = SError & getlang("LangReadFail") & "-" & getlang("LangEditTableName") & "=" & dbtable else Serror = SError & getlang("LangReadFail") & " " & getlang("langedittablename") & "=" & dbtable end if end if If serror="" then ShopTemplateWrite template, tmpRS, rc end if CloseRecordset tmpRS Shopclosedatabase dbc end sub ' Function HandleCustomerPrice (iprice, parsearray,parseRS) dim discount, categoryid, ioprice, newprice dim catalogid 'VP-ASP 6.5 dim fieldtype, rc newprice=iprice FindInDatabase "CATALOGID", catalogid, fieldtype ,rc, parsearray FindInDatabase "CCATEGORY", categoryid, fieldtype ,rc, parsearray ShopCustomerPrices ParseRS, catalogid, categoryid, iprice, newprice,discount 'HandleCustomerprice=shopformatcurrency(newprice,getconfig("xdecimalpoint")) HandleCustomerprice=newprice end function Function HandlePriceSAving (iprice, parsearray,parseRS) dim discount, categoryid, ioprice, newprice dim strretailprice, saving dim fieldtype, rc newprice=iprice FindInDatabase "RETAILPRICE", strretailprice, fieldtype ,rc, parsearray If strretailprice="" then exit function If strretailprice=0 then exit function FindInDatabase "CATALOGID", catalogid, fieldtype ,rc, parsearray FindInDatabase "CCATEGORY", categoryid, fieldtype ,rc, parsearray ShopCustomerPrices ParseRS, catalogid, categoryid, iprice, newprice,discount saving=strretailprice-newprice 'HandlePriceSaving=shopformatcurrency(saving,getconfig("xdecimalpoint")) HandlePriceSaving=saving end function Sub Handle_OITEMSTEMPLATE (body, parsearray,parseRS) '******************************************************* ' Template format order items ' expects myconn to be open as open connection '******************************************************** dim filename, outarray(10), outcount, suffix, emailformat filename=Getconfig("xoitemstemplate") Dim Isql,orderid, rsitems Dim recordid Dim CR, itemname, i dim downloadlink recordid=parsearray(pidvalue) Suffix=right(filename,3) If ucase(suffix)<>"TXT" then ' oct 6 setsess "emailformat","HTML" else setsess "emailformat","TEXT" end if If ucase(Getsess("emailformat"))="HTML" then CR="" else CR = GetMailCR end if 'OpenOrderdb dbc isql="select * from oitems where orderid=" If Getsess("oid")<>"" then Orderid=GetSess("oid") else Orderid=recordid end if Body="" ISql=Isql & Orderid 'debugwrite isql Set rsitems=myconn.execute(Isql) If rsitems.eof then closerecordset rsitems exit sub end if do while not rsitems.eof ShopTemplateArray Filename, RSITEMS, Outarray, Outcount for i = 0 to outcount-1 itemname=outarray(i) If ucase(Getsess("emailformat"))<>"HTML" then Itemname=RemoveHtmlFileio(itemname, CR) end if Body = Body & CR & Itemname next If getconfig("xendoforderhyperlinkemail")="Yes" or getconfig("xdownloadsemail")="Yes" Then downloadlink=GetEmaildownloadLink(RSItems("catalogid")) If downloadlink <> "" then Body = Body & getlang("LangorderDownload") & ": " & downloadLink & CR End If end if rsitems.movenext loop closerecordset rsitems end sub Sub Handle_OitemTotal(value,parsearray,parseRS) dim quantity, unitprice, rc, fieldtype, price, total FindInDatabase "NUMITEMS", quantity, fieldtype ,rc, parsearray FindInDatabase "UNITPRICE", unitprice, fieldtype ,rc, parsearray Total=quantity*unitprice value=shopformatcurrency(total,getconfig("xdecimalpoint")) end sub Sub Handle_OitemDelivery(value,parsearray,parseRS) dim rc, fieldtype, price, total, itemname dim CR dim deliveryaddress, deliveryarray If ucase(Getsess("emailformat"))="HTML" then CR="
    " else CR = GetMailCR end if if getconfig("xdeliveryaddress")="Yes" then FindInDatabase "ADDRESS", deliveryaddress, fieldtype ,rc, parsearray If not isnull(Deliveryaddress) and Deliveryaddress<>"" then ConvertDeliveryToArray DeliveryArray, Deliveryaddress GetDeliveryName Itemname, DeliveryArray If ucase(Getsess("emailformat"))<>"HTML" then Itemname=RemoveHtmlFileio(itemname, CR) end if value=itemname end if end if end sub '**************************************************************** ' see if template is in database. If it is open the recordset ' put whole template into fsobj '****************************************************************** Sub OpenInputFiledb (filename, fsObj, RecordObj, rc) dim dbprefix, dbfilename, conn shopopendatabase conn dbprefix=left(filename,3) if lcase(dbprefix)="db=" then dbfilename=right(filename,len(filename)-3) else dbfilename=filename end if dim sql sql="select * from templates where templatename='" & dbfilename & "'" If getconfig("xdebug")="Yes" then debugwrite sql end if set recordobj=conn.execute(sql) If not recordobj.eof then rc=0 fsobj=recordobj("template") else rc=4 end if closerecordset recordobj shopclosedatabase conn recordobj="" If rc=0 then recordobj="db" end if end sub Sub ReadEntireFileDB (fsoobj, RecordObj, readcount, readarray,parsearray) dim data, delimiter, i delimiter="~" readcount=0 data=replace(fsoobj,vbcrlf,delimiter) parserecord data, readarray, readcount,delimiter 'debugwrite "Recordcount=" & readcount 'for i = 0 to readcount ' debugwrite readarray(i) 'next end sub '*********************************************************************** ' Record are already in memory in the parse arary '************************************************************************ Sub ReadARecordDB (RecordObj, record, rc,parsearray) dim data, currentrecord, recordcount currentrecord=parsearray(pdatacurrentrecord) recordcount=parsearray(pdatarecordcount) data=parsearray(pdata) If currentrecord=recordcount then rc=4 exit sub end if record=data(currentrecord) currentrecord=currentrecord+1 parsearray(pdatacurrentrecord)=currentrecord rc=0 end sub Sub CheckfileDB(filename,fieldname,rc) dim dbprefix dbprefix=left(filename,3) if lcase(dbprefix)="db=" then fieldname=right(filename,len(filename)-3) rc=0 else fieldname="" rc=4 end if end sub Sub Handle_RatingSummary (value, parsearray, parseRS) dim oaverage,image, count dim fieldtype, rc, lngcatalogid, fieldname If getconfig("xAllowRatingProducts")<>"Yes" then exit sub If getconfig("xAllowRatingSummary")<>"Yes" then exit sub fieldname="CATALOGID" FindInDatabase fieldname, lngcatalogid, fieldtype ,rc, parsearray FileioReviewaverage lngcatalogid, oaverage,image, count, dbc If image="" then response.write "

    " & getlang("langNoReviews") & "

    " exit sub end if response.write "

    " Response.write count & " " & getlang("langratingheader") & "
    " response.write "

    " end sub Sub FileioReviewAverage(catalogid, oaverage, image, outcount, dbc) dim rs, rsql, strrating, conn rsql=" SELECT catalogid, Avg(rating) AS avgofrating, count(catalogid) as countcatalogid from reviews where catalogid=" & catalogid & " AND authorized IS NOT NULL GROUP BY catalogid" If getconfig("xproductdb")<>"" then shopopendatabase conn set rs=conn.execute(rsql) else set rs=dbc.execute(rsql) end if if not rs.eof then oaverage=rs("avgofrating") oaverage=clng(oaverage) strrating=cstr(oaverage) outcount=rs("countcatalogid") Select case strrating Case "1" image="vpasp_stars1.gif" Case "2" image="vpasp_stars2.gif" Case "3" image="vpasp_stars3.gif" Case "4" image="vpasp_stars4.gif" Case "5" image="vpasp_stars5.gif" Case else image="" end select 'VP-ASP 600 - moved images to images/misc folder if image > "" then image = "images/misc/" & image end if else oaverage="" image="" end if rs.close set rs=nothing If getconfig("xproductdb")<>"" then shopclosedatabase conn end if end sub ' Function HandleFormatimage (fieldvalue) dim newvalue if fieldvalue="" then handleformatimage="" exit function end if newvalue="" handleformatimage=newvalue end function '************************************************************ ' add Inventory Products. Codse is in shopproductinventory '************************************************************* Sub Handle_Inventoryproducts (ivalue, parsearray,parseRS) If getconfig("xinventoryproducts")<>"Yes" then exit sub FormatInventoryproducts dbc, parseRS end sub '*************************************************************************** ' if there are associated products then display them ' instead of the order button '*************************************************************************** sub Checkinventoryproducts (ivalue,parsearray,parseRS, inventorycheck,inventorypricedisplay, quantitydisplay, inventoryoutofstock) dim catalogid, spdisplaytype inventorycheck=false quantitydisplay=true If getconfig("xinventoryproducts")<>"Yes" then exit sub dim strCrossProductIDs,strsql, rs dim fieldtype,rc FindInDatabase "INVENTORYPRODUCTS", strcrossProductids, fieldtype, rc, parsearray FindInDatabase "CATALOGID", catalogid, fieldtype, rc, parsearray FindInDatabase "SPDISPLAYTYPE", spdisplaytype, fieldtype, rc, parsearray InventoryProductYesNo dbc, ParseRs, catalogid, inventorycheck, Inventorypricedisplay, quantitydisplay, inventoryoutofstock end sub Sub Handle_INVOICEOITEMS (value,parsearray, parseRS) '******************************************************* ' Template format order items ' expects myconn to be open as open connection ' $H is one type header ' $T is one time trailer '******************************************************** dim filename, outarray(500), outcount, suffix, emailformat dim headerwritten dim body, record, outrec, prefix filename=Getconfig("xinvoiceoitemstemplate") filename="tmp_invoiceoitems.htm" headerwritten=false Dim Isql,orderid, rsitems Dim recordid Dim CR, itemname, i recordid=parsearray(pidvalue) isql="select * from oitems where orderid=" Orderid=recordid Body="" ISql=Isql & Orderid 'debugwrite isql Set rsitems=myconn.execute(Isql) If rsitems.eof then closerecordset rsitems exit sub end if do while not rsitems.eof ShopTemplateArray Filename, RSITEMS, Outarray, Outcount for i = 0 to outcount-1 record=outarray(i) outrec=Striprecord(record) prefix=ucase(left(record,2)) if prefix=";T" then outrec="" end if If headerwritten=true then if prefix=";H" then outrec="" end if end if If outrec<>"" then response.write outrec & vbcrlf end if next headerwritten=true rsitems.movenext loop closerecordset rsitems for i = 0 to outcount-1 record=outarray(i) outrec=striprecord(record) prefix=ucase(left(record,2)) if prefix=";T" then response.write outrec & vbcrlf end if next end sub '****************************************************************** ' Display quantity discounts '******************************************************************* Sub Handle_Quantitydiscounts(value,parsearray,parseRS) if getconfig("xquantityPrices")<>"Yes" then exit sub dim lookupsql, lookuprs, oldprice, newprice, iprice, discount, i dim quantitylowfield, quantityhighfield, quantitylow, quantityhigh, pricefield Dim Discountamount,DiscountPercent dim catalogid, categoryid, price, discountprice, discpercent dim fieldvalue dim quantitygroup, qdbc catalogid=parsers("catalogid") categoryid=ParseRs("ccategory") quantitygroup=ParseRs("groupfordiscount") lookupsql="select * from quantitydiscounts " lookupsql = lookupsql & " where catalogid=" & catalogid lookupsql = lookupsql & " or categoryid=" & categoryid If not isnull(quantitygroup) then lookupsql = lookupsql & " or groupfordiscount='" & quantitygroup & "'" end if 'debugwrite "lookupsql=" & lookupsql If getconfig("xproductdb")<>"" then shopopendatabase qdbc Set lookuprs=qdbc.execute(lookupsql) else Set lookuprs=dbc.execute(lookupsql) end if if lookuprs.eof then lookuprs.close set lookuprs=nothing If getconfig("xproductdb")<>"" then shopclosedatabase qdbc end if exit sub end if shopwriteheader getlang("LangProductDiscount") response.write ReportTableDef & ReportHeadRow Response.write ReportHeadColumn & getlang("LangProductQuantity") & ReportHeadColumnEnd Response.write ReportHeadColumn & getlang("LangProductPrice") & ReportHeadColumnEnd response.write ReportRowEnd newprice=Parsers("cprice") price=newprice ShopCustomerPrices ParseRS, catalogid, categoryid, iprice, newprice,discount for i = 1 to 5 If i=1 then quantitylowField= "minquantity" else quantitylowField= "quantity" & i-1 end if quantityhighfield="quantity" & i pricefield="discount" & i Quantitylow= lookuprs(quantitylowfield) quantityhigh=lookuprs(quantityhighfield) If isnull(quantityhigh) then exit for If quantityhigh=0 then exit for If I >1 Then quantitylow=quantitylow+1 end if fieldvalue= quantitylow & " to " & quantityhigh response.write reportdetailrow response.write ReportDetailColumn & fieldvalue & ReportDetailcolumnEnd discpercent=lookuprs(pricefield) If discpercent>=1 then discount=discpercent else discount=Price*discpercent end if 'debugwrite "discountpercent=" & discpercent DiscountPrice=Price-discount DiscountPrice=shopformatcurrency(Discountprice,getconfig("xdecimalpoint")) response.write ReportDetailColumn & discountprice & ReportDetailcolumnEnd response.write "" next response.write "
     
      <% end sub '************************************************************** ' adds quote or # depdending on database '************************************************************** Function datedelimitheader (indate) dim datedelim, newdate newdate=indate datedelim="" ' access does not like delimiyers around partial dates if ucase(xdatabasetype)="SQLSERVER" or getconfig("xmysql")="Yes" OR instr(ucase(xdatabasetype),"MYSQL") > 0 then datedelim="'" end if dateDelimitheader = datedelim & newdate & datedelim end function sub outofstockproducts dim sql dim myconn, headerrecs shopopendatabaseP myconn 'get number of out of stock products sql = "select count(catalogid) as outofstock from products where (cstock < 1) OR (cstock is null)" set headerrecs = myconn.execute(sql) if not headerrecs.eof then response.write headerrecs("outofstock") else response.write "0" end if closerecordset headerrecs shopclosedatabase myconn end sub Function Removehtmlheaders(itemname, CR) dim workrecord, firstchar, morefields, pos, endpos, length dim token workrecord=replace(itemname,"
    ",CR) pos=1 morefields = True Do While morefields = True pos=1 pos = InStr(pos, workrecord, "<") If pos > 0 Then endpos = InStr(pos, workrecord, ">") If endpos=0 then morefields=false else length = endpos - pos + 1 token = Mid(workrecord, pos, length) workrecord=replace(workrecord,token,"") end if else morefields=false end if loop workrecord = replace(workrecord, """", "'") Removehtmlheaders=workrecord end function 'VP-ASP 6.09 - dynamically include header file while allowing for ASP to be included in this file public dyninclude, include_vars, include_vars_count dim objfschk dim regFltr,regFltr2 set dyninclude = new cls_include set objfschk = server.createobject("scripting.filesystemobject") set regFltr = new regexp set regFltr2 = new regexp class cls_include private sub class_initialize() set include_vars = server.createobject("scripting.dictionary") include_vars_count = 0 end sub private sub class_deactivate() include_vars.removeall set include_vars = nothing set include = nothing end sub public default function dyninclude(byval str_path) err.clear dim str_source,init_path if str_path <> "" then if (instr(str_path,":") > 0) then init_path = str_path else init_path = server.mappath(str_path) end if str_source = readfile(str_path) if str_source <> "" then str_source = processincludes (str_source, init_path, 0) convert2code str_source formatcode str_source if str_source <> "" then ' if request.querystring("debug") = 1 then ' response.write str_source ' response.end ' else executeglobal str_source ' end if end if end if end if end function private sub convert2code(str_source) dim i, str_temp, arr_temp, int_len, basecount basecount = include_vars_count if str_source <> "" then if instr(str_source,"%" & ">") > instr(str_source,"<" & "%") then str_temp = replace(str_source,"<" & "%","%") str_temp = replace(str_temp,"%" & ">","") if left(str_temp,1) = "" then str_temp = right(str_temp,len(str_temp) - 1) if right(str_temp,1) = "" then str_temp = left(str_temp,len(str_temp) - 1) arr_temp = split(str_temp,"") int_len = ubound(arr_temp) if (int_len + 1) > 0 then for i = 0 to int_len str_temp = arr_temp(i) str_temp = replace(str_temp,vbcrlf & vbcrlf,vbcrlf) if left(str_temp,2) = vbcrlf then str_temp = right(str_temp,len(str_temp) - 2) if right(str_temp,2) = vbcrlf then str_temp = left(str_temp,len(str_temp) - 2) if left(str_temp,1) = "%" then str_temp = right(str_temp,len(str_temp) - 1) if left(str_temp,1) = "=" then str_temp = right(str_temp,len(str_temp) - 1) str_temp = "response.write " & str_temp end if else if str_temp <> "" then include_vars_count = include_vars_count + 1 include_vars.add include_vars_count, str_temp str_temp = "response.write include_vars.item(" & include_vars_count & ")" end if end if if right(str_temp,2) <> vbcrlf then str_temp = str_temp arr_temp(i) = str_temp next str_source = join(arr_temp,vbcrlf) end if else if str_source <> "" then 'VP-ASP 6.50.1 - if var already exists, delete it before reinstating it if include_vars.Exists("var") then include_vars.Remove("var") include_vars.add "var", str_source str_source = "response.write include_vars.item(""var"")" end if end if end if end sub private function processincludes(tmp_source, curdir, curdepth) dim int_start, str_path, str_mid, str_temp, localdir,str_method,newdir if (curdepth < 20) then ' Maximum allowable depth. Just in case we get two files including each other localdir = left(curdir, len(curdir)-len(objfschk.GetFileName(curdir))) tmp_source = replace(tmp_source,"")) do until int_start = 0 str_mid = lcase(getbetween(tmp_source,"")) if (str_mid <> "") then int_start = 1 if int_start > 0 then str_method = lcase(trim(getbetween(str_mid," ","="))) str_temp = lcase(getbetween(str_mid,chr(34),chr(34))) str_temp = trim(str_temp) if (str_method = "file") then newdir = objfschk.BuildPath(localdir,replace(str_temp,"/","\")) str_path = processincludes(readfile(newdir), newdir, curdepth+1) tmp_source = replace(tmp_source,"",str_path & vbcrlf) elseif (str_method = "virtual") then newdir = server.mappath(str_temp) str_path = processincludes(readfile(newdir), newdir) tmp_source = replace(tmp_source,"",str_path & vbcrlf) else tmp_source = replace(tmp_source,"","" & vbcrlf) end if end if int_start = instr(tmp_source," <% '***************************************************************************** ' takes a value and converts it based on current language value ' Session("language") ' language is null returns current value ' if langauge is the default language, it returns current value ' otherwiselookup in table based on table name ' Includes other administrative subroutines ' may 30, 2005 '****************************************************************************** Function translatelanguage(dbc, table, fieldname,idfield, idvalue, currentvalue) dim newvalue, language, sql, rs, dbtable,pdbc language=getsess("language") if idvalue="" then debugwrite "Translating field=" & fieldname & " idfield=" & idfield & " idvalue=" & idvalue & " currentvalue=" & currentvalue end if newvalue=currentvalue if getconfig("xtranslate")<>"Yes" then translatelanguage=newvalue exit function end if If language="" then translatelanguage=newvalue exit function end if If ucase(language)=ucase(getconfig("xlanguage")) then translatelanguage=newvalue exit function end if select case idfield case "contentid" dbtable= "translatecontent" shopopendatabase pdbc case "categoryid" dbtable = "translatecategories" shopopendatabaseP pdbc 'VP-ASP 6.50 - wasn't previously translating features case "id" dbtable = "translateprodfeatures" shopopendatabaseP pdbc case else dbtable = "translateproducts" shopopendatabaseP pdbc end select 'dbtable="translate" & table dbtable=lcase(dbtable) sql="Select * from " & dbtable & " where lang='" & language & "'" sql = sql & " and " & idfield & "=" & idvalue 'debugwrite sql set rs=pdbc.execute(sql) if not rs.eof then newvalue=rs(fieldname) if isnull(newvalue) then newvalue=currentvalue end if end if closerecordset rs shopclosedatabase pdbc translatelanguage=newvalue end function '************************************************************************************ ' Link to shopa_translatelist.asp if the product has been added ' and display current translations '************************************************************************************ Sub AddtranslateLinkMenu (dbc, which, dbtable) dim keyfield, scriptresponder, keytable, viewresponder dim transtable transtable="translate" & dbtable If which="" then exit sub if getconfig("xtranslate")<>"Yes" then exit sub response.write "
    " TranslateSetupTableSpecificvalues transtable, keyfield, scriptresponder, keytable, viewresponder dim headerText headerText = "" headertext = headertext & "
    " & getlang("LangLanguage") & "" headertext = headertext & "" & "
    " GenerateDisplayHeader headerText GenerateDisplayBodyHeader translateTabledisplay dbc, which, dbtable, keyfield, transtable GenerateDisplayBodyFooter end sub '****************************************************************************** ' for a specific record and specific table, generate a list of the translation '****************************************************************************** Sub TranslateTableDisplay (dbc, which, dbtable, keyfield, transtable) dim fieldnames(100), fieldcount, i, fieldname, sql, rs, captions(100) dim scriptresponder, keytable, viewresponder sql="Select * from " & transtable sql= sql & " where " & keyfield & "=" & which sql=sql & " order by lang, " & keyfield set rs=dbc.execute(sql) if rs.eof then closerecordset rs exit sub end if translateSetupTableSpecificvalues transtable, keyfield, scriptresponder, keytable, viewresponder translateSetupTableSpecificCaptions transtable, fieldnames, fieldcount, captions response.write ReportTabledef response.write ReportHeadRow for i = 0 to fieldcount-1 response.write ReportHeadColumn & captions(i) & ReportHeadColumnEnd next response.write ReportHeadColumn & " " & ReportHeadColumnEnd response.write ReportRowEnd do while not rs.eof TranslateDisplayRecorddetails rs, fieldnames, fieldcount, viewresponder, scriptresponder, keyfield, transtable rs.movenext loop closerecordset rs response.write ReportTableEnd end sub Sub TranslateDisplayrecordDetails (rs, fieldnames, fieldcount, viewresponder, scriptresponder, keyfield, transtable) dim i, id, idfield dim fieldvalue, fieldname, my_link, keyid response.write tablerow for i = 0 to fieldcount-1 id=rs(0) fieldname=fieldnames(i) fieldvalue=rs(fieldname) response.write "
    " & fieldvalue & ReportDetailColumnEnd next keyid=rs(keyfield) idfield="translateid" my_link=scriptresponder & "?table=" & transtable & "&which=" & id & "&idfield=" & idfield fieldvalue="" & getlang("langcommonEDit") & "" response.write "" & fieldvalue & ReportDetailColumnEnd response.write ReportRowEnd end sub '*************************************************************************** ' for translateproducts, translatecontent, translatecategories '*************************************************************************** sub TranslateSetupTableSpecificvalues (dbtable, keyfield, scriptresponder, keytable, viewresponder) select case lcase(dbtable) case "translateproducts" scriptresponder="shopa_edittranslateproducts.asp" keyfield="catalogid" viewresponder="shopa_addproduct.asp" keytable="products" case "translatecategories" scriptresponder="shopa_edittranslatecategories.asp" keyfield="categoryid" keytable="categories" viewresponder="shopa_addcategory.asp" case "translateprodfeatures" scriptresponder="shopa_edittranslateprodfeatures.asp" keyfield="id" keytable="prodfeatures" viewresponder="shopa_editprodfeatures.asp" case "translatecontent" scriptresponder="shopa_edittranslatecontent.asp" keyfield="contentid" keytable="content" viewresponder="shopa_editcontent.asp" end select end sub Sub translateSetupTableSpecificCaptions (transtable, fieldnames, fieldcount, captions) fieldcount=0 select case lcase(transtable) case "translateproducts" translateaddfield fieldnames, fieldcount, captions, "lang",Getlang("langadminlanguages") translateaddfield fieldnames, fieldcount, captions, "cname",Getlang("langproductname") translateaddfield fieldnames, fieldcount, captions, "cdescription",Getlang("langproductdescription") case "translatecategories" translateaddfield fieldnames, fieldcount, captions, "lang",Getlang("langadminlanguages") translateaddfield fieldnames, fieldcount, captions, "catdescription",Getlang("LangProductDescription") case "translateprodfeatures" translateaddfield fieldnames, fieldcount, captions, "lang",Getlang("langadminlanguages") translateaddfield fieldnames, fieldcount, captions, "featurecaption",getlang("langcommoncaption") translateaddfield fieldnames, fieldcount, captions, "featurename",Getlang("langcommonname") case "translatecontent" translateaddfield fieldnames, fieldcount, captions, "lang",Getlang("langadminlanguages") translateaddfield fieldnames, fieldcount, captions, "message",Getlang("langcommonname") end select end sub sub translateaddfield (fieldnames, fieldcount, captions, fieldname,caption) fieldnames(fieldcount)=fieldname captions(fieldcount)=caption fieldcount=fieldcount+1 end sub %> <% '*********************************************************************** ' VP-ASP 6.0 ' Nov 12, 2005 ' Dec 31, 2005 Changed field names to lower case '********************************************************************* Function ShopFormatCurrency (amount, decimalpoint) ' Handle 0 and garbage prices dim tamount tamount=amount if GetSess("Fullunitname")<>"" then tamount=Currencypriceconvert(tamount) end if If not isnumeric(tamount) then tamount=0 end if if tamount=0 then if getconfig("xprice0")<>"" then shopformatcurrency=Getconfig("xprice0") exit function end if end if if GetSess("Newcurrencysymbol")<>"" then shopformatcurrency=GetSess("Newcurrencysymbol") & formatNumber (tamount, decimalpoint) elseif getconfig("XCurrencySymbol") <> "" then shopformatcurrency=getconfig("XCurrencySymbol") & formatNumber (tamount, decimalpoint) else shopformatcurrency="$" & formatNumber (tamount, decimalpoint) end if end function '============================================= 'VP-ASP 600 formats dual currency '12/10/2005 '============================================= Function ShopFormatDualCurrency (amount, decimalpoint) If getconfig("xdualcurrencysymbol")<>"" then shopformatdualcurrency=getconfig("xdualcurrencysymbol") & formatNumber (amount, decimalpoint) else shopformatdualcurrency=formatCurrency (amount, decimalpoint) end if end function '============================================= Sub RestoreCurrency on error resume next dim restored dim PricesIncVAT restored=getsess("Restored") if restored<>"" then exit sub 'Restore currency information 'If GetConfig("xMultiCurrency") = "Yes" Then If Request.Cookies("Currency") <> "" Then 'Response.write "CID value" & Request.Cookies("Currency")("CID") & "
    " Call SetCurrency(Request.Cookies("Currency")("CID"),Request.Cookies("Currency")("IncVAT")) Else If GetConfig("xtaxincludedinprice") = "Yes" Then PricesIncVAT=True Else PricesIncVAT=False End If Call SetCurrency(GetConfig("xcurrencybase"),PricesIncVAT) End If 'End If SetSess "restored","Yes" End Sub 'So if a cookie is found we take the id and if the users want VAT or not otherwise we get two config values, first is the standard xtaxincludedinprice to decide if we should add VAT and the other is a new one, XDefaultCurrency, a config value to use when no setting is found. 'Setting the currency is done by a function SetCurrency which I put in Shop$DB very straight forward, you can see it appears in both routines above. Sub SetCurrency(ByVal CurrencyID, ByVal VAT) Dim CurrName, CurrRate, CurrSymbol, DefaultVAT 'Get the currency data Call GetCurrData(CurrencyID, CurrName, CurrRate, CurrSymbol) 'If no rows are returned, get the xDefaultCurrency data If CurrName = "" Then Call GetCurrData(GetConfig("xcurrencybase"), CurrName, CurrRate, CurrSymbol) 'Set up the Session Variables SetSess "CID", CurrencyID SetSess "Fullunitname", CurrName SetSess "Conversionvalue", CurrRate SetSess "Newcurrencysymbol", CurrSymbol SetSess "IncVAT", CBool(VAT) 'Write a Cookie with the Currency ID & VAT Status. Response.cookies("Currency")("CID")=CurrencyID Response.cookies("Currency")("IncVAT")= VAT Response.Cookies("Currency").Expires = Date + 10 End Sub 'One last sub, GetCurrData which just pulls the currency from a new currency table. Sub GetCurrData(CurrID, CurrName, CurrRate, CurrSymbol) if CurrID="" then exit sub dim sql,rs, dbc ShopOpendatabase dbc sql="select * from currencyvalues where cid = '" & currid & "'" 'Response.write sql set rs=dbc.execute(sql) if not rs.eof then currname=rs("fullunitname") currrate=rs("conversionvalue") currsymbol=rs("currencysymbol") end if closerecordset rs Shopclosedatabase dbc End Sub Function Currencypriceconvert(price) 'VP-ASP 6.09 - fix if there is no conversion value, then don't modify the price if GetSess("Conversionvalue") = "" OR isnull(GetSess("Conversionvalue")) then Currencypriceconvert = price else Currencypriceconvert=price*GetSess("Conversionvalue") end if End Function Sub navigateshowcurrency if GetSess("Fullunitname")<>"" then Response.write "Chosen Currency
    " Response.write "" & GetSess("Fullunitname") & "
    " end if response.write "Change Currency" end sub Sub Navigateshowcurrencies setsess "returnurl", request.ServerVariables("scriptname") setsess "returnurl", right(getsess("returnurl"), instrrev(getsess("returnurl"), "/")) dim dbc, rs, sql, cid, checked shopopendatabase dbc %>
    " Closerecordset rs shopclosedatabase dbc end sub '*************************************************************** ' Used when return a currency with currrebcy symbol ' hk '*************************************************************** Function ShopFormatCurrencyNumber (amount, decimalpoint) ' Handle 0 and garbage prices dim tamount tamount=amount if GetSess("Fullunitname")<>"" then tamount=Currencypriceconvert(tamount) end if If not isnumeric(tamount) then tamount=0 end if if tamount=0 then if getconfig("xprice0")<>"" then shopformatcurrency=Getconfig("xprice0") exit function end if end if shopformatcurrencynumber=formatNumber (tamount, decimalpoint) end function %> <% sub showMiniSearch '**************************************************************** ' VP-ASP 6.50 ' Nov 11, 2005 Use languages variables. Fix error in captionstring is empty '**************************************************************** %>
    " class="submitbtn" />
    <%=getlang("langadvancedsearchAdvanced")%>
    <% end sub ' Advanced search table reorganised by Joseph (01/11/2006) ' table.std_table gives border to table and blue/grey background ' Second table has each element floated so that they will shift ' and balance when settings are removed sub showAdvancedSearch Dim othercount,i,stroOther Dim OtherTypes(50), othercaptions(50), othercaptioncount dim sortupdownnames(2),sortupdownvalues(2),sortupdowncount dim strsearchsort, strsearchsortupdown %>

    <%=getlang("LangSearch01")%>

    <%=getlang("langSearchAllWords")%>
    <%=getlang("langSearchExactPhrase")%>
    <%=getlang("langSearchAtLeast")%>
    <%=getlang("langSearchWithoutWords")%>
    <% makeFieldChooser %>
    <%=getlang("langitemsperpage")%>

    <% If getconfig("xSearchDisplayCategories")="Yes" then %>
    <% makeCategoryDropdown %>
    <% End If If getconfig("xSearchSortFields")<>"" then %>
    <% parserecord getconfig("xSearchSortFields"),OtherTypes,othercount,"," 'debugwrite getconfig("xSearchSortCaptions") If getconfig("xSearchSortCaptions")<>"" then parserecord getconfig("xSearchSortCaptions"),OtherCaptions,othercaptioncount,"," end if for i = 0 to othercount-1 If othercaptions(i)="" then Othercaptions(i)=othertypes(i) end if next Sortupdownnames(0)=getlang("langAscending") Sortupdownnames(1)=getlang("langDescending") Sortupdownvalues(0)="ASC" Sortupdownvalues(1)="DESC" SortUpDowncount=2 If othercount>0 then %> <%=getlang("langEditSort")%>
    <%GenerateSelectV OtherCaptions,OtherTypes,strsearchsort,"strsearchsort",OtherCount,"" %> <%GenerateSelectV Sortupdownnames,sortupdownvalues,strsearchsortupdown,"strsearchsortupdown",sortupdowncount,"" %> <% end if %>
    <% End If %> <% IF getconfig("xsearchbyprice")="Yes" THEN %>
    <%=getlang("langsearchlowprice")%>
    <%=getlang("langsearchhighprice")%>
    <% end if %>
    <% shopbutton Getconfig("xbuttonsearch"),getlang("langCommonSearch"),"action"%>
    <% end sub sub makeCategoryDropdown Dim rscat Dim dbc Dim SQL If getconfig("xSearchDisplayCategories")="Yes" then ShopOpenDatabaseP dbc SQL = "SELECT * from categories " sql= sql & " where highercategoryid=0 " if getconfig("xproductmatch")="Yes" then 'VP-ASP 6.50 - enhanced product matching sql=sql & " and " GenerateProductmatchsqlsubs sql ' in shopproductsubs 'sql=sql & " and productmatch='" & xproductmatch & "'" end if if getconfig("xproductmatchcustomer")="Yes" then if GetSess("CustomerProductGroup")<>"" then sql=sql & " and customermatch='" & getsess("customerProductgroup") & "'" end if end if If getconfig("xselectproductsbylanguage")="Yes" and getsess("language")<>"" then sql=sql & " and (catlanguage='" & getsess("language") & "'" sql=sql & " or catlanguage is null)" end if sql= sql & " order by " & getconfig("xsortcategories") Set rscat = dbc.Execute(SQL) %> <%=getlang("langcat01")%>
    <% end if end sub sub makeFieldChooser dim fieldString, fieldLength, captionString fieldString = getconfig("xsearchfields") captionString = getconfig("xsearchsortcaptions") if captionstring="" then captionstring=fieldstring end if dim fieldArray, captionArray fieldArray = Split(fieldString,",") captionArray = Split(captionString,",") %> <%=getlang("langcommonsearch")%> <%=getlang("langSearchFields")%> <% Dim i For i = 0 to Ubound(fieldArray) %> <% Next %>
    <%=captionArray(i)%>
    <% end sub %> <% '************************************************************************* ' Version 6.50 VP-ASP ' Customer based pricing ' after a price has been read from the database ' This routine is called by GetProduct to determine whether ' there is a specific price for acustomer ' Nov 9, 2006 HK allow customer price groups percentages ' using new configuration option xcustomerpricepercents '*************************************************************************** dim custdbc const customerpricetable="customerprices" Sub ShopCustomerPrices (objrs, catalogid, categoryid, ioprice, newprice,discount) '**************************************************************** ' obtain the correct price for the customer ' first lookup specific product ' if not found lookup specific category '***************************************************************** dim customerid, rc if getconfig("xcustomerPrices")<>"Yes" then exit sub if getconfig("Xcustomerpricefields")<>"" or getconfig("Xcustomerpricepercents")<>"" then CustomerPricesinRecord objrs, catalogid, categoryid, ioprice, newprice,discount exit sub end if discount=0 newprice=ioprice customerid=GetSess("Customerid") if customerid="" then exit sub end if ShopOpenDatabase custdbc LookupCustomerProduct catalogid, customerid, newprice,discount, rc if rc= 0 then exit sub end if LookupCustomerCategory categoryid, customerid, NewPrice,discount, rc if rc=0 then exit sub end if LookupCustomerOnly customerid, NewPrice,discount, rc if rc=0 then exit sub end if shopclosedatabase custdbc end sub ' Sub LookupCustomerProduct (catalogid, customerid, Price,discount, rc) dim lookupsql, lookuprs, oldprice, newprice Dim Discountamount,DiscountPercent lookupsql="select * from " & customerpricetable lookupsql = lookupsql & " where customerid=" & customerid lookupsql = lookupsql & " and catalogid=" & catalogid Set lookuprs=custdbc.execute(lookupsql) if lookuprs.eof then rc=4 lookuprs.close set lookuprs=nothing exit sub end if discountamount=lookuprs("discountamount") discountpercent=lookuprs("discountpercent") ApplyCustomerPrice Price, discountamount, discountPercent, discount lookuprs.close set lookuprs=nothing shopclosedatabase custdbc end sub Sub ApplyCustomerprice (price, amount, percent, discount) dim newprice If not isnull(amount) and amount>0 then Newprice=price-amount discount=newprice/price discount=1-discount discount=discount*100 price=newprice exit sub end if If not isnull(percent) then discount=percent if percent>1 then percent=percent/100 end if Newprice=price- (Price*percent) NewPrice=formatnumber(NewPrice,getconfig("xdecimalpoint")) price=Newprice end if 'debugwrite "newprice=" & newprice end sub Sub LookupCustomerCategory (categoryid, customerid, Price,discount, rc) Dim Discountamount,DiscountPercent dim lookupsql, lookuprs, discountper, newprice lookupsql="select * from " & customerpricetable lookupsql = lookupsql & " where customerid=" & customerid lookupsql = lookupsql & " and categoryid=" & categoryid set lookuprs=custdbc.execute(lookupsql) if lookuprs.eof then rc=4 lookuprs.close set lookuprs=nothing exit sub end if Discountamount=lookuprs("Discountamount") DiscountPercent=lookuprs("Discountpercent") if getconfig("xdebug")="Yes" then debugwrite "Price=" & price & " discountPercent=" & discountpercent end if ApplycustomerPrice Price, discountamount, discountPercent, discount lookuprs.close set lookuprs=nothing shopclosedatabase custdbc rc=0 end sub Sub LookupCustomerOnly (customerid, Price,discount, rc) Dim Discountamount,DiscountPercent dim lookupsql, lookuprs, discountper, newprice lookupsql="select * from " & customerpricetable lookupsql = lookupsql & " where customerid=" & customerid lookupsql = lookupsql & " and categoryid=0 and catalogid=0" Set lookuprs=custdbc.execute(lookupsql) if lookuprs.eof then rc=4 lookuprs.close set lookuprs=nothing exit sub end if Discountamount=lookuprs("Discountamount") DiscountPercent=lookuprs("Discountpercent") if getconfig("xdebug")="Yes" then debugwrite "Price=" & price & " discountPercent=" & discountpercent end if ApplycustomerPrice Price, discountamount, discountPercent, discount lookuprs.close set lookuprs=nothing shopclosedatabase custdbc rc=0 end sub '**************************************************************** ' contact id field determines which customer price field to use ' objrs is the current record in products table ' Uses xcustomerpricefields ' xcustomepricesindexes '***************************************************************** sub CustomerPricesinRecord (objrs, catalogid, categoryid, ioprice, newprice,discount) dim fields(50),fieldcount, customerpricefields, customerpricetypes dim types(50), typecount, customertype, ctype, pricefield dim donumerictest, i, xdebug dim customerpricepercents ' specific discount percentage per group dim usediscountgroup on error goto 0 xdebug=getconfig("xdebug") usediscountgroup=false if getsess("customertype")="" then exit sub customerpricefields=getconfig("Xcustomerpricefields") customerpricetypes=getconfig("Xcustomerpricetypes") customerpricepercents=getconfig("Xcustomerpricepercents") customertype=getsess("customertype") If isnumeric(customertype) then customertype=clng(customertype) donumerictest=true else donumerictest=false customertype=ucase(customertype) end if If xdebug="Yes" then debugwrite "Pricefields=" & customerpricefields debugwrite "Types=" & customerpricetypes debugwrite "Customer type=" & getsess("customertype") end if if customerpricetypes="" then exit sub ' If there are no customer price fields then see if there are ' group discounts and use them if customerpricefields="" then if customerpricepercents<>"" then usediscountgroup=true else exit sub end if end if parserecord customerpricefields, fields,fieldcount,"," parserecord customerpricetypes, types,typecount,"," for i = 0 to typecount-1 ctype=types(i) if donumerictest=true then if isnumeric(ctype) then ctype=clng(ctype) 'debugwrite "comparing2 ctype=" & ctype & " against " & customertype if customertype=ctype then pricefield=fields(i) If usediscountgroup=false then SetCustomerPricefield objrs, pricefield, newprice, i else SetCustomerDiscountGroup newprice, i end if exit sub else ' debugwrite "did not match " & ctype & " ct=" & customertype end if end if else ' debugwrite "comparing2 ctype=" & ctype & " against " & customertype if customertype=ucase(ctype) then If usediscountgroup=false then pricefield=fields(i) SetCustomerPricefield objrs, pricefield, newprice, i else SetCustomerDiscountGroup newprice, i end if exit sub end if end if next end sub Sub SetCustomerpricefield (objrs, fieldname, price, i) dim tprice tprice=objrs(fieldname) if isnull(tprice) then SetCustomerDiscountGroup price, i exit sub end if price=tprice end sub '************************************************************************** ' Using xcustomerpricepercents ' to apply a discount ' could be used when no customerprice fields are if price field is null ' If percent is greater tahn 1, customer prive can be greater than original price '************************************************************************* sub SetCustomerDiscountGroup (newprice, i) dim customerpricepercents, percents(50), percentcount dim percent dim oldprice dim discount customerpricepercents=getconfig("Xcustomerpricepercents") if customerpricepercents="" then exit sub parserecord customerpricepercents, percents, percentcount,"," percent=percents(i) ' get actual persent if percent="" then exit sub ' no discount if not isnumeric(percent) then exit sub ' not numeric oldprice=newprice If percent<1 then discount=oldprice*csng(percent) newprice=oldprice-discount else newprice=newprice*percent end if 'debugwrite "discount oldprice=" & oldprice & " percent=" & percent & " newprice=" & newprice end sub %> <% Sub CustomReviews shopopendatabase dbc AddReviewJava ProcessFirst CreateSQL DisplayReviewListings shopclosedatabase dbc End Sub sub ProcessFirst() CatalogId = Request("id") ' category id if CatalogId = "" then ShopError GetLang("LangNoCatalogId") end if if not isnumeric(CatalogId) then ShopError GetLang("LangNoCatalogId") end if SetSess "Reviewid", CatalogId end sub sub createsql() sql="select * from reviews where catalogid=" & catalogid If getconfig("xratingauthorize")="Yes" then sql=sql & " and authorized is not null" end if sql=sql & " order by id desc" Setsess "reviewsql",sql end sub sub DisplayReviewListings() If request("msg") <> "" then shopwriteerror getlang("LangReviewAuthorize") End If dim header dim recordcount dim words dim wordcount dim i dim msg dim rc dim template 'on error resume next 'response.write SQL 'ShopOpenRecordSet SQL, objRS, mypagesize, mypage Set objRS = Server.CreateObject("ADODB.Recordset") objRS.open SQL, dbc, adOpenDynamic, adLockOptimistic if objRS.eof then objRS.close set objRS = nothing response.write "Be The First To Write A Review" response.write "
    "& GetLang("langRatingNone") & "
    " exit sub end if dim oaverage,image, count FileioReviewAverageC catalogid, oaverage,image, count, dbc %>
    <% response.write "

    " Response.write count & " " & getlang("langratingheader") & "
    " response.write "

    " %>
    <% response.write "

    " response.write "Write A Review" response.write "

    " %>
    <% recordcount = 0 template = "tmp_productReviews.htm" maxrecs = 5 while not objRS.eof and recordcount < maxrecs 'ReviewFormatRowo template,rc ReviewFormatRow objRS.MoveNext recordcount = recordcount + 1 wend dim savesql savesql = GetSess("sqlquery") ' Dec 31 mod SetSess "sqlquery", savesql CloseRecordSet objrs end sub sub ReviewFormatRowO (template,rc) if trim(template) = "" then exit sub ShopTemplateWrite Template, objrs, rc end sub Sub ReviewFormatRow '***************************************** '************************************************************** dim comment, title,location,name,reviewdate,stars dim rating, starimage comment=objrs("comment") title=objrs("title") name=objrs("name") location=objrs("location") reviewdate=objrs("reviewdate") rating=objrs("rating") GetStars rating, starimage %>
    <%=reviewdate%>

    <%=name%>
    <%=location%>
    <% If starimage<>"" then response.write "
    " end if %>
    <%=title%>
    <%=comment%>


    <% end sub Sub AddReviewJava %> <% End Sub Sub FileioReviewAverageC(catalogid, oaverage, image, outcount, dbc) dim rs, rsql, strrating, conn rsql=" SELECT catalogid, Avg(rating) AS avgofrating, count(catalogid) as countcatalogid from reviews where catalogid=" & catalogid & " AND authorized IS NOT NULL GROUP BY catalogid" If getconfig("xproductdb")<>"" then shopopendatabase conn set rs=conn.execute(rsql) else set rs=dbc.execute(rsql) end if if not rs.eof then oaverage=rs("avgofrating") oaverage=clng(oaverage) strrating=cstr(oaverage) outcount=rs("countcatalogid") Select case strrating Case "1" image="vpasp_stars1.gif" Case "2" image="vpasp_stars2.gif" Case "3" image="vpasp_stars3.gif" Case "4" image="vpasp_stars4.gif" Case "5" image="vpasp_stars5.gif" Case else image="" end select 'VP-ASP 600 - moved images to images/misc folder if image > "" then image = "images/misc/" & image end if else oaverage="" image="" end if rs.close set rs=nothing If getconfig("xproductdb")<>"" then shopclosedatabase conn end if end sub %> <% const pfieldnames=1 const pfieldvalues=2 const pfieldtypes=3 const pfieldcount=4 const ptableflag=5 const ptemplatedisplay=6 const ptemplaterray=7 const ptokenformat=8 const pidfield=9 const pidvalue=10 const ptokens=11 const pdatacurrentrecord=12 const pdata=13 const pdatarecordcount=14 const pdatainmemory=15 const pparseattributes=16 '*********************************************************************** ' VP-ASP 6.50 Merge templates with database ' June 11, 2003 Fix readentirefile for emaillist, formatsaving, include ' oitemstemplate HTML ' Oct 6, 2003 add dualcustomerprice and dualsaving ' Dec 27, 2003 add formatimage ' Jan 24, 2004 Inventory products ' March 26, 2004 Quantity discounts, inventory products ' July 2 2004 minor changes ' Sept 21, 2004 support for dual price field, out of stock message duplicate ' Oct 6, html form in oitems template ' Oct 30, 2004 Fix link on crossseling images ' Dec 8, 2004 Bypass ODBC error on memcdescription ' April 22, 2005 add translate facility ' July 2, 2005 Inventory products ' July 6, 2005 Download links in emails ' VP-ASP 6.00 ' add translate facility, Inventory products, Download links in emails ' remove crossseling formatting, add alsobought ' July 7, 2005 ' August 9, 2005 add inventoryoutofstock ' Nov 9, 2006 HK Add Getlang translate of language ' Dec 4, 2006 Hk Enhanced productmatch sql ' Dec 6 , 2006 HK secure Downloadlinks '********************************************************************** ' Template handling Version 6.50 ' "ADD_OITEMS" ' "ADD_PAGEHEADER" ' "ADD_PAGETRAILER" ' "SPECIAL_ORDERBUTTON" ' "SPECIAL_CHECKBOX" ' "ADD_FORMSTART" ' "ADD_FORMEND" ' "ADD_PRODUCTFEATURES" ' "ADD_QUANTITY" ' "ADD_ORDERBUTTON" ' "ADD_CHECKBOX" ' "ADD_TABLE" ' "ADD_TABLEEND" ' "ADD_PRODUCT" ' "ADD_CROSSSELLING" ' "file=filename INCLUDE" ' "field=fieldname INCLUDE ' "ADD_OITEMSTEMPLATE" ' [DISPLAY_QUANTITYDISCOUNTS] ' [ADD_ALSOBOUGHT] ' [getlang langxxx] ' ' ' Does field substitution from database to a text template ' TemplateDisplay Yes = output to browser ' No put into array '********************************************************** '************************************************************** ' filename to be opened ' rc=4 if file cannot be found ' returns fsObj and RecordObj '************************************************************* Sub OpenInputFile (filename, fsObj, RecordObj, rc) on error resume next Dim whichfile, dbfile dbfile=left(filename,3) If lcase(dbfile)="db=" then OpenInputFiledb filename, fsObj, RecordObj, rc exit sub end if whichfile=server.mappath(filename) set fsObj = Server.CreateObject("Scripting.FileSystemObject") set RecordObj= fsObj.OpenTextFile(whichfile, 1, False) If err.number > 0 then rc=4 fsObj.close set fsObj=nothing else rc=0 ' debugwrite whichfile & " opened ok
    " end if End sub ' ' close a file Sub CloseFile (fsObj, RecordObj, rc, parsearray) If parsearray(pdatainmemory)="Yes" then exit sub set RecordObj = nothing set fsObj = nothing rc=0 end sub ' ' reads and entire file template into a memory array ' ' creates and array of converted records Sub ShopTemplateArray(Filename, RS, Outarray, Outcount) dim parsearray, fieldnames, fieldvalues, fieldtypes, fieldcount 'VP-ASP 6.50 - updated to 150 from 100 redim fieldnames(150) redim fieldvalues(150) redim fieldtypes(150) redim parsearray(Pparseattributes) Dim i Dim NewRecord Dim fs,ts Dim rc Dim Bypass Dim tempcount OpenInputFile Filename, fs, ts, rc If rc> 0 then shopwriteError getlang("LangReadFail") & filename exit sub end if GetFieldValues RS, fieldnames, fieldvalues, fieldtypes, fieldcount dim Temparray tempcount=ubound(outarray) redim temparray(tempcount) outcount=0 SetupParseArray Parsearray, filename, rs, fieldnames, fieldvalues, fieldtypes, fieldcount, fs, ts ReadEntireFile fs, ts, Tempcount, TempArray, parsearray CloseFile fs,ts, rc, parsearray for i = 0 to tempcount - 1 Substitute Temparray(i), NewRecord, Bypass, parsearray, rs If Bypass=False then OutArray(outcount)=NewRecord outcount=outcount+1 end if next end sub ' Sub SetupParseArray (Parsearray, filename, rs, fieldnames, fieldvalues, fieldtypes, fieldcount, fsoobj,recordobj) dim data, datacount, rc, dbfieldname redim parsearray(Pparseattributes) parsearray(pfieldnames)=fieldnames parsearray(pfieldvalues)=fieldvalues parsearray(pfieldtypes)=fieldtypes parsearray(pfieldcount)=fieldcount parsearray(ptableflag)="" parsearray(ptemplatedisplay)="No" parsearray(pidfield)=rs(0).name parsearray(pidvalue)=rs(0).value parsearray(pdatarecordcount)=0 parsearray(pdatainmemory)="" CheckFiledb filename,dbfieldname,rc If rc=0 then redim data(500) ReadEntireFileDB fsoobj, RecordObj, datacount,data,parsearray parsearray(pdata)=data parsearray(pdatarecordcount)=datacount parsearray(pdatacurrentrecord)=0 parsearray(pdatainmemory)="Yes" end if end sub '**************************************************************** ' writes each record to browser '*************************************************************** Sub ShopTemplateWrite(Filename, RS, orc) Dim i Dim NewRecord Dim recordObj, FsObj dim rc Dim MyText dim readcount Dim Bypass OpenInputFile Filename, fsObj, RecordObj, rc If rc> 0 then shopwriteError getlang("LangReadFail") & filename orc=4 exit sub end if dim parsearray, fieldnames, fieldvalues, fieldtypes, fieldcount redim fieldnames(150) redim fieldvalues(150) redim fieldtypes(150) redim parsearray(Pparseattributes) readcount=0 GetFieldValues RS, fieldnames, fieldvalues, fieldtypes, fieldcount 'For i = 0 to fieldcount ' debugwrite fieldnames(i) & "=" & fieldvalues(i) 'next SetupParseArray Parsearray, filename, rs, fieldnames, fieldvalues, fieldtypes, fieldcount, fsobj, recordobj Parsearray(pTemplateDisplay)="Yes" ReadARecord RecordObj, MyText, rc, parsearray Do while rc=0 Substitute mytext, NewRecord, Bypass, parsearray, rs If Bypass=False then Response.write NewRecord & vbcrlf end if 'debugwrite "old=" & Mytext & " new=" & NewRecord readcount=readcount+1 ReadARecord RecordObj, MyText, rc, parsearray ' Response.write Server.HTMLEncode(mytext) & "
    " Loop CloseFile fsObj,RecordObj, rc, parsearray orc=0 end sub ' Sub ReadEntireFile (fsoobj, RecordObj, readcount, readarray,parsearray) 'on error resume next dim rc dim mytext, data, i If parsearray(pdatainmemory)="Yes" Then data=parsearray(Pdata) for i = 0 to parsearray(pdatarecordcount)-1 readarray(i)=data(i) next readcount=parsearray(pdatarecordcount) exit sub end if rc=0 readcount=0 ReadARecord RecordObj, MyText, rc, parsearray 'Response.write Server.HTMLEncode(mytext) & "
    " 'Debugwrite myText Do while rc=0 readarray(readcount)=mytext readcount=readcount+1 ReadARecord RecordObj, MyText, rc, parsearray 'Response.write Server.HTMLEncode(mytext) & "
    " Loop end sub ' Sub ReadARecord (RecordObj, record, rc,parsearray) If parsearray(Pdatainmemory)="Yes" then ReadARecordDB RecordObj, record, rc,parsearray exit sub end if if RecordObj.AtEndofStream then rc=4 exit sub end if record = RecordObj.readline rc=0 End Sub Function Find_Replace(srchString, FndString, InsertString, strend ) Dim i, LastChar, Next_Pos Dim CurrentPos, LastPos Dim tempstring If strend > 0 Then LastChar = strend Else LastChar = Len(srchString) End If tempstring = srchString Next_Pos = 0 Next_Pos = InStr(Next_Pos + 1, tempstring, FndString) Do Until (Next_Pos = 0) Or (Next_Pos > LastChar) tempstring = Left(tempstring, Next_Pos - 1) & InsertString & Right(tempstring, (Len(tempstring) - Len(FndString) - (Next_Pos - 1))) LastChar = LastChar - Len(FndString) + Len(InsertString) Next_Pos = 0 Next_Pos = InStr(Next_Pos + 1, tempstring, FndString) Loop Find_Replace = tempstring End Function ' Sub Substitute (inrecord, workrecord, Bypass, parsearray, parseRS) ' values can be any field in the products table ' or special keywords ' [field] ' [ dim tokenformat dim tokens(5) dim tokencount Dim rc Dim morefields Dim dbindex Dim dbfieldname Dim dbvalue Dim dbvalue1 Dim token Dim Newrecord Dim fieldfound Dim pos Dim endpos Dim specchar Dim dbvalue2 Dim firstchar Dim length pos = 1 Bypass=False 'Response.write "converting " & Server.HTMLEncode(inrecord) & "
    " workrecord = inrecord morefields = True '------------------------------------------ ' VP-ASP 6.50.4 Bugs Fix - 08 October 2008 '------------------------------------------ fieldfound = "" ' used to determine if record is ouput if starts with a $ firstchar = Left(workrecord, 1) ' save first character Do While morefields = True 'VP-ASP 6.50 - Remove following section of code. Functionality has been moved elsewhere 'do while instr(workrecord, "~#") > 0 ' dim langpos, langendpos, langtoken, langlength ' langpos = 1 ' langpos = InStr(langpos, workrecord, "~#") ' If langpos > 0 Then ' langendpos = InStr(langpos, workrecord, "#~") ' If langendpos=0 then ' WriteError "Missing #~ on field starting at " & langpos ' else ' langlength = langendpos - langpos + 1 ' langtoken = Mid(workrecord, langpos, langlength) ' newrecord = replace(workrecord, langtoken, getlang(replace(replace(langtoken,"~#",""), "#~", ""))) ' end if ' end if ' ' workrecord = Newrecord 'loop pos = InStr(pos, workrecord, "[") If pos > 0 Then endpos = InStr(pos, workrecord, "]") If endpos=0 then WriteError "Missing ] on field starting at " & Pos morefields=false else length = endpos - pos + 1 tokenformat="" token = Mid(workrecord, pos, length) specchar = Mid(token, 2, 1) dbfieldname = Mid(token, 2, length - 2) parserecord dbfieldname, tokens, tokencount, " " if tokencount> 1 then dbfieldname=tokens(1) tokenformat=ucase(tokens(0)) ' formatcurrency, formatnumber 'debugwrite "tokenformat=" & tokenformat & " token=" & token end if 'VP-ASP 6.50 - translate getlang in templates If lcase(tokenformat)="getlang" then handle_getlang dbfieldname, dbvalue Newrecord = Find_Replace(workrecord, token, dbvalue, 0) workrecord = Newrecord else '------------------------------------------ ' VP-ASP 6.50.4 Bugs Fix - 08 October 2008 '------------------------------------------ Parsearray(ptokenformat)=tokenformat Parsearray(ptokens)=tokens FindField dbfieldname, dbvalue, rc, parsearray, parseRS If rc > 0 Then Exit Sub Newrecord = Find_Replace(workrecord, token, dbvalue, 0) If dbvalue <> "" Then if fieldfound <> False then fieldfound = True ' used to determine if record written end if else fieldfound = False End If workrecord = Newrecord 'VP-ASP 6.50 - translate getlang in templates end if end if Else morefields = False End If Loop ' at this point if record starts with a $ and no fields substituted, do not write it If firstchar = "$" Then If fieldfound = False Then workrecord="" Bypass=True Exit Sub Else length = Len(workrecord) - 1 Newrecord = Mid(workrecord, 2, length) workrecord = Newrecord bypass=False End If End If Bypass=False End Sub Sub WriteError (msg) shopwriteError msg end sub ' Sub FindField(fieldname, value, rc, parsearray, parsers) Dim i Dim temparea Dim ucfieldname Dim Fieldtype 'On error resume next ucfieldname = UCase(fieldname) rc = 0 ProcessKeyword ucfieldname, value, rc, parsearray, parseRS If rc = 0 Then Exit Sub rc = 0 FindInDatabase ucfieldname, temparea, fieldtype ,rc, parsearray If rc > 0 then WriteError "Field " & fieldname & " " & getlang("LangDatabaseFail") value="" exit sub end if If temparea="" then value="" exit sub end if ' debugwrite fieldname & " type=" & fieldtype & " " & temparea DoSpecialFormating temparea, Parsearray, parseRS value = temparea End Sub ' Sub FindInDatabase (fieldname, fieldvalue, fieldtype, rc, parsearray) dim i dim fieldcount, fieldvalues, fieldtypes, fieldnames fieldcount=parsearray(pfieldcount) fieldnames=parsearray(pfieldnames) fieldvalues=parsearray(pfieldvalues) fieldtypes=parsearray(pfieldtypes) 'Debugwrite "finding=" & fieldname & " fieldcount=" & fieldcount for i=0 to fieldcount ' debugwrite "field=" & fieldnames(i) & " value=" & fieldvalues(i) if fieldname=Fieldnames(i) then fieldvalue=fieldvalues(i) fieldtype=fieldtypes(i) 'VP-ASP 6.50 - show placeholder if no image is available if lcase(fieldname)="cimageurl" then if fieldvalue="" then fieldvalue=getconfig("xnoimage") end if end if if lcase(fieldname)="extendedimage" then if fieldvalue="" then fieldvalue=getconfig("xnoimage") end if end if ' Dec 8 fix for memcdescription if lcase(fieldname)="cdescription" then if memcdescription<>"" then fieldvalue=memcdescription end if end if rc=0 'debugwrite fieldname & " found =" & fieldvalue exit sub end if next rc=4 fieldvalue="" end sub ' Sub ProcessKeyword (keyword, value, rc, parsearray,parseRS) dim tokenformat tokenformat=parsearray(ptokenformat) rc=4 Select Case keyword Case "FACEBOOKLIKE" Handle_FacebookLike value, parsearray, parseRS rc = 0 Case "ADD_OITEMS" Handle_OITEMS value, parsearray,parseRS rc=0 Case "getstarrating" dim starimage GetStars parseRS("rating"), starimage response.write "
    " rc = 0 Case "CUSTOM_REVIEWS" CustomReviews rc=0 'VP-ASP 6.50 - call random product display from template Case "LIMITCDESC" Handle_LimitedDESC value, parsearray rc=0 Case "ADD_RANDOMPRODUCTS" Handle_RANDOMPRODUCTS value, parsearray rc=0 Case "ADD_PAGEHEADER" Handle_PAGEHEADER value, parsearray rc=0 Case "ADD_PAGEHEADER_EXD" Handle_PAGEHEADEREXD value, parsearray rc=0 Case "ADD_PAGETRAILER" Handle_PageTrailer value, parsearray rc=0 Case "SPECIAL_ORDERBUTTON" Handle_SpecialOrderButton value,parsearray,parseRS rc=0 Case "SPECIAL_CHECKBOX" Handle_SpecialCheckbox value,parsearray rc=0 Case "ADD_FORMSTART" 'VP-ASP 6.09 - added xmysite call 'Handle_FormStart "User",parsearray, getconfig("xmysite") & "shopaddtocart.asp" ' hkxxx Handle_FormStart "User",parsearray, "shopaddtocart.asp" rc=0 Case "ADD_FORMEND" Handle_FormEnd "User",parsearray rc=0 Case "ADD_PRODUCTFEATURES" Add_ProductFeatures "User",parsearray,"", parseRS rc=0 'Added CDM_MA For Upgrade Case "ADD_PRODUCTFEATURES2" newAdd_ProductFeatures "User",parsearray,"", parseRS rc=0 Case "ADD_QUANTITY" 'VP-ASP 6.5.1 - don't display this if xpriceloggedinonly = True and customer isn't logged in if (getconfig("xpriceloggedinonly") = "Yes") AND (getsess("Login") = "") then else 'Add_Quantity "User",parsearray Add_QuantityNEW "User",parsearray rc=0 end if Case "ADD_ORDERBUTTON" 'VP-ASP 6.5.1 - don't display this if xpriceloggedinonly = True and customer isn't logged in if (getconfig("xpriceloggedinonly") = "Yes") AND (getsess("Login") = "") then else ' Add_Button "User",parsearray UPGRADE CHANGE Add_ButtonNEW "User",parsearray rc=0 end if Case "ADD_CHECKBOX" 'VP-ASP 6.5.1 - don't display this if xpriceloggedinonly = True and customer isn't logged in if (getconfig("xpriceloggedinonly") = "Yes") AND (getsess("Login") = "") then else Add_Checkbox "User",parsearray rc=0 end if Case "ADD_TABLE" Add_Table "User",parsearray rc=0 Case "ADD_TABLEEND" Add_TableEnd "User",parsearray rc=0 Case "ADD_PRODUCT" 'Add_Product "User",parsearray 'UPGRADE CHANGE Add_ProductNEW "User",parsearray rc=0 Case "INCLUDE" Handle_Include value,parsearray rc=0 Case "ADD_CROSSSELLING" Handle_CROSSSELLING value,parsearray, parseRS rc=0 Case "SUB" Handle_Product ucase(tokenformat) rc=0 Case "ADD_OITEMSTEMPLATE" Handle_OITEMSTEMPLATE value, parsearray, parseRS rc=0 Case "ADD_OITEMTOTAL" Handle_OitemTotal value, parsearray, parseRS rc=0 Case "ADD_OITEMDELIVERY" Handle_OitemDelivery value, parsearray, parseRS rc=0 Case "ADD_RATINGSUMMARY" Handle_RatingSummary value, parsearray, parseRS rc=0 'VP-ASP 6.50 - add handler to show/hide review links Case "ADD_REVIEWLINKS" Handle_ReviewLinks value, parsearray, parseRS rc=0 'VP-ASP 6.50 - add handler to show/hide add to comparison link Case "ADD_COMPARELINKS" Handle_CompareLinks value, parsearray, parseRS rc=0 Case "ADD_INVENTORYPRODUCTS" Handle_INVENTORYPRODUCTS value,parsearray, parseRS rc=0 Case "INVOICE_OITEMS" Handle_INVOICEOITEMS value,parsearray, parseRS rc=0 Case "DISPLAY_QUANTITYDISCOUNTS" Handle_QUANTITYDISCOUNTS value,parsearray, parseRS rc=0 Case "ADD_WEBSESSLINK" Handle_ADDWEBSESSLINK value,parsearray, parseRS rc=0 Case "ADD_ALSOBOUGHT" Handle_ALSOBOUGHT value,parsearray, parseRS rc=0 Case "FORMATBREADCRUMB" Handle_Breadcrumb value,parsearray, parseRS rc=0 'VP-ASP 6.50 - show the number of sub-categories next to category listing Case "AddNumberSubCats" Handle_NumberSubCats value,parsearray, parseRS rc=0 'CDM-MA Add For New Store Upgrade Case "ADD_OOS" 'CDM Add for out of stock flag handle_OOS "User",parsearray rc=0 Case "ADD_STYLESHEETPOPUPCONTENT" handle_stylepopupcontent value,parsearray, parseRS rc=0 Case "ADD_STYLESHEETPOPUPPRODUCT" handle_stylepopupproduct value,parsearray, parseRS rc=0 Case "POINTQUALIFICATIONDISPLAY" Handle_POINTQUALIFICATIONDISPLAY value,parsearray, parseRS rc=0 end select end sub Sub DoSpecialFormating (value, parsearray, parseRS) dim tokenformat tokenformat=parsearray(ptokenformat) If tokenformat="" then exit sub dim strprice dim inventorycheck Select Case tokenformat Case "FORMATCURRENCY" if getconfig("xdisplayprices") <> "No" then if (getconfig("xpriceloggedinonly") = "Yes") AND (getsess("Login") = "") then value="" else value = shopformatcurrency(value,getconfig("xdecimalpoint")) end if else value = "" end if Case "DUALPRICE" if getconfig("xdisplayprices") <> "No" then if (getconfig("xpriceloggedinonly") = "Yes") AND (getsess("Login") = "") then value="" else GetDualPricevalue value, strPrice, parsearray value = formatnumber(strprice,getconfig("xdecimalpoint")) end if else value = "" end if Case "FORMATNUMBER" value = formatnumber(value,getconfig("xdecimalpoint")) Case "FORMATDATE" value = shopdateformat(value,getconfig("xdateformat")) Case "FORMATCUSTOMERPRICE" if getconfig("xdisplayprices") <> "No" then if (getconfig("xpriceloggedinonly") = "Yes") AND (getsess("Login") = "") then value="" else value = HandleCustomerPrice(value, parsearray, parseRS) value=shopformatcurrency(value,getconfig("xdecimalpoint")) end if else value = "" end if Case "URLENCODE" value = server.urlencode(value) Case "FORMATSAVING" if getconfig("xdisplayprices") <> "No" then if (getconfig("xpriceloggedinonly") = "Yes") AND (getsess("Login") = "") then value="" else value = HandlePriceSaving(value, parsearray,parseRS) If value<>"" then value=shopformatcurrency(value,getconfig("xdecimalpoint")) end if end if else value = "" end if Case "FORMATTIME" value = formatdatetime(value,vbshorttime) Case "DUALCUSTOMERPRICE" if getconfig("xdisplayprices") <> "No" then if (getconfig("xpriceloggedinonly") = "Yes") AND (getsess("Login") = "") then value="" else value = HandleCustomerPrice(value, parsearray, parseRS) ConvertCurrency value, strPrice value = formatnumber(strprice,getconfig("xdecimalpoint")) end if else value = "" end if Case "DUALSAVING" if getconfig("xdisplayprices") <> "No" then if (getconfig("xpriceloggedinonly") = "Yes") AND (getsess("Login") = "") then value="" else value = HandlePriceSaving(value, parsearray,parseRS) If value<>"" then ConvertCurrency value, strPrice value = formatnumber(strprice,getconfig("xdecimalpoint")) end if end if else value = "" end if Case "FORMATIMAGE" value = Handleformatimage(value) Case "FORMATOITEMTOTAL" value = Handleformatoitemtotal(value) case "FORMATCURRENCYCONVERSION" value=HandleFormatCurrencyConversion (value, parsearray,parseRS) Case "TRANSLATE" Handle_Translate value,parsearray, parseRS 'VP-ASP 6.09 - Remove HTML from meta and title tags Case "CLEANSEHTML" Handle_cleansehtml value,parsearray, parseRS 'VP-ASP 6.09 - Translate keywords in shopdisplayproducts.asp and shopexd.asp Case "GETLANG" Handle_getlang value,parsearray, parseRS 'CDM_MA Added for new store setup Case "HIDEPRICE2" value = HIDEPRICE2(value, parsearray, parseRS) ' Case "ADD_FORMSTART" ' Handle_FormStart "User",parsearray, "shopaddtocart.asp" ' rc=0 End Select end sub ' Sub Handle_OITEMS (body, parsearray,parseRS) '******************************************************* ' Template format order items ' expects myconn to be open as open connection '******************************************************** Dim Isql, deliveryaddress, deliveryarray dim orderid Dim rsitems Dim Dbc, recordid Dim CR, itemname dim downloadlink recordid=parsearray(pidvalue) If ucase(Getsess("emailformat"))="HTML" then CR="
    " else CR = GetMailCR end if 'OpenOrderdb dbc isql="select * from oitems where orderid=" If Getsess("oid")<>"" then Orderid=GetSess("oid") else Orderid=recordid end if Body="" ISql=Isql & Orderid 'debugwrite isql Set rsitems=myconn.execute(Isql) Do While Not RSItems.EOF itemname=rsitems("itemname") if getconfig("xdeliveryaddress")="Yes" then deliveryaddress=rsitems("address") If not isnull(Deliveryaddress) and Deliveryaddress<>"" then ConvertDeliveryToArray DeliveryArray, Deliveryaddress GetDeliveryName Itemname, DeliveryArray end if end if If ucase(Getsess("emailformat"))<>"HTML" then Itemname=RemoveHtmlFileio(itemname, CR) end if Body = Body & CR & Itemname & CR Body = Body & getlang("LangProductQuantity") & ": " & RSItems("numitems") & CR If getconfig("xDisplayPrices")<>"No" then Body = Body & getlang("LangProductPrice") & ": " & shopformatcurrency(RSItems("unitprice"),getconfig("xdecimalpoint")) & CR end if If getconfig("xendoforderhyperlinkemail")="Yes" or getconfig("xdownloadsemail")="Yes" Then downloadlink=GetEmaildownloadLink(RSItems("catalogid")) If downloadlink <> "" then Body = Body & getlang("LangorderDownload") & ": " & downloadLink & CR End If end if '====================================== RSItems.MoveNext Loop rsitems.close Set rsitems=nothing 'Shopclosedatabase dbc end sub ' ' ' Sub ShopReadEntireFile(Filename, Outarray, Outcount, parsearray) Dim i Dim NewRecord Dim fs,ts Dim rc outcount=0 OpenInputFile Filename, fs, ts, rc If rc> 0 then exit sub end if ReadEntireFile fs, ts, Outcount, OutArray, parsearray CloseFile fs,ts, rc, parsearray rc=0 end sub Sub Handle_PageHeader (value, parsearray) dim templatedisplay templatedisplay=parsearray(ptemplatedisplay) Value="" If TemplateDisplay="No" then exit sub ShopPageHeader end sub Sub Handle_PageHeaderExd (value, parsearray) dim templatedisplay templatedisplay=parsearray(ptemplatedisplay) Value="" If TemplateDisplay="No" then exit sub ShopPageHeaderExd end sub 'VP-ASP 6.50 - call random product display from template Sub Handle_RandomProducts (value, parsearray) dim templatedisplay templatedisplay=parsearray(ptemplatedisplay) Value="" If TemplateDisplay="No" then exit sub Displayrandomproducts end sub Sub Handle_PageTrailer (value, parsearray) dim templatedisplay templatedisplay=parsearray(ptemplatedisplay) Value="" If TemplateDisplay="No" then exit sub ShopPageTrailer end sub '************************************************************ ' add button to allow people to order but do not put this out if using ' Inventory products ' When using inventory products do not put out order button '************************************************************ Sub Handle_SpecialOrderButton (ivalue,parsearray,parseRS) dim rc, inventorycheck, pricedisplay, quantitydisplay Checkinventoryproducts ivalue,parsearray,parseRS, inventorycheck, pricedisplay, quantitydisplay, inventoryoutofstock 'VP-ASP 6.50 - commented out so that you can have an extended display for table layout 'If inventorycheck=true then ' If pricedisplay=false then ' exit sub ' end if 'end if 'VP-ASP 6.09 - added xmysite call 'Handle_FormStart ivalue,parsearray,"shopaddtocart.asp" Handle_FormStart ivalue,parsearray,getconfig("xmysite") & "shopaddtocart.asp" If inventorycheck=true then Handle_Inventoryproducts ivalue, parsearray,parseRS end if Add_Table "", parsearray prodindex="" Add_ProductFeatures "",parsearray,"",parseRS 'debugwrite "inventorycheck=" & inventorycheck & " pricedisplay=" & pricedisplay & "quantitydisplay=" & quantitydisplay If inventorycheck=false then Add_Quantity "",parsearray else If quantitydisplay=true then Add_Quantity "",parsearray end if end if 'VP-ASP 6.50 - if showing table layout don't show order button if inventorycheck = true then If pricedisplay = false then 'no button else Add_Button "",parsearray end if else Add_Button "",parsearray end if Add_Product "",parsearray Add_TableEnd "",parsearray Handle_FormEnd "",parsearray end sub Sub Add_Product (ivalue, parsearray) Dim Id, fieldtype, rc dim fieldname fieldname="CATALOGID" id=0 FindInDatabase fieldname, id, fieldtype ,rc, parsearray If rc > 0 then WriteError "Field " & fieldname & " " & getlang("LangDatabaseFail") end if %> <% end sub ' Sub Add_Table (ivalue, parsearray) dim tableflag WriteForm TemplateTable TableFlag="True" parsearray(ptableflag)=tableflag end sub ' Sub Add_TableEnd (ivalue, parsearray) dim tableflag WriteForm "
    " Tableflag="" parsearray(ptableflag)=tableflag End Sub ' Sub Handle_SpecialCheckBox (ivalue, parsearray) 'VP-ASP 6.09 - added xmysite call Handle_FormStart ivalue, getconfig("xmysite") & "shopproductselect.asp" 'Handle_FormStart ivalue,parsearray,"shopaddtocart.asp" Add_Table "",parsearray Add_ProductFeatures "",parsearray, "0" Add_Quantity "", parsearray Add_CheckBox "",parsearray Add_Button "",parsearray Add_TableEnd "",parsearray Add_ProductIndex "",parsearray Handle_FormEnd "",parsearray end sub Sub Add_ProductIndex (ivalue, parsearray) WriteForm "" end sub ' Sub Add_CheckBox (ivalue, parsearray) Dim Id, fieldname,fieldtype, rc fieldname="CATALOGID" FindInDatabase fieldname, Id, fieldtype ,rc,parsearray If rc > 0 then WriteError "Field " & fieldname & " " & getlang("LangDatabaseFail") end if If TableFlag<>"" then Response.write TemplateCheckboxRow & TemplateCheckboxColumn end if WriteForm "" if TableFlag<>"" then WriteForm TemplateCheckboxColumnEnd Response.write "
    " closerecordset lookuprs If getconfig("xproductdb")<>"" then shopclosedatabase qdbc end if end sub Function StripRecord(inrec) dim prefix, newrec prefix=ucase(left(inrec,2)) newrec=inrec if prefix=";H" or prefix=";T" then newrec=mid(inrec,3,len(inrec)-2) end if striprecord=newrec end function ' '************************************************************ ' adds &websess=xxxxxxxxxxxxxxxx '************************************************************ Sub Handle_ADDWEBSESSLINK( value,parsearray, parseRS) value=addwebsesslink end sub '**************************************************************************** ' Create hyperlink to currency converter '*************************************************************************** Function HandleFormatCurrencyConversion (total, parsearray,parseRS) dim value, cprice value="" If Getconfig("xproductconvertcurrency")="Yes" Then cprice=shopformatnumber(total,getconfig("xdecimalpoint")) ShopConvertCurrencyLink cprice, value end if HandleFormatCurrencyConversion=value end function Sub GetDualPricevalue( value, strcprice, parsearray) dim dualpricefield If Getconfig("xdualpricefield")="" then ConvertCurrency value, strcPrice exit sub end if dualpricefield=Getconfig("xdualpricefield") dim fieldtype,rc FindInDatabase ucase(dualpricefield), strcprice, fieldtype, rc, parsearray If isnumeric(strcprice) then exit sub strcprice=value end sub Sub Handle_translate (value,parsearray, ParseRs) '**************************************************************** ' [Translate cdescription products] ' [translate catdescription categories] '***************************************************************** dim tokens, fieldname, table, idfield, idvalue, currentvalue dim fieldvalue, fieldtype, rc, ucfieldname tokens=parsearray(ptokens) fieldvalue=value fieldname=tokens(1) table=tokens(2) if table = "" then table = getsess("table") end if if table="" then table="products" else table=lcase(table) end if if fieldname="" then value=" Unknown field to translate " exit sub end if idfield=parsearray(pidfield) idvalue=parsearray(pidvalue) ' get current value in database ucfieldname=ucase(fieldname) value=translatelanguage(dbc, table, fieldname,idfield, idvalue, fieldvalue) end sub 'Remove HTML from title and meta tags Sub Handle_cleansehtml (value,parsearray, ParseRs) dim cr If ucase(Getsess("emailformat"))="HTML" then CR="
    " else CR = GetMailCR end if value=RemoveHtmlFileio(value, CR) end sub '********************************************************************* 'VP-ASP 6.5 '[getlang xxx] ' takes xxx and looks it up in language table '********************************************************************* Sub Handle_getlang (langvalue, value) value=getlang(langvalue) 'debugwrite "translating " & langvalue & " value=" & value end Sub '************************************************************************** ' Get download links in email ' This was 6.08 version. in 6.50 go backl to emailist array '************************************************************************** Function GetEmaildownloadLinkold (catalogid) 'VP-ASP 6.08 fix for email link dim i, downloaddbc, downloadsql, downloadrs shopopendatabaseP downloaddbc downloadsql = "select " & getconfig("xendoforderhyperlinkfield") & " from products where catalogid = " & catalogid set downloadrs = downloaddbc.execute(downloadsql) if not downloadrs.eof then GetEmaildownloadLink=downloadrs(getconfig("xendoforderhyperlinkfield")) else GetEmaildownloadLink="" end if closerecordset downloadrs shopclosedatabase downloaddbc End Function '************************************************************************ ' display also bought values '************************************************************************ sub Handle_ALSOBOUGHT (value,parsearray, parseRS) if getconfig("xalsobought")<>"Yes" then exit sub dim fieldtype,rc, productname FindInDatabase "CATALOGID", catalogid, fieldtype, rc, parsearray FindInDatabase "CNAME", productname, fieldtype, rc, parsearray If rc>0 then exit sub FormatAlsoBought catalogid, productname end sub '===================================== '================================== 'VP-ASP 6.00 - Bread crumb code for extended desc '18/10/2005 '================================== Sub Handle_Breadcrumb (value, parsearray,parseRS) if Request("bc")<>"" then exit sub 'VP-ASP 6.50 - added config option to turn breadcrumb on/off if getconfig("xbreadcrumbs") <> "Yes" then exit sub Response.write session("breadcrumb") %>
    <% End Sub '================================== 'VP-ASP 6.50 - Show/Hide review links Sub Handle_ReviewLinks (value, parsearray, parseRS) dim fieldname, lngcatalogid,fieldtype,rc If getconfig("xallowratingproducts")<>"Yes" then exit sub fieldname="CATALOGID" FindInDatabase fieldname, lngcatalogid, fieldtype ,rc, parsearray If getconfig("xbuttonwritereview")>"" then response.write " " else response.write "" & getlang("langratingwrite") & " "'| " end if If getconfig("xbuttonreadreview")>"" then response.write "" else 'response.write "" & getlang("langratingread") & "" end if end sub 'VP-ASP 6.50 - Show/Hide compare link Sub Handle_CompareLinks (value, parsearray, parseRS) dim fieldname, lngcatalogid,fieldtype,rc If getconfig("xcompareproducts")<>"Yes" then exit sub fieldname="CATALOGID" FindInDatabase fieldname, lngcatalogid, fieldtype ,rc, parsearray response.write "" & getlang("langcompareadd") & " | " response.write "" & getlang("langcompareproducts") & "" end sub 'VP-ASP 6.50 - show the number of sub-categories next to category listing Sub Handle_NumberSubCats (value, parsearray,parseRS) dim scdbc, scrs shopopendatabaseP scdbc set scrs = scdbc.execute("select hassubcategory from categories where categoryid = " & value) if scrs.eof then response.write "(-)" else if scrs("hassubcategory") = "Yes" then ' set scrs = scdbc.execute("select count(categoryid) AS thecount from categories where highercategoryid = " & value) ' if not scrs.eof then ' response.write "(" & scrs("thecount") & ")" ' else ' response.write "(0)" ' end if else '6.50.1 - Add checks for hidden products, product matching, customer matching stock control to count dim scsql scsql = "select DISTINCT count(intcatalogid) AS thecount from prodcategories where intcategoryid = " & value 'VP-ASP 6.50.4 - added UCASE to line below if UCASE(xdatabasetype) = "MYSQL" OR UCASE(xdatabasetype) = "MYSQL351" OR getconfig("xMYSQL")="Yes" OR UCASE(xdatabasetype) = "SQLSERVER" then scsql = scsql & " AND intcatalogid IN (SELECT catalogid FROM products WHERE not hide = 1 " else scsql = scsql & " AND intcatalogid IN (SELECT catalogid FROM products WHERE not hide = TRUE " end if if getconfig("xstocklow")<>"" then lngcstock= clng(getconfig("xstocklow")) scsql = scsql & " and cstock> " & lngcstock end if if getconfig("xproductmatch")="Yes" then scsql=scsql & " and " GenerateProductmatchsqlsubs scsql ' in shopproductsubs end if if getconfig("xproductmatchcustomer")="Yes" then if GetSess("CustomerProductGroup")<>"" then scsql=scsql & " and (customermatch like '%" & getsess("customerProductgroup") & "%'" scsql=scsql & " or customermatch is null)" else scsql=scsql & " and customermatch is null" end if end if scsql = scsql & ")" set scrs = scdbc.execute(scsql) if not scrs.eof then response.write "(" & scrs("thecount") & ")" else response.write "(0)" end if end if end if closerecordset scrs shopclosedatabase scdbc End Sub '************************************************************************** ' VP-ASP 6.50 ' Get download links in email '************************************************************************** Function GetEmaildownloadLink(catalogid) dim i For i = 0 to arrayemaillinkscount if cint(arrayemaillinks(i,0))=cint(catalogid) then GetEmaildownloadLink=arrayemaillinks(i,1) exit function end if Next GetEmaildownloadLink="" End Function 'CDM-MA Additions for Store Upgrade Sub Handle_FormStart (value, parsearray, action) Dim Newaction newaction="shopaddtocart.asp" If action<>"" then newaction=action end if %>
    "> <% end sub Sub Add_QuantityNEW (ivalue, parsearray) dim strminimumquantity, rc, tableflag, fieldtype tableflag=parsearray(ptableflag) FindInDatabase "MINIMUMQUANTITY", strminimumquantity ,fieldtype, rc,parsearray '================================= 'eQuickCart Code - hides quantity box on extended page when stock is out 'Cam Flanigan '27/08/2003 '================================= WriteHideQuantity rc, parsearray if rc> 0 then exit sub '================================= If strminimumquantity="" then strminimumquantity=0 end if If strMinimumquantity=0 then If tableflag<>"" then Response.write TemplateQuantityRow & TemplateQuantityColumn end if %> <% If tableflag<>"" then response.write TemplateQuantityColumnEnd & vbcrlf ' response.write TemplateQuantityColumnEnd & "
    " 'Response.write "" KeywordList=rs("keywords") If isnull(KeywordList) then KeywordList="" End If If KeywordList = "" then Exit Sub End If response.write "
    " 'response.write "
    " Response.write "
    Keywords
    " Response.write "" response.write "" response.write "" Response.write "
     
    " response.write "
    " KeywordArray=Split(KeywordList,",") If ubound(KeywordArray) = -1 then Keyword=KeywordArray(-1) WriteProductKeywords Keyword End If If ubound(KeywordArray) <> -1 then KArrayCount=ubound(KeywordArray) 'KArrayCount=KArrayCount-1 x=0 For x=0 to KArrayCount dim Keyword Keyword=KeywordArray(x) WriteProductKeywords Keyword KArrayCount = KArrayCount + 1 next End If End If closerecordset rs response.write "
    " response.write "
    " shopclosedatabase keyworddbc end sub sub DisplayProductCatKeywords dim current, rs, keyworddbc, sql, catid, KeywordList dim KArrayCount, x, KeywordArray 'catid=request.querystring("id") CDM SECURITY catid=cleanchars(request.querystring("id")) If (isnull(catid) or catid="") then catid=getsess("cat_id") End If If isnumeric(catid)=false then exit sub End If shopopendatabaseP keyworddbc sql="Select categoryid, keywords from categories where categoryid="&catid&"" 'SQL= SQL & " AND categories.productmatch='BOA'" set rs=keyworddbc.execute(sql) If rs.eof then exit sub End If If not rs.eof then dim test test=rs("categoryid") KeywordList=rs("Keywords") If isnull(KeywordList) then KeywordList="" End If If KeywordList = "" then Exit Sub End If Response.write "" Response.write "" response.write "" response.write "" Response.write "
     
    " response.write "
    " KeywordArray=Split(KeywordList,",") If ubound(KeywordArray) = -1 then Keyword=KeywordArray(-1) WriteProductKeywords Keyword End If If ubound(KeywordArray) <> -1 then KArrayCount=ubound(KeywordArray) x=0 For x=0 to KArrayCount dim Keyword Keyword=KeywordArray(x) WriteProductKeywords Keyword KArrayCount = KArrayCount + 1 next End If End If closerecordset rs response.write "
    " response.write "
    " shopclosedatabase keyworddbc end sub Sub WriteProductKeywords (Keyword) Keyword=trim(Keyword) 'response.write "
    " 'response.write "
    " 'response.write "
    " response.write " " 'response.write "" 'response.write "
    " 'response.write "
    <% end sub Sub GenerateDisplayHeaderFlat %>
    <% end sub Sub GenerateDisplayBodyHeader%>

    <%End Sub Sub GetCurrency if GetSess("cid") = "" then SetSess "cid", getconfig("xcurrencybase") end if if GetSess("cid") <> "" then dim currconn 'VP-ASP 6.09 - fix for login force error which was stopping you logging into admin first time SetSess "Login","Force" shopopendatabase currconn If GetSess("Login")="Force" then SetSess "Login","" end if 'VP-ASP 6.08 - dimmed currencysql and use in place of old "sql". Using "sql" was causing problems as it is used elsewhere dim rs,currencysql currencysql="select * from currencyvalues where cid= '" & GetSess("cid") & "'" 'sql="select TOP 1 * from currencyvalues" set rs=currconn.execute(currencysql) if not rs.eof then SetSess "CID",rs("cid") setSess "Fullunitname",rs("fullunitname") SetSess "Conversionvalue",rs("conversionvalue") SetSess "Newcurrencysymbol",rs("currencysymbol") SetSess "flagimage",rs("theimage") else SetSess "CID","USD" setSess "Fullunitname","American Dollar" SetSess "Conversionvalue","1" SetSess "Newcurrencysymbol","US$" SetSess "flagimage","images/currency/usa.jpg" end if closerecordset rs shopclosedatabase currconn end if End Sub sub showCurrencyFlag ' IF there is no country selected IF getSess("CID") = "" THEN GetCurrency end if ' If the selected CID has a flag then show it IF getsess("flagimage") <> "" THEN %>" alt="<%=getsess("Fullunitname")%>" /><% 'VP-ASP 6.09 - if xlogonrequired is Yes, flag wasn't displaying else If getconfig("xlogonrequired")="Yes" and GetSess("Login")<>"" then GetCurrency IF getsess("flagimage") <> "" THEN %>" alt="<%=getsess("Fullunitname")%>" /><% end if end if end if 'VP-ASP 6.09 - end fix end sub Sub AddEditor (formname) if getconfig("xhtmleditor")= "Yes" then 'Check user's Browser if InStr(Request.ServerVariables("HTTP_USER_AGENT"),"MSIE") then Response.Write "" else Response.Write "" end if end if %> <% End sub Function addHTMLEditor (fieldname, textdata,formname)%> ><% ENd Function sub getoriginalcurrencysymbol (symbol) dim symboldbc, symbolsql, symbolrs shopopendatabase symboldbc symbolsql = "select currencysymbol from currencyvalues where conversionvalue = 1" set symbolrs = symboldbc.execute(symbolsql) if not symbolrs.eof then symbol = symbolrs("currencysymbol") end if closerecordset symbolrs shopclosedatabase symboldbc end sub '-------------------------------------- ' VP-ASP Security Patch - 17 April 2008 '-------------------------------------- function CleanChars(strWords) 'VP-ASP 6.5.1 - exit function if strwords is nothing if strwords = "" then exit function end if if isnull(strwords) then exit function end if 'VP-ASP 6.50 - replace '' with ' in case function has been run twice on same string strWords = replace(strWords, "''", "'") do while instr(strWords," ") > 0 strWords = replace(strWords, " ", " ") loop dim badChars,i dim newChars, decodeChars 'badChars = array("select ", "drop ", "--", "insert into", "delete from","update ","xp_","union ","char(","@@","|","0 then newchars="" cleanchars=newchars exit function end If if instr(1,lcase(decodeChars),lcase(badchars(i)),1)>0 then decodeChars="" cleanchars=decodeChars exit function end If next newchars=replace(newchars,"'","''") newchars=replace(newchars,"""",""") newchars=Replace(newchars,"%22","") 'remove any encoded double quotes cleanChars = newChars end function function URLDecode(sText) Dim sDecoded,oRegExpr,oMatchCollection,oMatch sDecoded = sText Set oRegExpr = Server.CreateObject("VBScript.RegExp") oRegExpr.Pattern = "%[0-9,A-F]{2}" oRegExpr.Global = True Set oMatchCollection = oRegExpr.Execute(sText) For Each oMatch In oMatchCollection sDecoded = Replace(sDecoded,oMatch.value,Chr(CInt("&H" & Right(oMatch.Value,2)))) Next 'VP-ASP 6.50.2 - add close calls Set oRegExpr = Nothing Set oMatchCollection = Nothing URLDecode = sDecoded end function '-------------------------------------- 'VP-ASP 6.50 - add a random string to email form to stop bots spamming it sub getCAPTCHA %><% '**************************************************************************************** '** Copyright Notice '** '** Web Wiz Guide - Web Wiz CAPTCHA '** '** http://www.webwizCAPTCHA.com '** '** Copyright 2005-2006 Bruce Corkhill All Rights Reserved. '** '** This program is free software; you can modify (at your own risk) any part of it '** under the terms of the License that accompanies this software and use it both '** privately and commercially. '** '** All copyright notices must remain in tacked in the scripts and the '** outputted HTML. '** '** You may use parts of this program in your own private work, but you may NOT '** redistribute, repackage, or sell the whole or any part of this program even '** if it is modified or reverse engineered in whole or in part without express '** permission from the author. '** '** You may not pass the whole or any part of this application off as your own work. '** '** All links to Web Wiz Guide and powered by logo's must remain unchanged and in place '** and must remain visible when the pages are viewed unless permission is first granted '** by the copyright holder. '** '** This program is distributed in the hope that it will be useful, '** but WITHOUT ANY WARRANTY; without even the implied warranty of '** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR ANY OTHER '** WARRANTIES WHETHER EXPRESSED OR IMPLIED. '** '** You should have received a copy of the License along with this program; '** if not, write to:- Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom. '** '** '** No official support is available for this program but you may post support questions at: - '** http://www.webwizguide.info/forum '** '** Support questions are NOT answered by e-mail ever! '** '** For correspondence or non support questions contact: - '** info@webwizguide.info '** '** or at: - '** '** Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom '** '**************************************************************************************** 'Initialise variables Dim blnCAPTCHAabout dim strTxtLoadNewCode '***** Change this if to false if you do NOT want the CAPTCHA code to be case sensitive ***** Const blnCAPTCHAcaseSensitive = false '***** Change this if tyou wish to chnage the reload image text ***** strTxtLoadNewCode = getlang("langcaptchaloadnew") '***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** Const strCAPTCHAversion = "2.01" blnCAPTCHAabout = false 'blnCAPTCHAabout = true '***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** %> <% '**************************************************************************************** '** Copyright Notice '** '** Web Wiz Guide - Web Wiz CAPTCHA '** '** http://www.webwizCAPTCHA.com '** '** Copyright 2005-2006 Bruce Corkhill All Rights Reserved. '** '** This program is free software; you can modify (at your own risk) any part of it '** under the terms of the License that accompanies this software and use it both '** privately and commercially. '** '** All copyright notices must remain in tacked in the scripts and the '** outputted HTML. '** '** You may use parts of this program in your own private work, but you may NOT '** redistribute, repackage, or sell the whole or any part of this program even '** if it is modified or reverse engineered in whole or in part without express '** permission from the author. '** '** You may not pass the whole or any part of this application off as your own work. '** '** All links to Web Wiz Guide and powered by logo's must remain unchanged and in place '** and must remain visible when the pages are viewed unless permission is first granted '** by the copyright holder. '** '** This program is distributed in the hope that it will be useful, '** but WITHOUT ANY WARRANTY; without even the implied warranty of '** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR ANY OTHER '** WARRANTIES WHETHER EXPRESSED OR IMPLIED. '** '** You should have received a copy of the License along with this program; '** if not, write to:- Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom. '** '** '** No official support is available for this program but you may post support questions at: - '** http://www.webwizguide.info/forum '** '** Support questions are NOT answered by e-mail ever! '** '** For correspondence or non support questions contact: - '** info@webwizguide.info '** '** or at: - '** '** Web Wiz Guide, PO Box 4982, Bournemouth, BH8 8XP, United Kingdom '** '**************************************************************************************** '***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** Response.Write(vbCrLf & vbCrLf & "") '***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** %> <% '***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** If blnCAPTCHAabout Then Response.Write("") End If '***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** %>
    Code Image - Please contact webmaster if you have problems seeing this image code  <% = strTxtLoadNewCode %>
    Powered by Web Wiz CAPTCHA version " & strCAPTCHAversion & "
    Copyright ©2005-2006 Web Wiz Guide
    <% end sub 'CDM_MA AdditionFor Store Upgrade Sub MFGList ' CDM addin to provide MFG list on left left bar ' ccount allows first 8 cats to show ' spacing is added to stay in graphic box Dim MFGList(50) dim mfgcount, SQLmfg dim rsmfg, conn1 ShopOpenDatabase conn1 Set rsmfg = Server.CreateObject ("ADODB.Recordset") 'SET ANSI_NULLS OFF SQLmfg="Select categoryid, catdescription, hassubcategory, cathide from categories where catextra = 'X' order by catdescription" rsmfg.Open SQLmfg, conn1, adOpenForwardOnly,adLockReadOnly, adCmdText Response.Write "" Do While Not rsmfg.EOF if isnull(rsmfg("cathide")) then if UCase(rsmfg("hasSubcategory")) ="YES" then response.write "