<%@ LANGUAGE="VBSCRIPT" %> <% PageStrings = "33, 68, 69, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 108, 119, 164, 264, 263, 740, 781, 782, 783, 845, 846, 847, 978, 1141, 1411, 1412, 1413, 1512, 1513, 1514, 1515, 1631, 1632, 1719, 1720, 1721, 1755, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1812, 1813, 1814, 1815, 1820, 1848, 1849, 1850, 1851, 1852, 1935" blnDateStrings = true %> <% blnMustBeLoggedIn = true %> <% '=============================================== ' CactuShop ASP Shopping Cart ' ©1999-2007 Cactusoft International FZ-LLC ' www.cactusoft.com '=============================================== ' All rights reserved. ' Use of this code is covered by the terms and ' conditions in the license agreement. No ' unauthorized duplication or distribution is ' permitted. Cactusoft's copyright notices must ' remain in the ASP sections of the code. '=============================================== '----------------------------------------------- 'CUSTOMER HOME 'This page does lots of things: '- Order History (with link through for more ' details on each order) '- Downloadable Products '- Stored Baskets '- Change Password Link '----------------------------------------------- '----------------------------------------------- 'READ PAGE TEMPLATE FROM FILE '----------------------------------------------- Call ReadFromTemplate(strTemplateLocation, aryPageTemplate) '----------------------------------------------- 'WRITE FIRST HALF OF PAGE HTML '----------------------------------------------- response.write(aryPageTemplate(0)) 'Get a specific show strShow = ListSafe(request.QueryString("strShow"), "all,orders,baskets,wishlists", "all") 'Get useful application variables numAppMaxOrders = NumSafe(GetAppVar("maxorders")) numAppMaxBaskets = NumSafe(GetAppVar("maxbaskets")) strAppUploadsFolder = GetAppVar("uploadsfolder") 'If we're showing a full list, or config settings set to 0, then don't limit (-2) If numAppMaxOrders = 0 or strShow = "orders" then numAppMaxOrders = -2 If numAppMaxBaskets = 0 or strShow = "baskets" then numAppMaxBaskets = -2 If numAppMaxBaskets = 0 or strShow = "wishlists" then numAppMaxBaskets = -2 Set objOrderCurrency = New CurrencyData %>

<% WriteString("PageTitle_MyAccount") %>

<% '----------------------------------------------- 'ORDER HISTORY '----------------------------------------------- If strShow = "all" or strShow="orders" then %>

<% WriteString("SubHeading_OrderHistory") %>

<% strQuery = LimitSQL("O_ID, O_Date, O_LastModified, O_TotalPrice, tblCactuShop" & TABLE_PREFIX & "Currencies.* FROM tblCactuShop" & TABLE_PREFIX & "Orders INNER JOIN tblCactuShop" & TABLE_PREFIX & "Currencies ON tblCactuShop" & TABLE_PREFIX & "Orders.O_CurrencyID = tblCactuShop" & TABLE_PREFIX & "Currencies.CUR_ID WHERE O_CustomerID = " & DB_C_ID & " AND O_Sent = 'y' ORDER BY O_Date DESC", numAppMaxOrders + 1, false) Call ExecuteRS(strQuery, objRecordSet) numTotalOrders = objRecordSet.RecordCount If objRecordSet.BOF and objRecordSet.EOF Then %>

<% WriteString("ContentText_OrderNotFound") %>

<% Else objOrderCurrency.Load(objRecordSet) %>

<% If numTotalOrders > numAppMaxOrders and numAppMaxOrders <> -2 then WriteString("ContentText_OrdersBelowRecent") else WriteString("ContentText_OrdersBelow") end if %>

"> <% Do Until objRecordSet.EOF or numCurrentOrder = numAppMaxOrders 'Set background colour numCurrentOrder = numCurrentOrder + 1 If numCurrentOrder mod 2 = 0 then strBgClass = "main_line_1" Else strBgClass = "main_line_2" 'Get record details O_ID = objRecordSet("O_ID") O_Date = objRecordSet("O_Date") O_LastModified = objRecordSet("O_LastModified") O_TotalPrice = objRecordSet("O_TotalPrice") Set objOrderCurrency = New CurrencyData objOrderCurrency.Load(objRecordSet) %> > <% objRecordSet.MoveNext Loop %>
<% WriteString("ContentText_SmallNumber") %> <% WriteString("ContentText_OrderDate") %> <% WriteString("ContentText_LastUpdate") %> <% WriteString("ContentText_Amount") %>
<%= O_ID %> <%= WriteSafe(FormatDate(O_Date, strDateAndTimeFormat)) %> <%= WriteSafe(FormatDate(O_LastModified, strDateAndTimeFormat)) %> <%= WriteSafe(objOrderCurrency.Display(O_TotalPrice, false, false)) %> <% WriteString("ContentText_Invoice") %>   <% WriteString("ContentText_View") %>
<% If numAppMaxOrders = -2 then %>

