always persist shopping cart in database?

Discussion on general framework issues.

Moderators: ckosloff, DerManoMann

always persist shopping cart in database?

Postby DerManoMann » Sun Jan 17, 2010 11:14 am

I've got some plans to move away from storing the whole shopping cart in the session as it is done right now.
There is already new code with identical results that *always* saves and loads from the database. RIght now this is done only if a user logs out, I think.
The code does require 2 database reads in return for a much simpler shopping cart class and also removes dependencies from the zen cart class and the strange use of the order class during checkout.
It also would mean that the currently duplicated code to calculate the cart items, prices and totals in the zen cart cart and order class could be avoided.
DerManoMann
Founder
 
Posts: 305
Joined: Wed Oct 21, 2009 8:52 pm
Location: New Zealand

Re: always persist shopping cart in database?

Postby Dayo » Mon Jan 18, 2010 8:22 pm

Wouldn't this impact on the number of db calls?
Dayo
Beginner
 
Posts: 8
Joined: Wed Nov 11, 2009 6:47 pm

Re: always persist shopping cart in database?

Postby DerManoMann » Mon Jan 18, 2010 9:25 pm

Yes, as I pointed out there would be two additional per request. On the other hand the current code does a lot of re-calculations, some of which do database calls (looking up prices, etc.). Seeing that the current ZenMagick code does a lot less calls for the same sort of thing I would expect the total number of calls still to be less than before.
We could still move more stuff into the session later on, perhaps just a bit smarter and more in line with the ZenMagick coding style.
DerManoMann
Founder
 
Posts: 305
Joined: Wed Oct 21, 2009 8:52 pm
Location: New Zealand


Return to Framework

Who is online

Users browsing this forum: No registered users and 1 guest

cron