Jump to content

QUICK POLL: Cart data: keep in $_SESSION variable or stick in a table?


marmite

Recommended Posts

$_SESSION

 

the way i set mine up... was like this...

 

$_SESSION[cart][]=array(id=>'product id#',quanity=>'#',colours=>'red|white(for example)',special=>'text');

 

but thats just me...

 

then i have my functions to get all my other importants... weight, # in stock,etc...

Link to comment
Share on other sites

well... all the product information comes from the database... and honestly... i REALLY wouldnt want to clean up a database after everybody for those of you out there who look at a page, add stuff to your cart, then close the window(you know who you are)...

 

but i keep all the non static stuff active in the $_SESSION[cart], so you know exactly what their getting...

 

product id -> so you know what they are getting... can access that product, so you have all the static stuff(price, weight, amount in stock, etc...)

quantity -> so you know how many their getting(if set to 0, removes from cart)

colours -> so you know what colour they want(depending on availability)

specials -> if they want any thing special done with the order

 

therefore... the only thing thats in there besides customary stuff... is `id`... which again, allows you to access the product, then apply their custom stuff :-)

Link to comment
Share on other sites

Yes there are people out there who look at the Jaguar and Ferrari and don't continue the transaction. but if you have a field in the table completed Y/N you can periodicaly kill thiss off. Session A dog is for life. A session variable for 20 mins.

 

Desmond.

 

 

Link to comment
Share on other sites

you can set sessions to last far longer then 20 min... i've left mine for days, and returned and it was still active... sessions are great, because your storing it on the server... and is near unhackable(if done right)...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.