On Error Resume Next
Response.Buffer = True
Response.Expires = 0
Dim Obj_bag,bag_item,cart
' Obj_bag----Shopping cart
' Bag_item----Product Information data collection
' Cart----Information data collection for a product
Dim p_id,p_name,p_price,p_manu,p_type,p_size,p_color,p_num,p_temp
' P_ID----Product ID number
' P_name----Product Name
' P_price----Original price
' P_manu----commodity manufacturer
' P_type----Product style
' P_size----Product size
' P_color----Product color
' p_num----Number of commodities
' P_temp----temporary storage p_num
if (not IsNumeric (p_num)) or (p_num<= "0") or (InStr (1,p_num, ".") <>0)) Then
P_num=1 ' If the quantity of goods is less than 0 or there are small points, take 1
End If
If P_name <> "" Then
' If you have a shopping cart, prepare to install it.
' If you don't have a shopping cart, create a new Dictionary object
If IsObject (Session ("Bag")) Then ' Update if a shopping cart is available
' Response.Write ' IsObject (Session ("Bag")) = "& IsObject (Session (" Bag ")) &" <br> "
Set Obj_bag=session ("Bag")
If Obj_bag.exists (p_name) Then ' if the item is already in the current cart
If Err Then
Response.Write Err.Description
Err.Clear
End If
' Response.Write IsObject (obj_bag)
P_temp=obj_bag.item (P_name) (6) ' stores P_num value in P_temp
Response.Write "p_num=" & P_num & "<br>"
P_num=cint (P_num) +cint (p_temp) ' quantity of goods purchased is cumulative
Bag_item=array (p_name,p_manu,p_type,p_size,p_color,p_price,p_num,p_id)
Obj_bag.item (P_name) =bag_item
Else
Bag_item=array (p_name,p_manu,p_type,p_size,p_color,p_price,p_num,p_id)
Obj_bag. ADD P_name,bag_item
End If
Else ' no shopping cart to generate new
Set Obj_bag=server. CreateObject ("Scripting.Dictionary")
Bag_item=array (p_name,p_manu,p_type,p_size,p_color,p_price,p_num,p_id)
Response.Write Bag_item (0)
Obj_bag. ADD P_name,bag_item
End If
Set session ("Bag") = Obj_bag ' Update cart
End If
Response.Redirect ("checkbag.asp?obj=" & Request ("obj") & "") ' Turn to show cart page
End If
%>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.