<% strID = Request("id") strID = killC(strID) if strID <> "" then strID = int(strID) end if strPorL = Request("PorL") strPrimCat = Request("primcat") strSubCat = Request("subcat") if strID = "" then strID = "4" end if if strPorL = "" then strPorL = "1" else strPorL = int(strPorL) end if if strPrimCat = "" then strPrimCat = "0" else strPrimCat = int(strPrimCat) end if if strSubCat = "" then strSubCat = "1" else strSubCat = int(strSubCat) end if if left(strPath, 1) = "p" then strRootPath = "pdetails" else strRootPath = "plists" end if iaction = Request("action") Dim bFoundMatch bFoundMatch = false bProceed = true StrPickOptions = Request.Cookies("gl")("pick") if StrPickOptions = "" then StrPickOptions = "0`0`No pickling or bagging" end if Response.Cookies("gl")("pick") = StrPickOptions if (iaction = "add") then %> <% strSQL = "SELECT * FROM glitems where id=" & strID Set rs = my_conn.Execute(strSQL) strProduct = rs("Name") strPrice = rs("Price") ' StrID strTCode = rs("ITCode") strWeight = rs("Weight") strbHH = rs("HHProduct") strHHPrice = rs("HHPrice") strbSeed = rs("SeedProduct") if strbSeed = "1" then strPickQ = "" strSQL = "SELECT * FROM glitems2 where id=" & strID Set rs2 = my_conn.Execute(strSQL) strPickOpt = rs2("Pick") strPickQ = "" if strPickOpt <> "" then strPickSplit = split(strPickOpt, "|") for i = 0 to ubound(strPickSplit) if isnumeric(strPickSplit(i)) = true then if strPickQ <> "" then strPickQ = strPickQ & " OR ID=" & int(strPickSplit(i)) else strPickQ = " WHERE ID=" & int(strPickSplit(i)) end if end if next ' Now we have all the pickling options for this product so let us add them to the cookie for info strSQL = "SELECT * FROM glpick" & strPickQ Set rs2 = nothing Set rs2 = my_conn.Execute(strSQL) StrPickOptions = Request.Cookies("gl")("pick") ' PICK = ID`PRICE`TEXT`~ID`PRICE`TEXT... ' Check to make sure this pick options does not already exist bPickMatch = false if not rs2.EOF then do while not rs2.EOF strPickID = rs2("ID") bPickMatch = false if StrPickOptions <> "" then strPickSplit = split(strPickOptions, "~") for i = 0 to ubound(strPickSplit) strPickSplitO = split(strPickSplit(i), "`") if ubound(strPickSplitO) > 0 then if int(strPickSplitO(0)) = int(strPickID) then bPickMatch = true end if end if next if bPickMatch = false then ' Add it StrPickOptions = StrPickOptions & "~" & rs2("ID") & "`" & rs2("Price") & "`" & rs2("Descrip") end if else ' Just add it as there is no options at the moment StrPickOptions = "0`0`No pickling or bagging~" & rs2("ID") & "`" & rs2("Price") & "`" & rs2("Descrip") end if rs2.MoveNext 'Next record loop end if end if Response.Cookies("gl")("pick") = StrPickOptions end if 'response.write strpickoptions strInStock = rs("InStock") strWSPrice = rs("WSPrice") StringInStock = strInStock if (isnumeric(strInStock) = false) then strInStock = -1 else strInStock = int(strInStock) if (strInStock < 0) then strInStock = -1 end if end if if strTCode <> "" then bFoundMatch = false spItem = Request.Cookies("gl")("items") if (spItem <> "") then SItems = Split(spItem, "~") NewCookie = "" for Index = 0 to ubound(SItems) ItemData = Split(SItems(Index), "`") ' 0 is Quantity ' 1 is Name ' 2 is Price ' 3 is Location ' 4 is IT Code ' 5 is weight ' 6 is HappyHour Product? 0:No 1:Yes ' 7 is HappyHour Price ' 8 is Seed Product? 0:No 1:Yes ' 9 is InStock if ubound(ItemData) => 9 then if (ItemData(4) = strTCode) then ' DONOT Remove this one bFoundMatch = true end if end if next end if if (bFoundMatch = false) then ' The product doesnt exist so add it ' Now add it to our product cookie strItems = Request.Cookies("gl")("items") if (strPrice = "") then strPrice = 0 end if if strInStock = "-1" or strInStock = "" then bStock = false else bStock = true end if if (strbSeed = "1" or bStock = true) then ' Its seed or a limited stock item ' Now do we have more stock than what they want? if (strInStock >= 1 and strInStock > 0) then bProceed = true else ' We dont have enough, tell them to change the order bProceed = false if strbSeed = "1" then strStringSeed = " Kg's" else strStringSeed = "" end if StrGrain = StrGrain & "
" & strProduct & " x 1 " & strStringSeed & " is unavaliable [ Please call us ] (GL Code: " & strTCode & ")" end if end if if (bProceed = true) then ' 0 is Quantity ' 1 is Name ' 2 is Price ' 3 is Location ' 4 is IT Code ' 5 is weight | Pickling Options ' 6 is HappyHour Product? 0:No 1:Yes ' 7 is HappyHour Price ' 8 is Seed Product? 0:No 1:Yes ' 9 is InStock ' 10 is Wholesale price if (StringInStock = "") then StringInStock = "-1" end if if strbSeed = "1" then StrWeight = strPickOpt end if Response.Cookies("gl")("items") = strItems & "~1`" & strProduct & "`" & strPrice & "`" & strID & "`" & StrTCode & "`" & StrWeight &_ "`" & strbHH & "`" & strHHPrice & "`" & strbSeed & "`" & StringInStock & "`" & strWSPrice end if end if 'response.write("=" & Request.Cookies("gl")("items")) else Response.write("

