I want to add add to cart button without reloading the page.
For this I found this Excellence extension. But I have a problem when I add the product in cart, my minicart from top page is not updating. I found this in the code:
success: function(data){
jQuery('#ajax_loader').hide();
//alert(data.status + ": " + data.message);
if(jQuery('.block-cart')){
jQuery('.block-cart').replaceWith(data.sidebar);
}
if(jQuery('.header .links')){
jQuery('.header .links').replaceWith(data.toplink);
}
}
and my HTML output is look like this:
<div class="top-cart-contain">
<div class="mini-cart">
<div class="basket dropdown-toggle" data-toggle="dropdown" data-hover="dropdown">
<a href="http://example.com/checkout/cart/">
<div class="cart-box">
<span class="title">
<i class="glyphicon glyphicon-shopping-cart"></i>
My Cart:
<span>1 prekės</span>
Price:
<span class="price">13,74 €</span>
<i class="glyphicon glyphicon-triangle-bottom"></i>
</span>
</div>
</a>
</div>
</div>
</div>
Is there any way to make this extension to update my top cart?
Best Answer
The jQuery does not find your cart block because the class
.block-cart
is not the right one in your case. I suggest you replace:With: