Jump to content

Problem with the Ajax-cart in the "Quick View" window.


Recommended Posts

Hi, I'm looking for help in solving a problem with the Ajax shoping cart in the "Quick VIew" window.

Prestashop version 1.6.1.1

The cart works fine when the "Add to Cart" button pressed from the Product page or Home page of the web site.

However, when I press "Add to Cart" button in the "Quick View" window of the product, it doesn't display a pop-up window with the message "Product succesfully added to your Shopping Cart" and two buttons "Continue Shopping" and "Proceed to Checkout"

Instead, it displays the "Summary" page of the Shopping Cart in the same "Quick View" window (the same width but taller).

I noticed that CSS code attached to the correctly working "Add to Cart" button:

 

<button class="exclusive" name="Submit" type="submit"></button>

 

in the Product page has a portion of ajax-cart.js file attached to it like this:

 

function(e) {
  e.preventDefault();
  ajaxCart.add($('#product_page_product_id').val(), $('#idCombination').val(), true, null, $('#quantity_wanted').val(), null);
}

 

The same "Add to Cart" button in the "Quick View" window doesn't have this .js node.

 

I made some changes to the CSS code of the "Quick View" window page and added the Payment Logos module to it with the custom image in the same format as original

But I didn't touch the .tpi or .php files.

 

Thank you.

Alex

Link to comment
Share on other sites

  • 5 weeks later...

I had the same problem. Restoring the default product.tpl file did not work. The solution was to edit the ajax-cart.js as described below.

 

Edit the ajax-cart.js file ('your theme' > js > modules > blockcart. Around line 141 where it reads for product page 'add' button... comment the if  out. The result should look like this:

 

        //for product page 'add' button...
//        if ($('.cart_block').length) {
            $(document).off('click', '#add_to_cart button').on('click', '#add_to_cart button', function(e){
                e.preventDefault();
                ajaxCart.add($('#product_page_product_id').val(), $('#idCombination').val(), true, null, $('#quantity_wanted').val(), null);
            });
//        }

 

Worked for me.

Edited by pirouzmm (see edit history)
  • Like 1
Link to comment
Share on other sites

I had the same problem. Restoring the default product.tpl file did not work. The solution was to edit the ajax-cart.js as described below.

 

Edit the ajax-cart.js file ('your theme' > js > modules > blockcart. Around line 141 where it reads for product page 'add' button... comment the if  out. The result should look like this:

 

        //for product page 'add' button...

//        if ($('.cart_block').length) {

            $(document).off('click', '#add_to_cart button').on('click', '#add_to_cart button', function(e){

                e.preventDefault();

                ajaxCart.add($('#product_page_product_id').val(), $('#idCombination').val(), true, null, $('#quantity_wanted').val(), null);

            });

//        }

 

Worked for me.

 

Love you bro... It worked. I searched at so many places, but no luck. Thanks a lot. 

but I am surprised how come such a basic bug is still there in prestasho (i am using 1.1.6.2)

Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...