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){
    //alert(data.status + ": " + data.message);
    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>
                        <span class="price">13,74 €</span>
                        <i class="glyphicon glyphicon-triangle-bottom"></i>

Is there any way to make this extension to update my top cart?


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:



| improve this answer | |
  • thank you so much, but if I change this in my top cart is blank now – Robert Sep 15 '16 at 14:37
  • @RobertD check what's the content of data.sidebar ? – Raphael at Digital Pianism Sep 15 '16 at 14:38
  • I talk about minicart from top, that minicart, and in controller of this extension I have this: $toplink = $this->getLayout()->getBlock('top.links')->toHtml(); $sidebar_block = $this->getLayout()->getBlock('cart_sidebar'); – Robert Sep 15 '16 at 14:39
  • @RobertD yeah what do you get in the data response ? – Raphael at Digital Pianism Sep 15 '16 at 14:41
  • what I need to do to see this data response? – Robert Sep 15 '16 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.