%@ LANGUAGE="VBSCRIPT" %> <% PageStrings = "18, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 68, 69, 70, 71, 121, 164, 222, 301, 821, 822, 823, 824, 825, 1078, 1086, 1450, 1617, 1618, 1619, 1620, 1621, 1623, 1672, 1709, 1724, 1767, 1768, 1786, 1788, 1882, 1907, 1908, 1909, 1910, 1911" blnDateStrings = true %> <% '=============================================== ' CactuShop ASP Shopping Cart ' ©1999-2006 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. '=============================================== 'moved - <% =strReturnURL % + close backet 'Sub to add version to basket Sub AddVersionToBasket(numVersionID, numQuantity, strOptionGroups, strOptions) If objBasket.Exists(numVersionID, strOptions) then objBasket.Version(numVersionID, strOptions).IncreaseQuantity(numQuantity) Else objBasket.Add numVersionID, numQuantity, strOptionGroups, strOptions End If End Sub 'Application settings we'll be using a lot strAppShowBasket = GetAppVar("showbasket") strAppPricesIncTax = GetAppVar("pricesinctax") strAppShowTaxDisplay = GetAppVar("showtaxdisplay") 'Set page title strPageTitleHTML = GetString("PageTitle_ShoppingBasket") & GetString("PageTitle_Separator") & GetString("Config_Webshopname") '*********************************************** 'BASKET PROCESSING '*********************************************** 'Collect parameters and set values numLineCount = NumSafe(Request.Querystring("numLineCount")) numRemove = NumSafe(Request.QueryString("numRemove")) strAction = ListSafe(DualRequest("strAction"), "refresh,remove,add,removecoupon", "refresh") numOptionGroupIDs = request.Querystring("numOptionGroupIDs") If request.querystring("strFromBasket") = "yes" then strAction = "refresh" 'Are there any errors? If request.QueryString("noexist") <> "" or request.QueryString("invalid") <> "" then strSpeedMessage = GetString("ContentText_SpeedOrderInvalid") end if 'Set which to return to after we've processed the basket strReturnTo = ListSafe(request.QueryString("strReturnTo"), ",home,cat,product,search,speedorder", "") Select Case strReturnTo Case "home" strReturnURL = "default.asp?" & objCactuSession.QS Case "product", "cat" 'Get return variables Set objTrail = New BreadcrumbTrail numReturnP_ID = NumSafe(request.QueryString("numReturnP_ID")) numReturnCAT_ID = NumSafe(request.QueryString("numReturnCAT_ID")) numReturnRecordPosition = NumSafe(request.QueryString("numReturnRecordPosition")) 'Build up the url strReturnURL = IIf(strReturnTo = "product", "product.asp", "prodtype.asp") & "?" & objCactuSession.QS & objTrail.QS & "P_ID=" & numReturnP_ID & "&CAT_ID=" & numReturnCAT_ID & "&numRecordPosition=" & numReturnRecordPosition Case "search" numReturnSearchStartRecord = NumSafe(request.QueryString("numSearchStartRecord")) strReturnURL = "search.asp?" & objCactuSession.QS & "numSearchStartRecord=" & numReturnSearchStartRecord Case "speedorder" strReturnURL = "speedorder.asp?" & objCactuSession.QS End Select '----------------------------------------------- 'REFRESH 'Check through all incoming values and update 'their quantities '----------------------------------------------- Select Case strAction Case "refresh" 'Loop through each item in the basket for numCount = 0 to objBasket.Count - 1 'Get quantity from form and update If Request.Querystring("T" & numCount) <> "" then numNewBasketQty = NumSafe(Request.Querystring("T" & numCount)) objBasket.Item(numCount).Quantity = numNewBasketQty End If Next Case "add" '----------------------------------------------- 'CHECK TO SEE IF WE'RE ADDING FROM OPTIONS 'We need to grab the option groups and option 'selections. Code to check the validity in 'the basket class. '----------------------------------------------- If numOptionGroupIDs <> "" then 'Get the quantity to add numQty = NumSafe(Request.querystring("Q1")) numBaseVersionID = NumSafe(Request.QueryString("V_ID")) If numQty > 32767 then numQty = 32767 If numQty > 0 And numBaseVersionID > 0 then aryOptionGroupIDs = split(numOptionGroupIDs, ", ") 'Loop through all options For Each strOptionGroupID in aryOptionGroupIDs OPT_ID = 0 OPTG_ID = NumSafe(strOptionGroupID) If OPTG_ID > 0 then 'Check out the option selection - 'First check to see if there's a nocheck type OPT_ID = request.QueryString("NOCHECK_OPT_ID" & OPTG_ID) If OPT_ID <> "" Then 'There is - see if we've got the checkbox was checked If request.QueryString("OPT_ID" & OPTG_ID) <> "" then OPT_ID = request.QueryString("OPT_ID" & OPTG_ID) End If Else 'Didn't have a NOCHECK type, so it's not from a 'checkbox. Get it normally. OPT_ID = request.QueryString("OPT_ID" & OPTG_ID) End If End If If OPTG_ID > 0 and OPT_ID > 0 then 'Add on our new values strOptionGroupIDs = IIf(strOptionGroupIDs = "", OPTG_ID, strOptionGroupIDs & "|" & OPTG_ID) strOptionIDs = IIf(strOptionIDs = "", OPT_ID, strOptionIDs & "|" & OPT_ID) End If Next End If 'Add the version to the basket If numQty > 0 and numBaseVersionID > 0 then AddVersionToBasket numBaseVersionID, numQty, strOptionGroupIDs, strOptionIDs End If Else '----------------------------------------------- 'ADD EACH ITEM TO THE BASKET '----------------------------------------------- For numSpeedRows = 1 to numLineCount 'Get the quantity to add numNewBasketQty = NumSafe(Request.querystring("Q" & numSpeedRows)) numNewVersion = NumSafe(Request.querystring("V" & numSpeedRows)) If numNewVersion > 0 then AddVersionToBasket numNewVersion, numNewBasketQty, 0, 0 end if Next End If Case "remove" 'Delete the item from the basket strOptions = request.QueryString("strOptions") If objBasket.Exists(numRemove, strOptions) then objBasket.Delete numRemove, strOptions End If End Select '----------------------------------------------- 'ClEAN ARRAY AND SAVE BASKET TO SESSION 'Because we might be redirecting before buildpage 'we want to make sure we save our changes '----------------------------------------------- objBasket.Clean objCactuSession.Edit "strItems", objBasket.Items objCactuSession.Edit "strQuantities", objBasket.Quantities objCactuSession.Edit "strOptionGroups", objBasket.OptionGroups objCactuSession.Edit "strOptions", objBasket.Options '----------------------------------------------- 'COUPON PROCESSING '----------------------------------------------- 'Get the coupon code in the session or form strFormCouponCode = Request.Querystring("CP_CouponCode") If strFormCouponCode <> "" then CP_CouponCode = strFormCouponCode Else CP_CouponCode = objCactuSession.Value("CP_CouponCode") end If If CP_CouponCode <> "" then 'Pull out coupon from the DB and error-check strQuery = "SELECT * FROM tblCactuShop" & TABLE_PREFIX & "Coupons WHERE CP_CouponCode='" & SQLSafe(CP_CouponCode) & "'" Call ExecuteRS(strQuery, objRecordSet) If objRecordSet.BOF and objRecordSet.EOF then strCouponError = GetString("ContentText_CouponDoesntExist") ElseIf objRecordSet("CP_Used") = "y" AND objRecordSet("CP_Reusable") <> "y" then strCouponError = GetString("ContentText_CouponExpended") ElseIf Cdate(objRecordSet("CP_StartDate")) > NowOffset() then strCouponError = GetString("ContentText_CouponNotYetValid") ElseIf Cdate(objRecordSet("CP_EndDate")) < NowOffset() OR objRecordSet("CP_Enabled") <> "y" then strCouponError = GetString("ContentText_CouponExpired") Else CP_DiscountValue = objRecordSet("CP_DiscountValue") CP_DiscountType = objRecordSet("CP_DiscountType") If CP_DiscountType = "p" then strCouponName = objRecordSet("CP_CouponCode") & " - " & CP_DiscountValue & "%" Else strCouponName = objRecordSet("CP_CouponCode") & " - " & objCurrency.Display(objRecordSet("CP_DiscountValue"), false, false) End if End if objRecordSet.close End If If CP_CouponCode = "" or strCouponError <> "" or strAction = "removecoupon" then CP_CouponCode = "" CP_DiscountType = "" CP_DiscountValue = 0 objCactuSession.Delete "CP_CouponCode" Else objCactuSession.Edit "CP_CouponCode", CP_CouponCode End If '----------------------------------------------- 'PAGE REDIRECTION 'Actions have all been performed - redirect if 'required (e.g. start checkout process) '----------------------------------------------- If strCouponError = "" then If len(Request.Querystring("btnEmpty")) > 0 then Call EndPage() response.redirect("emptybasket.asp?" & strSessionQS) ElseIf len(Request.Querystring("btnCheckout")) > 0 then Call EndPage() response.redirect("checkout.asp?" & strSessionQS) ElseIf len(Request.Querystring("btnEnquire")) > 0 then Call EndPage() response.redirect("contact.asp?" & strSessionQS & "strCallMode=enquiry") End If End If '----------------------------------------------- 'BASKET NOT SHOWN - STRAIGHT BACK TO LAST PAGE '----------------------------------------------- If strAppShowBasket = "n" and strReturnURL <> "" then Call EndPage() response.redirect(Replace(strReturnURL, "&", "&")) End If '----------------------------------------------- 'PUT BUILDPAGE.ASP INCLUDE FURTHER DOWN 'This can't go at the top like on the other 'pages otherwise the side menu basket will not 'be updated with the latest item added to the 'basket. '----------------------------------------------- %><% '----------------------------------------------- 'READ PAGE TEMPLATE FROM FILE '----------------------------------------------- Call ReadFromTemplate(strTemplateLocation, aryPageTemplate) 'Set the basket adjustments. This might come through the querystring strAdjusted = objBasket.AdjustedQuantities If strAdjusted = "" then strAdjusted = Request.QueryString("strAdjusted") '----------------------------------------------- 'DETERMINE WHAT META REFRESH TO SET FOR BASKET 'If the 'showbasket' setting in the config is a 'number, we set meta refresh to that value in 'seconds providing there is a return URL. If 'there's an error then don't redirect. Add 'in meta refresh after head tag in skin. '----------------------------------------------- If IsNumeric(strAppShowBasket) AND strReturnURL <> "" and strSpeedMessage = "" and strAdjusted = "" then strMetaRefresh = "" aryPageTemplate(0) = Replace(aryPageTemplate(0),"
","" & vbcrlf & strMetaRefresh) end if 'Calculate relevant basket modifiers. If pricesinctax=n and showtaxdisplay=n, then 'we pass blnZeroTaxRate=true (i.e. we assume that there's no tax at the moment.) blnZeroTaxRate = (strAppPricesIncTax = "n" and strAppShowTaxDisplay = "n") Call objBasket.CalculatePromotions(objRecordSet, false, blnZeroTaxRate) Call objBasket.CalculateCoupon(CP_DiscountType, CP_DiscountValue, blnZeroTaxRate) Call objBasket.CalculateCustomerDiscount(DB_C_CustomerDiscount) '----------------------------------------------- 'WRITE FIRST HALF OF PAGE HTML '----------------------------------------------- response.write(aryPageTemplate(0)) %><% WriteString("ContentText_ItemsAdded") %>
" title="<% WriteSafeString("ContentText_SaveRecoverBasketDesc") %>" /><% WriteString("PageTitle_SaveRecoverBasketContents") %>
<% WriteString("ContentText_SaveRecoverBasketDesc") %>
" title="<% WriteSafeString("ContentText_MyAccountDesc") %>" /><% WriteString("PageTitle_MyAccount")%>
<% WriteString("ContentText_MyAccountDesc") %>