<< <% WriteString("ContentText_GoBack") %>

<% ElseIf numTotalOrders > numAppMaxOrders then %>

<% WriteString("ContentText_ViewAllOrders") %>

<% end if End If objRecordSet.Close %>
<% end if '*********************************************** 'DOWNLOADABLE PRODUCTS '*********************************************** If strShow = "all" then strQuery = "SELECT O_CustomerID, O_Date, IR_VersionCode, IR_VersionName, V_ID, V_DownLoadInfo, V_DownloadType FROM (tblCactuShop" & TABLE_PREFIX & "Versions INNER JOIN tblCactuShop" & TABLE_PREFIX & "InvoiceRows ON tblCactuShop" & TABLE_PREFIX & "Versions.V_CodeNumber = tblCactuShop" & TABLE_PREFIX & "InvoiceRows.IR_VersionCode) INNER JOIN tblCactuShop" & TABLE_PREFIX & "Orders ON tblCactuShop" & TABLE_PREFIX & "InvoiceRows.IR_OrderNumberID = tblCactuShop" & TABLE_PREFIX & "Orders.O_ID WHERE O_CustomerID = " & DB_C_ID & " AND O_Sent = 'y' AND" If Not GetAppVar("instantdownload") = "y" Then strQuery = strQuery & " O_Shipped = 'y' AND" If Not GetAppVar("downloadlimitdays") = 0 Then strQuery = strQuery & " O_Date >= " & strDateDelimiter & ReverseDate(DateAdd("d", -GetAppVar("downloadlimitdays"), NowOffset)) & strDateDelimiter & " AND" strQuery = strQuery & " V_DownLoadType <> 'n' AND V_DownloadType <> 'f' AND V_DownloadInfo <> ''" Call ExecuteRS(strQuery, objRecordSet) If Not (objRecordSet.bof and objRecordSet.EOF) Then %>

<% WriteString("SubHeading_ProductsOrdered") %>

<% WriteString("ContentText_DownloadExplanation") %>

"> <% numBgCount = 0 Do Until objRecordSet.EOF 'Background numBgCount = numBgCount + 1 'Get record info O_Date = objRecordSet("O_Date") V_ID = objRecordSet("V_ID") IR_VersionCode = objRecordSet("IR_VersionCode") V_DownLoadInfo = objRecordSet("V_DownLoadInfo") V_DownloadType = objRecordSet("V_DownloadType") IR_VersionName = objRecordSet("IR_VersionName") 'Get download URL If not GetAppVar("hiddendownloads") = "y" then 'Link to files - just build up a link to the file for download If V_DownloadType = "l" Then strDownloadURL = "" & GetString("ContentText_Download") & "" ElseIf V_DownloadType = "u" then 'See if the file exists ReDim aryDownloadExtension(0) Dim aryDownloadInfo aryDownloadInfo = split(V_DownloadInfo, "|") aryDownloadExtension(0) = aryDownloadInfo(0) Set objFSO = Server.CreateObject("Scripting.FileSystemObject") strFileName = GetFileLocation(Server.MapPath(strAppUploadsFolder & "files_versions/"), V_ID & "_" & aryDownloadInfo(1), aryDownloadExtension, objFSO) Set objFSO = Nothing 'Write out the result If strFileName = "" Then strDownloadURL = GetString("ContentText_Unavailable") Else strFileLocation = strAppUploadsFolder & "files_versions/" & strFileName strDownloadURL = "" & GetString("ContentText_Download") & "" End if end if Else 'Stream files - links off to the download page, 'which streams the file strDownloadURL = "" & GetString("ContentText_Download") & "" end if 'Show order in row %> > <% objRecordSet.MoveNext Loop %>
<% WriteString("ContentText_CodeNumberSmall") %> <% WriteString("ContentText_OrderDate") %> <% WriteString("ContentText_DownLoadInfo") %>
<%= WriteSafe(IR_VersionName) %> <%= WriteSafe(IR_VersionCode) %> <%= WriteSafe(FormatDate(O_Date, strDateFormat)) %> <%= strDownloadURL %>
<% End If objRecordSet.Close End If '*********************************************** 'SAVED BASKETS '*********************************************** If strShow = "all" or strShow = "baskets" then %>

