CodeIgniter Forums
[SOLVED] losing cart contents - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: [SOLVED] losing cart contents (/showthread.php?tid=43616)



[SOLVED] losing cart contents - El Forum - 07-18-2011

[eluser]Ray G[/eluser]
I am using the cart class and session and have set up the sessions to be stored in mysql database. I am autoloading the cart class. All the code seems to work fine until I send the cart to the checkout controller and all my userdata gets erased in the database. I am also using ajax call and jquery to add and update the cart. Right now I have just renamed the main controller(pnp) to chout and took out a few things just to test here is the code I have so far. Also I have not finished some of the code for the processing of the checkout, so please disregard some of that.

Controller pnp.php
http://pastebin.com/NRCybd9t

View home.php
http://pastebin.com/paXnJFkn

View cart.php
http://pastebin.com/XtxDmyA1

Controller chout.php
http://pastebin.com/47ZS5wPc

View checkout.php
http://pastebin.com/L2MDhKQn

View chcart.php
http://pastebin.com/Mzvz4DnZ

I pasted everything here just for reference but I guess my real question is, why am I losing my session data when I go to a new controller??

Thanks for the help

Ray


[SOLVED] losing cart contents - El Forum - 07-18-2011

[eluser]Ray G[/eluser]
OK I'm an idiot. Seems it was the button to submit to checkout. I had applied the same class I did for the empty cart button. Well I guess this is an issue with the ajax call. It looks for the empty button class in order to empty the cart, so while I was submitting the cart for checkout it was emptying the cart at the same time.

Sorry to waste any ones time

Ray