Jump to content

[SOLVED] live add to cart functionality


Radu
 Share

Recommended Posts

I developed an ajax based pagination, however, when pressing add to cart the ajax functionality of add to cart does no longer work.

jquery has an live function, but do you have experience of how to use it to make add to cart work correctly?

because jquery is old I already installed the live plugin


Thank you!

Share this post


Link to post
Share on other sites

  • 4 weeks later...

I come back with the solution

1.) because the old version of jquery you need to install livequery plugin, basically place jquery.livequery.js in your header
2.) in modules/blockcart/ajax-cart.js
change

       $('.ajax_add_to_cart_button').unbind('click').click(function(){
           var idProduct =  $(this).attr('rel').replace('ajax_id_product_', '');
           ajaxCart.add(idProduct, null, false, this);
           return false;
       });


to

       $('.ajax_add_to_cart_button').livequery(function() {
           $(this).unbind('click').click(function(){
               var idProduct =  $(this).attr('rel').replace('ajax_id_product_', '');
               ajaxCart.add(idProduct, null, false, this);
               return false;
           });
       });



that's it!

Share this post


Link to post
Share on other sites

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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More