Ahhh. Looks as if CartManager answers this question: "Not yet"...
class CartManager(Manager):
def from_request(self, request):
"""
Return a cart by ID stored in the session, updating its last_updated
value and removing old carts. A new cart will be created (but not
persisted in the database) if the session cart is expired or missing.
"""
cart_id = request.session.get("cart", None)
cart = self.current().filter(id=cart_id)
last_updated = now()
# Update timestamp and clear out old carts.
if cart_id and cart.update(last_updated=last_updated):
self.expired().delete()
elif cart_id:
# Cart has expired. Delete the cart id and
# forget what checkout step we were up to.
del request.session["cart"]
try:
del request.session["order"]["step"]
except KeyError:
pass
# This is a cheeky way to save a database call: since Cart only has
# two fields and we know both of their values, we can simply create
# a cart instance without taking a trip to the database via the ORM.
return self.model(id=cart_id, last_updated=last_updated)
def expiry_time(self):
"""
Datetime for expired carts.
"""
return now() - timedelta(minutes=settings.SHOP_CART_EXPIRY_MINUTES)
def current(self):
"""
Unexpired carts.
"""
return self.filter(last_updated__gte=self.expiry_time())
def expired(self):
"""
Expired carts.
"""
return self.filter(last_updated__lt=self.expiry_time())
On Tuesday, July 28, 2015 at 11:44:21 PM UTC-4, Joseph Gallagher wrote:
>
> HI folks,
>
> So, being that Cartridge is the most easily customized and
> functionality-friendly shop framework I've yet seen, hats off !!
>
> I am wondering whether the ability to save a logged-in user's cart upon
> logout (or session timeout) is possible? I have sifted through the DB
> tables, and I see nothing that stores cart statuses for a given user (open,
> closed, frozen or submitted....yes, similar to the way Oscar handles
> carts). In other words, I am logged in and I add a few items to my
> "logged-in" cart. I may begin the checkout process and suddenly logout, or
> I may have to get up for 35 minutes.... Upon logging back in, my cart is
> empty!
>
> Is Cartridge too session-based to deal with this sort of thing? I know I
> can't have the best of all worlds, but if someone else has run into this, I
> am all ears.
>
> Thanks!
>
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.