homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

Classic ASP shopping cart help
Classic ASP shopping cart help

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

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)

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)


Can you explain this little?


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

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)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved