silvershop-core
silvershop-core copied to clipboard
VariationTable Quantity
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
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 .
$('.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;
});