New Zenner
- Join Date:
- Oct 2009
- Posts:
- 2
- Plugin Contributions:
- 0
Add to cart button sometimes doesn't work
My problem is, that sometimes if I click on the Add_to_cart button it redirects me to the cart but doesn't add the item to it. This problem can not be reproduced however it happens more often if I press the button really fast (before page load finished). Maybe it happens on slower pc-s more often, but I can reproduce it at least once in 10 add_to_cart actions.
I haven't found the solution in the forum so I've searched it myself and now I write it down, if anybody suffers from the same problem.
So after I click the button the product is added to the shopping_cart in the session and the zen_redirect function in functions_general.php redirects me to the shopping cart. But somehow the session has not enough time to be saved before the call of the redirect function (named header).
If I debug it, I can see that the product is added to the cart before the call of the header, but it is missing from the cart after the session is started on the shopping_cart page.
This session behavior is a known malfunction in php.
I can solve the problem if I put session_regenerate_id(true); before the call of the header function in zen_redirect(). At least it solved the problem for me...
eastwood