1

When a user checks out, the quote is becoming null, and the ID becomes 0.

This is causing a problem because the next time I'm calling

cart = Mage::getSingleton('checkout/cart');

and using the cart object to add a product to the cart, it's not saving after I call cart->save(). What's weird is, the second time that I call the url to add the cart, it actually saves correctly. How can I properly initialize the cart if the quote is null so that it saves properly from the first time I try to add a product?

2

Have you tried init?

$cart = Mage::getSingleton('checkout/cart');
$cart->init();
| improve this answer | |
  • I have, yes. It had no effect.. – Pat Nov 19 '15 at 7:58
  • Seems to work. I had to clean previous carts for that to work. Thank you. – Pat Dec 2 '15 at 11:30
  • Mage::getSingleton('checkout/cart')->save() work for me :) – Alex Jul 19 '16 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.