<% WriteString("SubHeading_StoredBaskets") %>

<% 'Pull out baskets strQuery = LimitSQL("BSKT_Name, BSKT_DateTime, BSKT_ID FROM tblCactuShop" & TABLE_PREFIX & "SaveBasket WHERE BSKT_CustomerID = " & DB_C_ID & " ORDER BY BSKT_DateTime DESC", numAppMaxBaskets + 1, false) Call ExecuteRS(strQuery, objRecordSet) numTotalBaskets = objRecordSet.RecordCount If Not (objRecordSet.BOF and objRecordSet.EOF) Then %>

<%= IIf(numTotalBaskets > numAppMaxBaskets and numAppMaxBaskets <> -2, GetString("ContentText_StoreBasketsDescRecent"), GetString("ContentText_StoreBasketsDesc")) %>

"> <% numCurrentBasket = 0 Do Until objRecordSet.EOF or numCurrentBasket = numAppMaxBaskets 'Set background colour numCurrentBasket = numCurrentBasket + 1 'Get record details BSKT_Name = objRecordSet("BSKT_Name") BSKT_DateTime = objRecordSet("BSKT_DateTime") BSKT_ID = objRecordSet("BSKT_ID") %> > <% objRecordSet.MoveNext Loop %>
<% WriteString("ContentText_BasketName") %> <% WriteString("ContentText_DateSaved") %>
<%= WriteSafe(BSKT_Name) %> <%= WriteSafe(FormatDate(BSKT_DateTime, strDateAndTimeFormat)) %> <% WriteString("ContentText_Delete") %>   <% WriteString("ContentText_Load") %>
<% If numAppMaxBaskets = -2 then 'do nothing ElseIf numTotalBaskets > numAppMaxBaskets then %>

<% WriteString("ContentText_ViewAllBaskets") %>

<% end if Else %>

<% WriteString("ContentText_NoSavedBaskets") %>

