Forum Moderators: open
I'm working on classic ASP site and I have to add Shopping Cart functionality to it.
I have to add up to 5 values in to the Shopping Cart item.
How can I do this. I need some Idea like Scripting.Dictionary objects. As Scripting.Dictionary is able to store only pair per item. My cart have four custom fields.
Please help?
Class Statement (VBScript) [msdn.microsoft.com]
Private Sub Class_Initialize
m_CustomerName = ""
m_OrderCount = 0
End Sub
' CustomerName property.
Public Property Get CustomerName
CustomerName = m_CustomerName
End Property
Public Property Let CustomerName(custname)
m_CustomerName = custname
End Property
' OrderCount property (read only).
Public Property Get OrderCount
OrderCount = m_OrderCount
End Property
' Methods.
Public Sub IncreaseOrders(valuetoincrease)
m_OrderCount = m_OrderCount + valuetoincrease
End Sub
End Class
Dim c
Set c = New Customer
c.CustomerName = "Fabrikam, Inc."
c.IncreaseOrders(5)
c.IncreaseOrders(3)
Set objDict=CreateObject("Scripting.Dictionary")
'default comparison is binary mode with is CaSe SenSiTive
'You can only change the CompareMode property while the Dictionary object has no keys
objDict.CompareMode=vbTextCompare
objDict.Add "KEY",c
dim samevalue
set samevalue = objDict.Item("KEY")
response.write samevalue.CustomerName
response.write " should be 'Fabrikam, Inc.'"
</sample>
Now how can I access the object in the objDict through for each loop or some other solution.