Closed GoogleCodeExporter closed 9 years ago
I'd suggest just having a cart instance but never actually saving it until an
item
is added to it, either that or never creating and assigning a cart instance
until an
item is added to it [make that before_filter :only => :checkout] or something.
-=r
Original comment by rogerdp...@gmail.com
on 10 Mar 2009 at 2:04
That's how the old code used to work and it was causing massive issues when you
tried
to checkout, then go shop for more items. Removing that method of working is
what
fixed that nasty bug. Re-creating it is not something I'd like to get into.
This should be solved, but in another manner.
Original comment by subim...@gmail.com
on 10 Mar 2009 at 11:02
PS: The current method was chosen to fix bugs - issue 114, issue 111
Original comment by subim...@gmail.com
on 10 Mar 2009 at 11:06
# MAINTENANCE ===============================================================
desc %q\
Hourly maintenance task that should be run on your Substruct site.
Does some housekeeping so the DB is in order.
Remember to pass it the proper RAILS_ENV if running from cron.
\
task :maintain => :environment do
puts "Removing crusty sessions..."
stale = Session.find(:all, :conditions => ["updated_at <= ?", Time.now -
Session::SESSION_TIMEOUT])
stale.each { |s| s.destroy }
puts "Removing carts older than 10 days"
stale_carts = Order.find(:all, :conditions => ["order_status_code_id = ? and
DATE_SUB(curdate(), interval 10 day) > created_on"], 1)
stale_carts.each { |c| c.destroy }
puts "Removing empty carts older than 24 hours"
stale_carts = Order.find(:all, :conditions => ["product_cost = 0 and
order_status_code_id = 1 and DATE_SUB(curdate(), interval 1 d\
ay) > created_on"])
stale_carts.each { |c| c.destroy
end
Original comment by flyfish...@gmail.com
on 7 Oct 2009 at 5:19
FYI, the above method is a bit slow for removing carts. This is a bit better.
# Clear out empty CART orders older than a day
Order.destroy_all(%Q\
order_status_code_id = 1
AND DATE(created_on) < CURRENT_DATE
AND product_code = 0
\)
Original comment by subim...@gmail.com
on 7 Dec 2009 at 1:45
Fixed in r185
Original comment by subim...@gmail.com
on 26 Dec 2009 at 5:58
Fixed for real with r316
Original comment by subim...@gmail.com
on 29 Aug 2010 at 12:17
Original issue reported on code.google.com by
subim...@gmail.com
on 20 Sep 2008 at 12:54