<% End If objRecordSet.Close If objBasket.TotalItems > 0 then %>
<% WriteSafeString(" title="<% WriteSafeString("ContentText_SaveRecoverBasketDesc") %>" /><% WriteString("PageTitle_SaveRecoverBasketContents") %>

<% WriteString("ContentText_SaveRecoverBasketDesc") %>

<% end if %>
<% End If '*********************************************** 'WISH LISTS '*********************************************** If (strShow = "all" or strShow = "wishlists") and GetAppVar("enablewishlist") <> "n" then %>

<% WriteString("SubHeading_WishLists") %>

<% 'Pull out wishlists strQuery = LimitSQL("WL_Name, WL_DateTime, WL_ID FROM tblCactuShop" & TABLE_PREFIX & "WishList WHERE WL_CustomerID = " & DB_C_ID & " ORDER BY WL_DateTime DESC", numAppMaxBaskets + 1, false) Call ExecuteRS(strQuery, objRecordSet) numTotalWishLists = objRecordSet.RecordCount If Not (objRecordSet.BOF and objRecordSet.EOF) Then %>

<% WriteString("ContentText_RecoverExistingWishList") %>

"> <% numCurrentWishList = 0 Do Until objRecordSet.EOF or numCurrentWishList = numAppMaxBaskets 'Set background colour numCurrentWishList = numCurrentWishList + 1 'Get record details WL_Name = objRecordSet("WL_Name") WL_DateTime = objRecordSet("WL_DateTime") WL_ID = objRecordSet("WL_ID") %> > <% objRecordSet.MoveNext Loop %>
<% WriteString("ContentText_WishListName") %> <% WriteString("ContentText_DateSaved") %>
<%= WriteSafe(WL_Name) %> <%= WriteSafe(FormatDate(WL_DateTime, strDateAndTimeFormat)) %> <% WriteString("ContentText_Delete") %>   <% WriteString("ContentText_Edit") %>   <% WriteString("ContentText_Load") %>
<% If numAppMaxBaskets = -2 then 'do nothing ElseIf numTotalWishLists > numAppMaxBaskets then %>

<% WriteString("ContentText_ViewAllWishLists") %>

<% end if Else %>

<% WriteString("ContentText_NoWishLists") %>

<% End If objRecordSet.Close If objBasket.TotalItems > 0 then %>
<% WriteSafeString(" title="<% WriteSafeString("ContentText_SaveWishList") %>" /><% WriteString("ContentText_SaveWishList") %>

<% WriteString("ContentText_SaveWishListDesc") %>

<% end if %>
<% End If '*********************************************** 'AFFILIATE REFERRALS '*********************************************** If strShow = "all" and GetAppVar("myaccountaffiliates") <> "off" then %>

<% WriteString("ContentText_AffiliateReferrals") %>

<% If DB_C_IsAffiliate = "y" then If DB_C_AffiliateCommission > 0 then %>

<% WriteString("ContentText_AffiliateLinkText") %>

<%= GetAppVar("webshopurl") & "?af=" & DB_C_ID %>

<% WriteString("ContentText_ToViewAffiliateActivity") %> <% WriteString("ContentText_CustomerCodeClickHere") %>.

<% WriteString("ContentText_ViewAccountBalance") %> <% WriteString("ContentText_CustomerCodeClickHere") %>.

<% else %>

<% WriteString("ContentText_AffiliateApplicationPending") %>

<% end if %> <% else %>

<% WriteString("ContentText_NotAffiliateYet") %> <% WriteString("ContentText_CustomerCodeClickHere") %>.

<% End if %>
<% end if '*********************************************** 'CHANGE PASSWORD LINK '*********************************************** If strShow = "all" then %>

<% WriteString("ContentText_ChangeCustomerCode") %>

<% WriteString("ContentText_ToChangeCustomerCode") %> <% WriteString("ContentText_CustomerCodeClickHere") %>.

<% '*********************************************** 'CUSTOMER DISCOUNT '*********************************************** If DB_C_CustomerDiscount > 0 then %>

<% WriteString("ContentText_CustomerDiscount") %>

<%= GetString("ContentText_CustomerDiscountText1") & "" & DB_C_CustomerDiscount & "% " & GetString("ContentText_CustomerDiscountText2") %>

<% end if %> <% end if '*********************************************** 'MAILING LIST '*********************************************** If strShow = "all" and GetAppVar("enablemailinglist") <> "n" then %>

<% WriteString("PageTitle_MailingList") %>

<%= objCactuSession.Form %> <% 'Lookup mailing list settings strQuery = "SELECT C_ML_SignupDateTime, C_ML_SignupIP, C_ML_ConfirmationDateTime, C_ML_ConfirmationIP, C_ML_Format, C_ML_SendMail FROM tblCactuShop" & TABLE_PREFIX & "Customers WHERE C_ID = " & DB_C_ID Call ExecuteRS(strQuery, objRecordSet) If objRecordSet.BOF and objRecordSet.EOF then 'user is logged in so this *SHOULD NEVER* happen! Else C_ML_SignupDateTime = objRecordSet("C_ML_SignupDateTime") C_ML_ConfirmationDateTime = objRecordSet("C_ML_ConfirmationDateTime") C_ML_Format = objRecordSet("C_ML_Format") C_ML_SendMail = objRecordSet("C_ML_SendMail") End if %>

<% 'Show email address confirmation status If C_ML_ConfirmationDateTime > CDate(ReverseDate("1/1/1900")) then 'email is confirmed response.write("

" & GetString("ContentText_EmailVerified") & "

") 'Give form for changing settings %>

" />

<% Elseif C_ML_SignupDateTime > CDate(ReverseDate("1/1/1900")) then 'email is NOT confirmed but signup was attempted response.write("

" & GetString("ContentText_EmailNotVerified") & "

") response.write("

" & GetString("ContentText_SendVerificationMail") & "

") Else 'no attempt yet to signup this email address response.write("

" & GetString("ContentText_EmailNotSignedUp") & "

") response.write("

" & GetString("ContentText_SendVerificationMail") & "

") End if %>

<% end if %>

<% WriteString("ContentText_LookupPage") %>

<% '----------------------------------------------- 'WRITE LAST HALF OF PAGE HTML '----------------------------------------------- Response.Write(aryPageTemplate(1)) Call EndPage() %>