Welcome to WebmasterWorld Guest from

Forum Moderators: ocean10000

Message Too Old, No Replies

Classic ASP shopping cart help

Classic ASP shopping cart help



9:59 am on Jul 28, 2009 (gmt 0)

5+ Year Member

Hi to all

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?


1:50 pm on Jul 28, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month

The easiest way I can think of is to use a VBscript Class to contain the 4 values, and just store the class in the dictionary.

Class Statement (VBScript) [msdn.microsoft.com]


2:03 pm on Jul 28, 2009 (gmt 0)

5+ Year Member


Can you explain this little?


4:09 pm on Jul 28, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month

Class Customer
Private m_CustomerName
Private m_OrderCount

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."


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.Add "KEY",c

dim samevalue
set samevalue = objDict.Item("KEY")

response.write samevalue.CustomerName
response.write " should be 'Fabrikam, Inc.'"


6:52 am on Jul 29, 2009 (gmt 0)

5+ Year Member

Thanks. Your Idea help me a lot. I am stuck again. I have implemented the same idea, created class with 5 properties. When adding item to the shopping cart, I have added properties to the class object and added to the objDict.

Now how can I access the object in the objDict through for each loop or some other solution.


Featured Threads

Hot Threads This Week

Hot Threads This Month