After upgrading Magento 1.7.0 to 1.8.0 (or 1.8.1.0. for that matter) I've noticed that the add to cart function on the product details page and the categorie overview page were no longer working. When clicking on the add to cart button the cart is loading properly but is stating: "You have no items in your shopping cart."
Because this function is rather important for a webshop we took this problem very seriously.
While searching for an answer I've noticed that the problem could be related to formkeys. To solve the problem with the product details page we added a line of PHP-code to yourtemplate/template/catalog/product/view.phtml right after the form opening tag.
After line (42):
<form action="<?php echo $this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>:
Add:
<?php echo $this->getBlockHtml('formkey'); ?>
After solving this there only remains two questions.
- The add to cart buttons on the categorie pages are still not working. How can we fix this?
- How does it come that upgrading to Magento 1.8.0 or 1.8.1.0. is producing this kind of errors? Does any one else know what this problem is? Even the base/default theme is having this problem.