I have a session based shippong cart which is updated via an AJAX call. In my IDE (PHpED) it works fine, but in production it fails when I try to add another item to the cart and it fails on this line ... if (isset($_SESSION['cart'][$id])) {do something} All it is doing is saying if the part is already in the cart then update the qty else add the new part.
All .php files start with session_start()
Error msg: Fatal error: Cannot use object of type ShoppingCart as array in /home/grahamsi/public_html/test/oas/includes/class_shopping_cart.php on line 47
The session should end up with $_SESSION['cart']['partnumber1'].id or .price or .name or .qty in it.
I don't want to store the cart in MySQL. I do store the cart in a cookie and I suppose I could update the cookie after every cart transaction and reload the cookie before each transaction but should I have to?
Many thanks for any help provided.
Failing session based cart using AJAX to update
Moderator: General Moderators