}
return false;
});
+
+ $(document).on('click', '.emptyCart', function () {
+ $.confirm({
+ backgroundDismiss: true,
+ title: 'Empty my cart',
+ content: 'Are you sure you want to empty your cart ?',
+ buttons: {
+ confirm: {
+ text: 'Confirm',
+ btnClass: 'btn-ok',
+ action: function () {
+ $this.emptyCart();
+ },
+ },
+ cancel: function () {
+
+ },
+ }
+ });
+ return false;
+ });
+ },
+
+ emptyCart: function () {
+ this.items = [];
+ this.updateCart();
+ this.save();
+ resize();
},
addToCart: function (ref, quantity) {
},
removeFromCart: function (key) {
- console.log(key);
if (key >= 0) {
this.items.splice(key, 1);
this.save();
content += head;
content += '<tbody>';
$.each(this.getItems(), function (i, ref) {
- if(i%12===0 && i>0){
- content+='<tr class="break">';
- }else {
+ if (i % 12 === 0 && i > 0) {
+ content += '<tr class="break">';
+ } else {
content += '<tr>';
}
$.each(columns, function (k, v) {
content += '</tbody>';
content += '</table>';
content += '<div class="cart-footer">';
- content += '<div class="fonctions"><a href="#" class="exportCartPDF">Export my cart (PDF)</a><a href="#" class="exportCartXLS">Export my cart (XLS)</a></div>';
+ content += '<div class="fonctions"><a href="#" class="emptyCart">Empty my cart</a><a href="#" class="exportCartPDF">Export my cart (PDF)</a><a href="#" class="exportCartXLS">Export my cart (XLS)</a></div>';
content += '</div>';
return content;