%
'Any request to add items to cart?
If request("Submit")="BUY NOW" or request("submit")="Add to Basket" Then
'Validate purchase details
If Trim(request("product"))="" Then
strError=strError & "
You have not selected a pack type.
"
End If
If Trim(request("quantity"))="" Then
strError=strError & "
You have not specified a quantity.
"
ElseIf Not IsNumeric(Trim(request("quantity"))) Then
strError=strError & "
Quantity must be a number.
"
Else
If CDbl(Trim(request("quantity")))<1 Then
strError=strError & "
Quantity must 1 or more.
"
End If
If Cdbl(Trim(request("quantity")))<>Cdbl(CInt(Trim(request("quantity")))) Then
strError=strError & "
Quantity must be a whole number.
"
End If
End If
'Valid purchase details?
If strError="" Then
'Check item is not already in basket
If InStr(session("basket"), Trim(request("product"))) Then
'If Trim(request("product"))="others Purchase 1st Class Postage|-2|0" Then
'do not add duplicate postage refund
'Else
'normal item -increment quantity
StartOfQuantity=InStr(session("basket"), Trim(request("product")))+Len(Trim(request("product")))+1
'StartOfQuantity=len(Trim(request("product")))+1
'EndOfQuantity=Instr(StartOfQuantity, session("basket"), "`")-1
'EndOfQuantity=len(Trim(request("product")))+1
'LenQuantity=EndOfQuantity-StartOfQuantity+1
LenQuantity=1
ExistingQuantity=CInt(Mid(session("basket"), StartOfQuantity, LenQuantity))
NewQuantity=ExistingQuantity+CInt(Trim(request("quantity")))
session("basket")=Replace(session("basket"), Trim(Trim(request("product")) & "|" & ExistingQuantity), Trim(Trim(request("product")) & "|" & NewQuantity)& "|" & Trim(request("reccess")) & "|" & Trim(request("controls")) & "|" & Trim(request("product_image1")) & "|" & Trim(request("slats")) & "|" & CInt(Trim(request("specialone"))) & "|" & CInt(Trim(request("specialtwo"))) & "|" & CInt(Trim(request("specialthree"))) & "|" & Trim(request("finishtype")) & "|" & Trim(request("headrail")) & "|" & Trim(request("oversize")))
' End If
Else
'Add item entry to basket
session("basket")=session("basket") & Trim(request("product")) & "|" & CInt(Trim(request("quantity"))) & "|" & Trim(request("reccess")) & "|" & Trim(request("controls")) & "|" & Trim(request("product_image1")) & "|" & Trim(request("slats")) & "|" & CInt(Trim(request("specialone"))) & "|" & CInt(Trim(request("specialtwo"))) & "|" & CInt(Trim(request("specialthree"))) & "|" & Trim(request("finishtype")) & "|" & Trim(request("headrail")) & "|" & Trim(request("oversize")) & "`"
End If
End If
ElseIf request("checkout")="Checkout" Then
Response.redirect "/checkout.asp"
Else
'Look for any remove requests
For Each Item In Request.Form
If Left(Item,7)="remove_" And Request.Form(Item)="Remove" Then
'Get Product index from button name
ProductIndex=Right(Item, Len(Item)-7)
'Split basket into array
BasketArray=Split(session("basket"), "`", -1, 1)
'construct string to remove
RemoveString=Trim(BasketArray(ProductIndex)) & "`"
Set BasketArray=Nothing
End If
Next
'Have to do removal here as doing it above will alter indexes in basket array
If RemoveString<>"" Then
session("basket")=Replace(session("basket"), RemoveString, "")
End If
End If
'forbid adding of postage refund on its own
'If Left(Trim(session("basket")),39)="others Purchase 1st Class Postage|-2|0|" And Len(Trim(session("basket")))<45 Then
' session("basket")=""
'End If
%>
Your Shopping Basket Powered by PayPal for Blinds Only Suppliers Of Discount Blinds UK Online Commercial and Domestic Vertical Suede Roller blackout venetian Quality Window Coverings located in leicestershire & Nottinghamshire