in reply to Should I add shopping cart items to session table or create new table?

How can you 'put a shopping cart in a session'? You need to store the ordered items somewhere, either in a cookie or serverside.

The cookie method is probably the easier one. If people diable cookies on their browser, or they use a browser which doesn't eat cookies, they'll understand they can't order.

Replies are listed 'Best First'.
Re: Advise, Should I...
by powerhouse (Friar) on Mar 23, 2003 at 19:11 UTC
    Well, I can put them in variables....

    $sess_ref->attr("sco_$item_num",$quantity);
    Then to retreive it, do a foreach...
    foreach my $key (keys (%{$sess_ref})) { if ($key =~ /^sco_/) { # ok this is a Shopping Cart Ordered Item, added to the list } }
    Something like that.

    I want to keep everything server side, so I guess I should not use the session to maintain it.

    I guess I'll use a MySQL Table, for that also, that way if the user logs in on another machine, like at work or a friends house, they will be able to continue that order, since it will be by username, instead of session id.

    So, I guess that answers my question ;o)

    thx,
    Richard