silvershop-core icon indicating copy to clipboard operation
silvershop-core copied to clipboard

VariationTable Quantity

Open jakmax76 opened this issue 1 year ago • 1 comments

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 avatar Jul 04 '23 17:07 jakmax76

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;

});

jakmax76 avatar Jul 14 '23 15:07 jakmax76