I have been using a fairly simple shopping basket which is created as
follows:

<cfif not isDefined("session.basket")>
        <cfset session.basket = queryNew("product_id, cost, gst,
quantity, saleDate")>

It has worked well for my first couple of customers until I come across
a customer who sells candles, candles have a product id and a colour, so
now I've added colour and my shopping basket looks like:

<cfif not isDefined("session.basket")>
        <cfset session.basket = queryNew("product_id, cost, gst,
quantity, saleDate, colour")>

On the page that shows what has been purchased,  I need to see a
summary,  something like,

5 large candles red       $5
7 large candles green   $7

The code that adds the purchases to the shopping basket only checks
product id not product id and colour, using the listFind function.  Is
there any way I can make listFind check for a product id and a colour?

I dont think that there is a way to make the listFind code check for a
specific productId and a specific colour, so perhaps  I will have to
recode to make my shopping basket a SQL table, then i will be able to do
nice relational queries, may be a bit of work in recoding, but i will do
it if i have to.

If I add a MySQL table called basket. This new basket table would
contain product_id, cost, gst, quantity, saleDate, colour, pluss
sessionId. Now I can use Session.SessionID to set the sessionId in my
new basket table. Next I'm wondering how I can handle the case where the
customer puts a few products into the shopping cart and then times out.
How can I detect the timeout and remove the selected items from the
basket table?

Trying to think this issue through, I wonder if I'm not reinventing the
wheel with my proposed basket table??

I'd be very happy to hear from the good people on the list about what is
the best way to approach this problem.

Cheers.   Paul


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to