<% '**************************************************************************************************************************************************************************** ' ' Develop By : Net Lee ' Kernel Version : 89.485.5691 ' Cart Version : 27.577.1531 ' Last Update @ 12:00 AM 11/23/2005 ' '**************************************************************************************************************************************************************************** ' ' Function Contents : ' assign_session = assign_session(i) ' insert_into_array = insert_into_array(product_id, product_code, product_model, product_price, product_price_2) ' insert_item = insert_item() ' cancel item (empty basket) = cancel_item ' update_item = update_item() ' query_item = query_item() ' display_result = display_result() ' calculate_item = calculate_item ' '**************************************************************************************************************************************************************************** Dim arr_Product_id, arr_Product_code, arr_Product_model, arr_Product_Member_price, arr_Product_Retail_price, arr_Order_quantity call OpenDataConnection(Request.QueryString("storename")) call LoadOrderTerms(Request.QueryString("storename")) call LoadOrderMessage(Request.QueryString("storename")) '********************************************************************************************************* 'select user action '********************************************************************************************************* select case LCase(Request("mytype")) case "insert" : insert_item case "query" : query_item case "update" : update_item case "calculate" : display_result case "cancel" : cancel_item end select call CloseDataConnection() '********************************************************************************************************* 'assign_session '********************************************************************************************************* sub assign_session(i) arr_Product_id = "arr_Product_id." & i arr_Product_code = "arr_Product_code." & i arr_Product_model = "arr_Product_model." & i arr_Product_Member_price = "arr_Product_Member_price." & i arr_Product_Retail_price = "arr_Product_Retail_price." & i arr_Order_quantity = "arr_Order_quantity." & i end sub '********************************************************************************************************* 'insert_into_array '********************************************************************************************************* sub insert_into_array(product_id, product_code, product_model, product_price, product_price_2) dim j session("item_no") = session("item_no") + 1 j = session("item_no") assign_session j session(arr_Product_id) = product_id session(arr_Product_code) = product_code session(arr_Product_model) = product_model session(arr_Product_Member_price) = product_price session(arr_Product_Retail_price) = product_price_2 session(arr_Order_quantity) = cint(1) end sub '********************************************************************************************************* 'insert_item '********************************************************************************************************* sub insert_item() dim i, chk_exist dim product_id, product_code, product_model, product_price, product_price_2, order_quantity product_id = trim(Request.Form("product_id")) product_code = trim(Request.Form("product_code")) product_model = trim(Request.Form("product_model")) product_price = cdbl(Request.Form("product_member_price")) product_price_2 = cdbl(Request.Form("product_retail_price")) if session("item_no") = 0 then insert_into_array product_id, product_code, product_model, product_price, product_price_2 else chk_exist = false for i = 1 to session("item_no") assign_session i if trim(session(arr_Product_id)) = product_id then chk_exist = true session(arr_Order_quantity) = session(arr_Order_quantity) + 1 exit for end if next if not chk_exist then insert_into_array product_id, product_code, product_model, product_price, product_price_2 end if end if query_item end sub '********************************************************************************************************* 'cancel item (empty basket) '********************************************************************************************************* sub cancel_item session("item_no") = 0 Response.Redirect "index.asp?storename=" & Request.QueryString("storename") end sub '********************************************************************************************************* 'update_item '********************************************************************************************************* sub update_item() dim i, fldQty, intQty, recno dim fldChk, ChkValue dim snd_Product_id(), snd_Product_code(), snd_Product_model(), snd_Product_price(), snd_Product_price_2(), snd_Order_quantity() i = session("item_no") redim snd_Product_id(i), snd_Product_code(i), snd_Product_model(i), snd_Product_price(i), snd_Product_price_2(i), snd_Order_quantity(i) recno = 0 for i = 1 to session("item_no") fldQty = "Qty" & i if isnumeric(Request.Form(fldQty)) then intQty = cint(Request.Form(fldQty)) else intQty = 1 end if fldChk = "Del" & i ChkValue = Request.Form(fldChk) if ChkValue = "" then if intQty > 0 then recno = recno + 1 assign_session i snd_Product_id(recno) = session(arr_Product_id) snd_Product_code(recno) = session(arr_Product_code) snd_Product_model(recno) = session(arr_Product_model) snd_Product_price(recno) = session(arr_Product_Member_price) snd_Product_price_2(recno) = session(arr_Product_Retail_price) snd_Order_quantity(recno) = intQty end if end if next if recno > 0 then session("item_no") = recno for i = 1 to recno assign_session i session(arr_Product_id) = snd_Product_id(i) session(arr_Product_code) = snd_Product_code(i) session(arr_Product_model) = snd_Product_model(i) session(arr_Product_Member_price) = snd_Product_price(i) session(arr_Product_Retail_price) = snd_Product_price_2(i) session(arr_Order_quantity) = snd_Order_quantity(i) next end if session("Shipping_Charges") = Request.Form("selected_shipping_charges") query_item end sub '********************************************************************************************************* 'query_item '********************************************************************************************************* sub query_item() dim i, intPrice call PageHeader(Request.QueryString("storename")) 'modify title design here .... Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "
" Response.Write "" Response.Write " " Response.Write "CART CONTENTS" Response.Write "
" Response.Write "" Response.Write "" 'show update item button .... Response.Write "" 'show empty basket button .... Response.Write "" Response.Write "" Response.Write "
" 'modify item content table header design here .... Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" intPrice = 0 for i = 1 to session("item_no") assign_session i 'modify table content design here .... Response.Write "" Response.Write "" Response.Write "" Response.Write "" if session("member_level") = "RESELLER" then Response.Write "" else Response.Write "" end if Response.Write "" if session("member_level") = "RESELLER" then Response.Write "" else Response.Write "" end if Response.Write "" if session("member_level") = "RESELLER" then intPrice = intPrice + (session(arr_Order_quantity) * session(arr_Product_Member_price)) else intPrice = intPrice + (session(arr_Order_quantity) * session(arr_Product_Retail_price)) end if next if session("item_no") > 0 then if session("display_shipping_charges") = "on" then 'modify shipping charges design here .... ssql = "select * from tbl_shipping" set rs = server.CreateObject("adodb.recordset") rs.Open ssql,conn,3,3 Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" rs.Close set rs = nothing intPrice = intPrice + session("Shipping_Charges") end if end if 'modify table footer design here .... Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "
No Code Model Unit Price Quantity Amount Delete Item
" & i & " " & session(arr_Product_code) & " " & session(arr_Product_model) & " " & session("company_currency_format") & " " & session(arr_Product_Member_price) & " " & session("company_currency_format") & " " & session(arr_Product_Retail_price) & " " & session("company_currency_format") & " " & session(arr_Order_quantity) * session(arr_Product_Member_price) & " " & session("company_currency_format") & " " & session(arr_Order_quantity) * session(arr_Product_Retail_price) & " " Response.Write "
Shipping Charges  " Response.Write "           " & session("company_currency_format") & " " & session("Shipping_Charges") & "  
Total " & session("company_currency_format") & " " & intPrice & "  
" Response.Write "
" Response.Write "" Response.Write "" if session("item_no") = 0 then 'show continue shopping button .... Response.Write "" Response.Write "" Response.Write "
" Response.Write " " Response.Write "
" else 'show continue shopping button .... Response.Write "
" Response.Write " " Response.Write "" Response.Write "" Response.Write "" Response.Write " " Response.Write "" Response.Write " " Response.Write " " Response.Write "
" Response.Write "
" Response.Write "" Response.Write "" 'show checkout button .... Response.Write "" if session("myMessageStatus") = "on" then 'loading order message .... Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" end if if session("myTermStatus") = "on" then 'loading ordering terms .... Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" & vbcrlf end if Response.Write "" end if Response.Write "" Response.Write "
     " Response.Write "Message  

 
     " Response.Write "Terms & Conditions  

 
" Response.Write "" Response.Write "" Response.Write "I Accept

 

" Response.Write "" if session("myTermStatus") = "on" then Response.Write "" else Response.Write "" end if Response.Write "
 " Response.Write "
" Response.Write "" call PageFooter(Request.QueryString("storename")) end sub '********************************************************************************************************* 'display_result '********************************************************************************************************* sub display_result() dim i, intPrice dim order_id dim order_rs, order_details_rs if session("member_email") <> "" then call PageHeader(Request.QueryString("storename")) 'modify title design here .... Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "
" Response.Write "" Response.Write " " Response.Write "THANK YOU!" Response.Write "
" Response.Write "" Response.Write "
" 'modify item content table header design here .... Response.Write "
" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" order_id = day(now) & month(now) & year(now) & hour(now) & minute(now) & second(now) set order_rs = server.CreateObject("adodb.recordset") order_rs.Open "tbl_order",conn,3,3 order_rs.AddNew order_rs.Fields("system_order_id") = order_id order_rs.Fields("order_date") = day(now) & "-" & month(now) & "-" & year(now) order_rs.Fields("member_email") = session("member_email") order_rs.Fields("payment_type") = "offline" order_rs.Fields("shipping_charges") = session("Shipping_Charges") order_rs.Update order_rs.Close set order_rs = nothing set order_details_rs = server.CreateObject("adodb.recordset") order_details_rs.Open "tbl_order_details",conn,3,3 intPrice = 0 for i = 1 to session("item_no") assign_session i order_details_rs.AddNew order_details_rs.Fields("system_order_id") = order_id order_details_rs.Fields("product_id") = session(arr_Product_id) order_details_rs.Fields("product_code") = session(arr_Product_code) order_details_rs.Fields("product_model") = session(arr_Product_model) if session("member_level") = "RESELLER" then order_details_rs.Fields("product_price") = session(arr_Product_Member_price) order_details_rs.Fields("product_point") = session(arr_Product_Member_price) else order_details_rs.Fields("product_price") = session(arr_Product_Retail_price) order_details_rs.Fields("product_point") = session(arr_Product_Retail_price) end if order_details_rs.Fields("order_quantity") = session(arr_Order_quantity) order_details_rs.Update 'modify table content design here .... Response.Write "" Response.Write "" Response.Write "" Response.Write "" if session("member_level") = "RESELLER" then Response.Write "" else Response.Write "" end if Response.Write "" Response.Write "" Response.Write "" intPrice = intPrice + (session(arr_Order_quantity) * session(arr_Product_Member_price)) next order_details_rs.Close set order_details_rs = nothing if session("display_shipping_charges") = "on" then 'modify shipping charges design here .... Response.Write "" Response.Write "" Response.Write "" Response.Write "" intPrice = intPrice + session("Shipping_Charges") end if 'modify table footer design here .... Response.Write "" Response.Write "" Response.Write "" Response.Write "" if session("myMessageStatus") = "on" then 'loading ordering terms .... Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" end if if session("myTermStatus") = "on" then 'loading ordering terms .... Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" end if Response.Write "
NoCodeModelUnit PriceQuantityAmount
" & i & " " & session(arr_Product_code) & " " & session(arr_Product_model) & " " & session("company_currency_format") & " " & session(arr_Product_Member_price) & " " & session("company_currency_format") & " " & session(arr_Product_Retail_price) & " " & session(arr_Order_quantity) & " " & session("company_currency_format") & " " & session(arr_Order_quantity) * session(arr_Product_Member_price) & "
Shipping Charges " & session("company_currency_format") & " " & session("Shipping_Charges") & "
Total " & session("company_currency_format") & " " & intPrice & "
" Response.Write "Message  



 
" Response.Write "Terms & Conditions  



 
" Response.Write "
" Response.Write "" Response.Write "" 'show pay by offline & online button .... Response.Write "" Response.Write "" Response.Write "
" Response.Write "
" if session("offline_payment_module") = "on" then Response.Write " " end if Response.Write "    " if session("online_payment_module") = "on" then Response.Write " " end if Response.Write " 
" Response.Write "
" Response.Write "
" calculate_item order_id else call PageHeader(Request.QueryString("storename")) 'show back to main button .... Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "
" Response.Write "" Response.Write " " Response.Write "SORRY" Response.Write "
" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "
" Response.Write "Please login to your account to continue, or register as a new member" Response.Write "
" call MemberRegisterForm(Request.QueryString("storename")) Response.Write "" call MemberLoginForm(Request.QueryString("storename"), "", "view_cart.asp") Response.Write "
" 'call PageFooter(Request.QueryString("storename")) end if call PageFooter(Request.QueryString("storename")) end sub '********************************************************************************************************* 'calculate_item '********************************************************************************************************* sub calculate_item(order_id) dim i, intPrice dim htmlbody if session("member_email") <> "" then 'modify customer info table design here .... htmlbody = "
" htmlbody = htmlbody & "
" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "
" dim strOrderID ssql = "select order_id from tbl_order order by order_id desc" set order_chk = server.CreateObject("adodb.recordset") order_chk.open ssql,conn,3,3 if not order_chk.EOF then strOrderID = order_chk("order_id") end if order_chk.close set order_chk = nothing htmlbody = htmlbody & "Sales Order : " & strOrderID & "" htmlbody = htmlbody & "
" htmlbody = htmlbody & "Billing & Shipping Info..." htmlbody = htmlbody & "
" htmlbody = htmlbody & "" htmlbody = htmlbody & "Customer Name : " & session("member_name") & "
" htmlbody = htmlbody & "Customer Address : " & session("member_address") & "
" htmlbody = htmlbody & "Tel : " & session("member_phone") & "  " htmlbody = htmlbody & "Email : " & session("member_email") & "
" htmlbody = htmlbody & "
" 'modify item content table header design here .... htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" intPrice = 0 for i = 1 to session("item_no") assign_session i 'modify table content design here .... htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" if session("member_level") = "RESELLER" then htmlbody = htmlbody & "" else htmlbody = htmlbody & "" end if htmlbody = htmlbody & "" if session("member_level") = "RESELLER" then htmlbody = htmlbody & "" else htmlbody = htmlbody & "" end if htmlbody = htmlbody & "" intPrice = intPrice + (session(arr_Order_quantity) * session(arr_Product_Member_price)) next if session("display_shipping_charges") = "on" then 'modify shipping charges design here .... htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" intPrice = intPrice + session("Shipping_Charges") end if 'modify table footer design here .... htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" if session("myMessageStatus") = "on" then 'loading ordering terms .... htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" end if if session("myTermStatus") = "on" then 'loading ordering terms .... htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" htmlbody = htmlbody & "" end if htmlbody = htmlbody & "
NoCodeModelUnit PriceQuantityAmount
" & i & " " & session(arr_Product_code) & " " & session(arr_Product_model) & " " & session(arr_Product_Member_price) & " " & session(arr_Product_Retail_price) & " " & session(arr_Order_quantity) & " " & session(arr_Order_quantity) * session(arr_Product_Member_price) & " " & session(arr_Order_quantity) * session(arr_Product_Retail_price) & "
Shipping Charges " & session("company_currency_format") & " " & session("Shipping_Charges") & "
Total " & session("company_currency_format") & " " & intPrice & "
" htmlbody = htmlbody & "Message  



 
" htmlbody = htmlbody & "Terms & Conditions  



 
" htmlbody = htmlbody & "
" 'send order to administrator dim objCDOSYSMail dim objCDOSYSCon ' Create the e-mail server object Set objCDOSYSMail = Server.CreateObject("CDO.Message") Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration") ' Outgoing SMTP server objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost" objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 2525 objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "web@vanueweb.com" objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "1234" objCDOSYSCon.Fields.Update ' Update the CDOSYS Configuration Set objCDOSYSMail.Configuration = objCDOSYSCon objCDOSYSMail.From = trim(session("member_email")) objCDOSYSMail.To = session("company_email") objCDOSYSMail.Subject = "Sales Order" objCDOSYSMail.HTMLBody = htmlbody objCDOSYSMail.Send 'send receipt to customer objCDOSYSMail.From = session("company_email") objCDOSYSMail.To = trim(session("member_email")) objCDOSYSMail.Subject = "Sales Receipt" objCDOSYSMail.HTMLBody = htmlbody objCDOSYSMail.Send 'Close the server mail object Set objCDOSYSMail = Nothing Set objCDOSYSCon = Nothing session("item_no") = 0 'response.Write "strOrderID : " & strOrderID else call PageHeader(Request.QueryString("storename")) 'show back to main button .... Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "
" Response.Write "" Response.Write " " Response.Write "SORRY" Response.Write "
" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "
" Response.Write "Please login to your account to continue, or register as a new member" Response.Write "
" call MemberRegisterForm(Request.QueryString("storename")) Response.Write "" call MemberLoginForm(Request.QueryString("storename"), "", "view_cart.asp") Response.Write "
" call PageFooter(Request.QueryString("storename")) end if end sub %>