hi I am using ajax add to cart module, after I click add to cart, pop up appear that my item has been add to cart, but my cart doesn't update until I refresh the page.
here is my cartcontroller.php code
class AW_Ajaxcartpro_CartController extends Mage_Core_Controller_Front_Action
{
public function removeAction()
{
$response = Mage::getModel('ajaxcartpro/response');
$id = $this->getRequest()->getParam('id');
Mage::getSingleton('checkout/cart')->removeItem($id)->save();
if($this->getRequest()->getParam('is_checkout')) {
$response->setCart(Mage::helper('ajaxcartpro')->renderBigCart());
if(AW_Ajaxcartpro_Helper_Data::RETURN_CARTBAR_ON_BIGCART)
$response->setCartbar(Mage::helper('ajaxcartpro')->renderCart());
} else {
$response->setCart(Mage::helper('ajaxcartpro')->renderCart());
}
$response->setLinks(Mage::helper('ajaxcartpro')->renderTopCartLinkTitle());
$_quote = Mage::getSingleton('checkout/session')->getQuote();
if($_quote && $_quote->getHasError()) $response->setError('quote error');
$response->send();
}
}
where should I edit the code
您的php代码不足以解决问题,此类仅从模型中创建一个html页面,但是要在不刷新页面的情况下更改页面上的购物车,则必须在成功后更新页面元素(至少是购物车) JavaScript DOM响应数据(来自ajax)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.