I have three custom module for best selling, new product and special product.
When I click on add to cart button of these products, it will leads to empty cart page and showing message cart is empty. While in whole site add to cart working fine.
When I disable cache, I am able to add to cart from here. For this I have increased cookie lifetime, gave 777 permission to session folder but nothing helped me.
-
maybe issue in formkeyPrasanta Hatui– Prasanta Hatui2017年02月28日 09:48:42 +00:00Commented Feb 28, 2017 at 9:48
-
form key is same throughout the page @PrasantaHatuiuser00247– user002472017年02月28日 09:53:16 +00:00Commented Feb 28, 2017 at 9:53
-
this either formkey or cookie issue. Compare both the page where works and the page where not works.Prasanta Hatui– Prasanta Hatui2017年02月28日 10:02:09 +00:00Commented Feb 28, 2017 at 10:02
1 Answer 1
try the following code to get the add to cart url. I think the issue is in the add to cart url.
$_productId = '166';
$_product = Mage::getModel('catalog/product')->load($_productId);
$_url = Mage::helper('checkout/cart')->getAddUrl($_product);