When I add something to the cart, the session can be seen immediately afterwards. Once I am redirected to the cart view. The session is gone.
The stranger thing though, if I add something to the cart again, it updates the correct quantity... so obviously its still there.
I do not understand.
I am using CakePHP 1.3. I have a controller called CartsController
with 2 views add
and index
. The add
view expects a parameter of the id to add to cart. So when you go to carts/add/1
it adds product id 1 to the cart ($_SESSION) and then redirects you to the index view (/carts).
If you view the SESSION immediately after its added in the add() function before redirecting to the index view, it has the proper values in it. By the time you reach the index view, the session is empty again (well it has the default Cake Config value but nothing I added).
This would lead you to believe that somewhere in between when it gets added and after it gets redirected the session is being destroyed. But this is not true because if you added the item to the cart again, and view it directly afterwards again, it will show a higher quantity (2 now instead of 1, then 3 then 4 and so forth.) Yet if you view the session somewhere else, its not there.
Does anyone have any idea at all what could be happening here?
Update
I wanted to add, it DOES work as intended the first time you add something to the cart in your browser, but if you leave the site (via external link) with something in your cart and come back, there is nothing in your cart, and nothing can be added again -- thats when the problems outlined above start. This is happening in Chrome, FF, IE.
Update2
If you want to see for yourself, steps to reproduce
- Go to http://216.119.150.158/john/products/1/simon-g-ring
- Click add to cart
- Click the Google Checkout button
- Click the Edit order link to return the previous page (not back button)
Your cart is now empty and you can't add anything to cart again