Christopher Dembek
02/18/2021, 4:57 PMSteve Goldberg
02/18/2021, 4:58 PMSteve Goldberg
02/18/2021, 5:01 PMChristopher Dembek
02/18/2021, 7:59 PMSteve Goldberg
02/23/2021, 11:56 AMSteve Goldberg
02/23/2021, 11:57 AMChristopher Dembek
02/24/2021, 4:01 PMintAddOnItemsView.prototype.getEvents = function () {
return {
'click [data-action="add-to-cart"]': 'addToCart'
}
}
intAddOnItemsView.prototype.addToCart = function addToCart(e){
e.preventDefault();
e.stopPropagation();
var self = this,
itemInternalId = this.$(e.target).data('id'),
qty = this.$(e.target).parent().find('#quantity-' + itemInternalId ).val();
this.cart.addLine({
line: {
quantity: qty,
item: {
internalid: itemInternalId
}
}
}).then(
function onSuccess() {
var view = new CartConfirmationView({
application: self.application,
model: LiveOrderModel.getInstance().getLatestAddition()
});
view.showInModal();
},
function onError() {
// console.log('onError', onError);
var layout = self.application.getLayout();
var output_message = Utils.translate(
'Sorry, there is a problem with this Item and can not be purchased at this time. Please check back later.'
);
layout.showErrorInModal(output_message);
}
);
}
Steve Goldberg
02/24/2021, 5:25 PMChristopher Dembek
02/24/2021, 5:30 PMSteve Goldberg
02/24/2021, 5:40 PMSteve Goldberg
02/24/2021, 5:40 PMChristopher Dembek
02/24/2021, 6:02 PMSteve Goldberg
02/24/2021, 6:08 PMSteve Goldberg
02/24/2021, 6:09 PMSteve Goldberg
02/24/2021, 6:09 PMSteve Goldberg
02/24/2021, 6:14 PMvar id_to_find = 'item8046set1555'
container.getComponent('Cart').getLines().then(function (lines){
lines.forEach(function(line) {
if (line.internalid == id_to_find){
console.log(line.item.itemid);
}
})
})
=> "Rishi Jacket-S-PE"
Christopher Dembek
02/24/2021, 7:07 PMSteve Goldberg
02/24/2021, 7:22 PMitemInternalId
value?Steve Goldberg
02/24/2021, 7:23 PM