** Could not add item **

") end if my_conn.close ' Close database connection Set my_conn = nothing 'obj variable released Set rs = nothing elseif (iaction = "delete") then ' Lets cycle through the products and delete the one we dont want spItem = Request.Cookies("gl")("items") strID = Request("id") if isnumeric(strID) = false then strID = int(strID) end if if (spItem <> "") then SItems = Split(spItem, "~") NewCookie = "" for Index = 0 to ubound(SItems) ItemData = Split(SItems(Index), "`") ' 0 is Quantity ' 1 is Name ' 2 is Price ' 3 is Location ' 4 is IT Code ' 5 is weight ' 6 is HappyHour Product? 0:No 1:Yes ' 7 is HappyHour Price ' 8 is Seed Product? 0:No 1:Yes ' 9 is InStock ' 10 is Wholesale price if ubound(ItemData) => 9 then if (ItemData(3) <> StrID) then ' DONOT Remove this one NewCookie = NewCookie & "~" & SItems(Index) end if end if next end if Response.Cookies("gl")("items") = NewCookie elseif (iaction = "update") then ' This is for changing quantities iIndex = 0 StringItem = Request.Form("qty" & iIndex) StringItem = int(StringItem) spItem = Request.Cookies("gl")("items") if (spItem <> "") then SItems = Split(spItem, "~") NewCookie = "" %> <% for Index = 0 to ubound(SItems) if isNumeric(StringItem) = false then StringItem = 1 end if if StringItem <= 0 then StringItem = 1 end if ItemData = Split(SItems(Index), "`") ' 0 is Quantity ' 1 is Name ' 2 is Price ' 3 is Location ' 4 is IT Code ' 5 is weight ' 6 is HappyHour Product? 0:No 1:Yes ' 7 is HappyHour Price ' 8 is Seed Product? 0:No 1:Yes ' 9 is InStock ' 10 is Wholesale price if ubound(ItemData) => 9 then if ItemData(9) = "-1" then bStock = false else bStock = true end if if (ItemData(8) = "1" or bStock = true) then ' Its seed or a limited stock item ' Request the pickling strPickSTRING = Request.Form("pickling" & iIndex) ' So we have pickling value now we need to read it and ajust weight ItemData(5) ' If it has changed then we put the value to the front if strPickSTRING <> "" then strPick = split(StrPickSTRING, ".") strPickNum = strPick(0) strPick = split(ItemData(5), "|") if ubound(strPick) > 0 then ItemData(5) = strPickNum & "|" for m = 0 to ubound(strPick) if strPick(m) <> "" then if int(strPick(m)) <> int(strPickNum) then ItemData(5) = ItemData(5) & strPick(m) & "|" end if end if next end if end if strSQL = "select * from glitems where ID=" & ItemData(3) Set rs2 = my_conn.Execute(strSQL) strInStock = rs2("InStock") strInStock = int(strInStock) if (strInStock < 0) then strInStock = 0 end if ' Now do we have more stock than what they want? if StringItem <= strInStock and strInStock > 0 then else ' We dont have enough, tell them to change the order bProceed = false if ItemData(8) = "1" then strStringSeed = " Kg's" else strStringSeed = "" end if StrGrain = StrGrain & "
" & ItemData(1) & " x " & StringItem & strStringSeed & " is unavaliable [ Please call us ] (GL Code: " & ItemData(4) & ")" StringItem = strInStock end if end if NewCookie = NewCookie & "~" & StringItem & "`" & ItemData(1) & "`" & ItemData(2) & "`" & ItemData(3) & "`" & ItemData(4) & "`" & ItemData(5) &_ "`" & ItemData(6) & "`" & ItemData(7) & "`" & ItemData(8) & "`" & ItemData(9) & "`" & ItemData(10) end if iIndex = iIndex + 1 StringItem = Request.Form("qty" & iIndex) if isNumeric(StringItem) = false then StringItem = 1 else StringItem = int(StringItem) end if next my_conn.close ' Close database connection Set my_conn = nothing 'obj variable released Set rs2 = nothing Response.Cookies("gl")("items") = NewCookie end if end if Set userFile=nothing Set fs=nothing %>

Shopping Cart <% Response.write(" Go Back") ListItems = Request.Cookies("gl")("items") if (ListItems <> "" and bProceed = true) then Response.write(" Proceed to Checkout") end if %>

This is your shopping cart. <% strItems = Request.Cookies("gl")("items") if strItems = "" then Response.write(" It appears abit empty at the moment.
You can easily fix that by adding some products to your cart.") end if %>

When you have finished adding items to your cart,
near the bottom of the cart, Click on "Proceed to Checkout".

Note: The "Checkout" button will only appear when you have added items to your cart.

<% if iaction = "add" and bProceed = false then Response.write("

* Could not add the item to the cart as you are purchasing more seed/items than is in stock!
* Please contact us for futher enquiries regarding this product
") Response.write(StrGrain & "

") elseif iaction = "update" and bProceed = false then Response.write("

* Could not update the cart as you are purchasing more seed/items than is in stock!
* Please contact us for futher enquiries regarding this product
") Response.write(StrGrain & "

") end if %> <% Response.write("
") if (bFoundMatch = true) then Response.write("

* You already have this item in your cart!
* Try changing the quantity and clicking on ""Update Quantity's""

") end if response.write("
" & vbnewline) response.write("" & vbnewline) strItem = Request.Cookies("gl")("items") if (strItem <> "") then ' Now put it all into a table ' Each part has all its prices in parts, each price is seperated by a vbnewline ' INPUTS: ' - StrItem (Products) ' - strDWS (Wholesale prices?) ' - bStatePaid (false | true) ' - bPaidbyCC ' - bPaidHH (Was invoice purchased during HappyHour?) bStatePaid = false bPaidbyCC = false bPaidHH = false %> <% for Index = 0 to ubound(SItems) ItemData = Split(SItems(Index), "`") ' 0 is Quantity ' 1 is Name ' 2 is Price ' 3 is Location ' 4 is IT Code ' 5 is weight ' 6 is HappyHour Product? 0:No 1:Yes ' 7 is HappyHour Price ' 8 is Seed Product? 0:No 1:Yes ' 9 is InStock ' 10 is Wholesale price if ubound(ItemData) >= 9 then Response.write("") Response.write("") Response.write("") Response.write("") Response.write("" & vbnewline) if (ItemData(8) = "1") then ' Add pickling option bFirstPick = false bHadZero = false response.write("") response.write("") iPicklePrice = Round(iPricePerKg * ItemData(0),2) response.write("") end if end if next 'response.write("") response.write("") response.write("") else ' No Items yet response.write("") end if response.write("
Items In Cart
RemoveQuantityItem NamePriceTotal
") if (ItemData(8) = "1") then ' Seed response.write("Kg's ") end if Response.write("
") if (ItemData(6) = "1" and strHappyHour = true) then Response.write(" ") end if strPrice = ArrResult(Index) iTotal = strPrice * ItemData(0) Response.write(ItemData(1) & " $" & Round(strPrice, 2) & " $" & Round(iTotal, 2) & "
Pickling & Bagging:$" & iPricePerKg & " Per/Kg$" & iPicklePrice & "
(Postal Cost: $" & iPostCost & " #) OR Freight Cost: $" & FreightTotal & "
GST: $" & Round((SubTotal / 10), 2) & "
Sub-Total: $" & SubTotal & "

No items in the cart yet

" & vbnewline) %>

* You can update the Quantity and Pickling Options of an item by changing the amount and then clicking "Update Qty's".

<% ' Save Our Cart Information Response.Cookies("gl")("CartItems") = iItems Response.Cookies("gl")("CartTotal") = Round(SubTotal, 2) if (ListItems <> "" and bProceed = true) then Response.write("
") Response.write("
") end if %>