Posted on 04/10/2017 12:22:18
I've added a picture. (where you choose an installation which is radiobutton triggered)
Radiobutton for the related products aka. installation
<input type="radio" name="installID" value="@related.GetValue("Ecom:Product:Page.ID"), '@related.GetValue("Ecom:Product.ID")', '@related.GetValue("Ecom:Product.Number")'">
The buy button for the main product which we're currently on
<button id="btnBuy" onclick="addToBasket(@GetValue("Ecom:Product:Page.ID"), '@GetValue("Ecom:Product.ID")', '@GetValue("Ecom:Product.Number")', this);" class="btn btn-default" type="button"><i class="fa fa-shopping-cart"></i> KÖP</button>
Add to cart function
function addToBasket(pageId, itemId, produktNumber, domElem) {
$("#buyAlert").modal()
//debugger;
var tempHtml = $(domElem).html();
var workingElement = $(domElem);
workingElement.find('i').removeClass('fa-shopping-cart');
workingElement.html(workingElement.html().replace('Köp', ''));
workingElement.attr('disabled', true);
//Send product info to notification and show notification.
//Close is called from the success callback of updateCart();
var clickedButton = workingElement;
//buyBtnNotification(clickedButton);
$(document).ajaxComplete(function () {
setTimeout(function () {
workingElement.html(tempHtml);
}, 10000);
workingElement.removeAttr('disabled');
workingElement.blur();
// show response from the script.
$(workingElement)
.removeAttr('disabled')
});
// Update the cart
updateCart('/default.aspx?id=' + pageId + '&productid=' + itemId + '&quantity=' + $('#antal_' + produktNumber).val() + '&cartcmd=add', undefined, true, domElem, true);
}
I guess I can't just take the chosen related products value and add it to the onclick function for the buy button?
onclick="addToBasket(@GetValue("Ecom:Product:Page.ID"), '@GetValue("Ecom:Product.ID")', '@GetValue("Ecom:Product.Number")', this); addToBasket(@related.GetValue("Ecom:Product:Page.ID"), '@related.GetValue("Ecom:Product.ID")', '@related.GetValue("Ecom:Product.Number"), this)"