Magento – Magento Ajax cart remove items not working in mini cart

addtocartajaxmagento-1.9

I have created the custom ajax cart in magento,in that mini cart is updated without loading the page.But in that remove items link is not working,it is been redirecting to ajaxDelete action url(for eg:

http://dev.magento.com/index.php/checkout/cart/ajaxDelete/id/19/uenc/aHR0cDovL2Rldi5tYWdlbnRvLmNvbS9pbmRleC5waHAvdGVzdC5odG1s/).

Its not showing the confirm box.Code I have used for mini cart in controller is,

$mini_cart              = $this->getLayout()->getBlock('minicart_head');
$response['minicart']   = $mini_cart->toHtml();

in list.phtml I used,

if (jQuery('.header-minicart')){
        jQuery('.header-minicart').html( data.minicart );
        }

Thanks in advance.

Best Answer

This may be form key issue.In ajaxDeleteAction() function,magento is check form key using below code:

   if (!$this->_validateFormKey()) {
        Mage::throwException('Invalid form key');
    }
Related Topic