Jump to content

how add class 'added' on button click in product list


alano3city

Recommended Posts

hi everyone, just a simple question.

 

how can i apply class "added" to button add to cart on click? (ps. 1.6)

 

i try this snippet in global.js but cant get it work...

 

    $(document).on('click', '.ajax_add_to_cart_button', function(){
            $(this).removeClass('added');
            $(this).addClass('added');
    });
 

Edited by alano3city (see edit history)
Link to comment
Share on other sites

I see that this works everywhere, but doesnt want to work only if i click this button :)

 

for example:

 

    $(document).on('click', 'input', function(e){
        $('.ajax_add_to_cart_button').addClass('added');
    });

 

when i click on any input it adds this class to the button, but on the button add to cart itself, does not :o

Edited by alano3city (see edit history)
Link to comment
Share on other sites

This would be a good feature to have... maybe in the PS 1.7 ?

 

but I think it would need to check the current cart for the products, then we could overlay, for example, "3 of these in cart"  on that product.

 

Just adding the class via ajax, surely you would loose that class if you change category and came back to the same category.. or refresh the page ?

Link to comment
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
×
×
  • Create New...