How to get cart qty without reload the page. I am using ajax cart module if i add to cart product add into cart but qty not increment if i reload the page only it increment
minicart.phtml
<?php
$_cartQty = $this->getSummaryCount();
if(empty($_cartQty)) {
$_cartQty = 0;
}
?>
<div class="bucket-wrap">
<a href="<?php echo $this->helper('checkout/cart')->getCartUrl(); ?>" data-target-element="#header-cart" class="buket_icon skip-link skip-cart <?php if($_cartQty <= 0): ?> no-count<?php endif; ?>"><img src="<?php echo $this->getSkinUrl('images/bucket.png') ?>"/>
<span><?php echo Mage::getSingleton('checkout/cart')->getSummaryQty(); ?></span></a>
</div>
<span class="arrow-icon hidden"></span>
<div id="header-cart" class="block block-cart skip-content hidden">
<?php echo $this->getChildHtml('minicart_content');?>
</div>
controller
//reload my cart
public function cartAction()
{
$_SERVER['REQUEST_URI'] = str_replace(Mage::getBaseUrl(), '/', $this->_getRefererUrl());
$myCart = Mage::app()->getLayout()->createBlock('checkout/cart_sidebar', 'cart_sidebar')
->setTemplate('checkout/cart/sidebar.phtml');
$this->getResponse()->setBody($myCart->toHtml());
}
//reload top cart
public function mcartAction()
{
$template = Mage::getStoreConfig('amcart/reloading/path');
if(!$template){
$template = "checkout/cart/mini.phtml";
}
$_SERVER['REQUEST_URI'] = str_replace(Mage::getBaseUrl(), '/', $this->_getRefererUrl());
$myCart = Mage::app()->getLayout()->createBlock('checkout/cart_sidebar', 'cart_sidebar')
->setTemplate($template);
$myCart->addItemRender('grouped', 'checkout/cart_item_renderer_grouped', 'checkout/cart/sidebar/default.phtml');
$myCart->addItemRender('configurable', 'checkout/cart_item_renderer_configurable', 'checkout/cart/sidebar/default.phtml');
$html = $myCart->toHtml();
if($html == ""){
$myCart->setTemplate('checkout/cart/sidebar_header.phtml');
$html = $myCart->toHtml();
}
if($html == ""){
$this->loadLayout('default');
$block = Mage::app()->getLayout('default')->getBlock('minicart_head');
if(is_object($block))
$html = $block->toHtml();
}
$this->getResponse()->setBody($html);
}
//reload shoppingcart
public function checkoutAction()
{
$_SERVER['REQUEST_URI'] = str_replace(Mage::getBaseUrl(), '/', $this->_getRefererUrl());
$this->loadLayout(array('checkout_cart_index'));
$myCart = Mage::app()->getLayout('checkout_cart_index')->getBlock('checkout.cart');
$this->getResponse()->setBody($myCart->toHtml());
}
//reload minicart
public function minicartAction()
{
$_SERVER['REQUEST_URI'] = str_replace(Mage::getBaseUrl(), '/', $this->_getRefererUrl());
$myCart = Mage::app()->getLayout()->createBlock('checkout/cart_sidebar', 'cart_sidebar')
->setTemplate('amasty/amcart/checkout/cart/mini_cart.phtml');
$this->getResponse()->setBody($myCart->toHtml());
}
//reload count
public function dataAction()
{
$block = Mage::app()->getLayout()->createBlock('amcart/config', 'amcart.config');
if (Mage::getSingleton('checkout/cart')->getSummaryQty() == 1){
$html = $this->__('There is') .' <a href="'.$block->getUrl('checkout/cart').'" id="am-a-count">1' . $this->__(' item') . '</a> '.$this->__('in your cart.');
}
else{
$html = $this->__('There are') .' <a href="'.$block->getUrl('checkout/cart').'" id="am-a-count">'.Mage::getSingleton('checkout/cart')->getSummaryQty(). $this->__(' items') . '</a> '. $this->__('in your cart.');
}
$cart = Mage::getSingleton('checkout/cart');
$priceHtml = Mage::helper('checkout')->formatPrice($this->getSubtotal($cart));
if ($_subtotalInclTax = $this->getSubtotalInclTax($cart)){
$priceHtml .= '<br />(' . Mage::helper('checkout')->formatPrice($_subtotalInclTax) .' ' . Mage::helper('tax')->getIncExcText(true). ')';
}
$result = array(
'count' => $html,
'price' => $priceHtml
);
$this->getResponse()->setBody(Zend_Json::encode($result));
}
//creating finale popup
private function addToCartResponse($product, $cart, $IsProductView, $params, $text){
$result = array(
'title' => $this->__('Information'),
'message' => '<p>' . $this->__('You have added product to cart.') . '</p>',
'b1_name' => $this->__('View cart'),
'b2_name' => $this->__('Continue'),
'count' => Mage::getSingleton('checkout/cart')->getSummaryQty()>1?' (' . Mage::getSingleton('checkout/cart')->getSummaryQty(). $this->__(' items)'):' (' . Mage::getSingleton('checkout/cart')->getSummaryQty(). $this->__(' item)'),
'b1_action' => 'document.location = "'.Mage::helper('checkout/cart')->getCartUrl().'";',
'b2_action' => 'jQuery.confirm.hide();',
'is_add_to_cart' => '1'
);
Problem is min cart is not reloading