Date:  03/11/2002 08:00:27 PM Msg ID:  000431
From:  FoxWeb Support Thread:  000423
Subject:  Re: Session variables, table, or array ?
Your analysis is correct, but unfortunately FoxWeb does not support saving arrays as session variables.  This is a feature we are looking at for addition in future version, but for now you will have to use a different method.  One option is to have a single table where you store shopping cart information for everyone:

Fields: OrderID, SessionID, Code, Price

When a user adds an item to their shopping cart you will add a new record to the table and populate the sessionID field with Session.GetSessionID().  The OrderID should be a unique identifier for the cart table, so that you can identify individual records, even if the rest of the fields are identical.

This method is certainly a lot more manageable than having to create and then destroy a separate temporary table for each user session.

FoxWeb Support Team
support@foxweb.com

Sent by Gia Luc on 03/08/2002 02:36:59 AM:
I am evaluating Foxweb to see if it is appropriate for powering an ecommerce site. 

As with most ecommerce sites, there is a need to keep track of items in a shopping cart.  Having read the Foxweb documentation, I can see only three ways of doing this :

Method 1 :
Hold each field of each item in the shopping cart as session variables.  For example, if a customer orders one product and the shopping cart needs to store the product code and the price, the session variables  will be :

CODE1, PRICE1

If a customer orders two products, the session variables will be :

CODE1, PRICE1
CODE2, PRICE2

If a customer orders three products, the session variables will be :

CODE1, PRICE1
CODE2, PRICE2
CODE3, PRICE3

Method 2 :
Hold each field of each item in the shopping cart in a temporary table ( the temporary table could be named after the session ID, so that each table is unique ).

Method 3 :
Hold each field of each item in the shopping cart in an array, and expand the array as the customer orders more products.

Method 1 seems very clumsy, and I suspect the coding will be very difficult.  Method 2 seems capable of dealing with an infinite number of items in the cart, but requires a temporary table to be created and maintained.  Method 3 seems to give the benefits of Method 2, without any of the downsides.

Questions :
a) Am I missing any other methods ?

b) Are my conclusions correct regarding the advantages/disadvantages of each method ?

c) If I were to implement Method 3, how do I go about maintaining a session array ?  The Foxweb documentation gives details about single element session variables ( each variable holds one value ), but says nothing about session arrays ( if there is such a thing ).

d) If Method 3 is out of the question, I would have to use Method 2.  Has anyone tried this ?  Are there any issues that I need to be aware of ?

Many thanks for your replies.

Gia Luc
IT Manager
( Someone who has tried VB, Delphi, ASP, SQL Server, but has always returned to Foxpro )