Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VariationTable Quantity #785

Open
jakmax76 opened this issue Jul 4, 2023 · 1 comment
Open

VariationTable Quantity #785

jakmax76 opened this issue Jul 4, 2023 · 1 comment

Comments

@jakmax76
Copy link

jakmax76 commented Jul 4, 2023

Hi, when i use variation with VariationTable template, i cannot set quantity, it put always 1 item on cart. Is it the right functioning?

This is the addLink url:

https://localhost/shoppingcart/add/SilverShop-Model-Variation-Variation/277?SecurityID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

but add quantity 1 each time

@jakmax76
Copy link
Author

jakmax76 commented Jul 14, 2023

Ok i tried this workaround:

this is my link for each Variation Item

/shoppingcart/setquantity/SilverShop-Model-Variation-Variation/$ID?quantity=&SecurityID=$SecurityID

with jquery i get the quantity input value that i pass to the quantity parameter .

image

$('.link-variation-cart').on('click', function (e){
e.preventDefault(); // Previene il comportamento di default del link

    var quantity = $(this).closest('.link-container').find('.quantity-input').val();

    var href = $(this).attr('href');

    var regEx = /([?&]quantity)=([^#&]*)/g;
    var newurl = href.replace(regEx, '$1='+quantity);

    $(this).attr('href', newurl);

    window.location.href = newurl;

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant