<%@ Language=VBScript %> <%Option Explicit%> <% Dim PageName PageName = "My Free Quote" %> <% Response.Expires = 0 If Request.Cookies("SessionID") = "" Then Response.Cookies("SessionID") = Session.SessionID SessionID = Request.Cookies("SessionID") 'If SessionID = "" Then Response.Redirect "no_cookies.asp" Conn.open strConn Dim Category, SubCategory, PageCategory Dim Quantity, NewQuantity, Colours, NewColours, ProductID, SessionID, Options, NewOptions Dim Email, Title, FirstName, LastName, Street, Suburb, State, Postcode Dim Country, AreaCode1, Phone1, AreaCode2, Phone2, PostageAndHandling, InsuranceCharge, Comments, HowDidYouHear 'On Error Resume Next ProductID = Trim(Request("ProductID")) Options = Trim(Request("Options")) Quantity = Trim(Request("Quantity")) Colours = Trim(Request("Colours")) If IsNumeric(Quantity) Then If Clng(Quantity) > 1 Then Quantity = Clng(Quantity) Else Quantity = 1 End If Else Quantity = 1 End If ' Add Product to quote If ProductID <> "" Then strSQL = "SELECT CartID FROM Cart WHERE SessionID = " & SessionID & " AND ProductID = " & ProductID Set RS = Conn.Execute(strSQL) If RS.EOF Then strSQL = "INSERT INTO Cart (SessionID, ProductID, Options, Colours, Quantity) VALUES (" & SessionID & ", " & ProductID & ", " & FormatSQLText(Options) & ", " & FormatSQLNumber(Colours) & ", " & Quantity & ") " Else strSQL = "UPDATE Cart SET Quantity = Quantity + " & Quantity & ", Colours = " & FormatSQLNumber(Colours) & ", Options = Options & " & FormatSQLText(Options) & " WHERE CartID = " & RS("CartID" ) End If Set RS = Nothing Conn.Execute strSQL ' Empty Quote ElseIf Request("PageAction") = "Empty Quote" Then strSQL = "Delete From Cart Where SessionID = " & SessionID Conn.Execute strSQL ' Update Quote Quantities ElseIf Request("UpdateQuote") = "Update Quote" Or Request("QuoteRequest") = "Quote Request" Then Set RS = Server.CreateObject( "ADODB.Recordset" ) RS.ActiveConnection = Conn RS.CursorType = adOpenDynamic RS.LockType = adLockOptimistic strSQL = "SELECT CartID, Quantity, Colours, Options FROM Cart WHERE SessionID=" & SessionID RS.Open strSQL While Not RS.EOF NewQuantity = Trim(Request("ProductQuantity" & RS("CartID"))) NewColours = Trim(Request("Colours" & RS("CartID"))) NewOptions = Trim(Request("Options" & RS("CartID"))) If NewQuantity = "" OR NewQuantity = "0" Then RS.Delete Else If IsNumeric(NewQuantity) Then RS("Quantity") = NewQuantity RS("Options") = NewOptions If NewColours = "" Then RS("Colours") = Null Else RS("Colours") = FormatSQLNumber(NewColours) End If End If End If RS.MoveNext WEnd Set RS = Nothing If Request("UpdateQuote") = "Update Quote" Then 'Redirect done to force page refresh and view correct quote. Set Conn = Nothing Response.Redirect "cart.asp" Response.end 'Else ' Response.Redirect "checkout.asp" End If End If 'Get user details if order made and failed strSQL = "SELECT TOP 1 * FROM Orders WHERE SessionID = " & SessionID & " " strSQL = strSQL & "Order By OrderID DESC" Set RS = Conn.Execute(strSQL) If Not RS.EOF Then Email = RS("Email") Title = RS("Title") FirstName = RS("FirstName") LastName =RS("LastName") Street = RS("Street") Suburb = RS("Suburb") State = RS("State") Postcode = RS("Postcode") Country = RS("Country") AreaCode1 = RS("AreaCode1") Phone1 = RS("Phone1") AreaCode2 = RS("AreaCode2") Phone2 = RS("Phone2") Comments = RS("Comments") HowDidYouHear = RS("HowDidYouHear") End If Set RS = Nothing %> Majestic Products - <%=PageName%>
<% If Request("QuoteRequest") <> "Quote Request" Then %>
Catalogue > My Free Quote
<% ' Get the quote strSQL = "SELECT Cart.CartID, Product.*, Cart.Quantity, Cart.Colours, Cart.Options " strSQL = strSQL & "FROM Category INNER JOIN (Product INNER JOIN Cart ON Product.ProductID = Cart.ProductID) ON Category.Category = Product.Category " strSQL = strSQL & "WHERE Cart.SessionID=" & SessionID & " ORDER BY Cart.CartID DESC" Set RS = Server.CreateObject("ADODB.Recordset") Set RS.ActiveConnection = Conn RS.Open strSQL If RS.EOF Then %>

You do not have any products in your free quote.

To add products to your free quote please select catalogue category from
the left-hand menu.

<% Else %>
<%While Not RS.EOF %> <% RS.MoveNext Wend %>
Product Code - Product Name Category Colours Quantity
"><%=RS("ProductCode") & " - " & RS("ProductName")%> <%=RS("Category")%> " type="text" size=4 value="<%=RS("Quantity")%>">
Quantity break-down of product colours and/or sizes and comments

If you are unsure about how to fill out all options, you can leave them blank.
We will verify your entire requirements by phone or email prior to quote preparation.

To add more products to your quote click the "Continue Selecting" button.
To change quantity, colours and/or options, enter new values and click the "Update Quote" button.
To remove a product, change the quantity to 0 or blank then click the "Update Quote" button.
To empty the entire quote, click the "Empty Quote" button.
To process your quote, click the “Quote Request” button.

<% End If %>
<% Else %>
<% End If %> <%Set Conn = Nothing%> <% If Request("QuoteRequest") = "Quote Request" Then %> <% End If %>