Fix popup add to cart
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -5,214 +5,262 @@ Copyright 2013 Kevin Sylvestre
|
||||
1.1.4
|
||||
*/
|
||||
|
||||
;(function () {
|
||||
'use strict'
|
||||
var $,
|
||||
Animation,
|
||||
Growl,
|
||||
__bind = function (fn, me) {
|
||||
return function () {
|
||||
return fn.apply(me, arguments)
|
||||
}
|
||||
}
|
||||
|
||||
(function() {
|
||||
"use strict";
|
||||
var $, Animation, Growl,
|
||||
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
||||
$ = jQuery
|
||||
|
||||
$ = jQuery;
|
||||
Animation = (function () {
|
||||
function Animation() {}
|
||||
|
||||
Animation = (function() {
|
||||
function Animation() {}
|
||||
Animation.transitions = {
|
||||
webkitTransition: 'webkitTransitionEnd',
|
||||
mozTransition: 'mozTransitionEnd',
|
||||
oTransition: 'oTransitionEnd',
|
||||
transition: 'transitionend',
|
||||
}
|
||||
|
||||
Animation.transitions = {
|
||||
"webkitTransition": "webkitTransitionEnd",
|
||||
"mozTransition": "mozTransitionEnd",
|
||||
"oTransition": "oTransitionEnd",
|
||||
"transition": "transitionend"
|
||||
};
|
||||
Animation.transition = function ($el) {
|
||||
var el, result, type, _ref
|
||||
el = $el[0]
|
||||
_ref = this.transitions
|
||||
for (type in _ref) {
|
||||
result = _ref[type]
|
||||
if (el.style[type] != null) {
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Animation.transition = function($el) {
|
||||
var el, result, type, _ref;
|
||||
el = $el[0];
|
||||
_ref = this.transitions;
|
||||
for (type in _ref) {
|
||||
result = _ref[type];
|
||||
if (el.style[type] != null) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
};
|
||||
return Animation
|
||||
})()
|
||||
|
||||
return Animation;
|
||||
Growl = (function () {
|
||||
Growl.settings = {
|
||||
namespace: 'growl',
|
||||
duration: 3200,
|
||||
close: '×',
|
||||
location: 'default',
|
||||
style: 'default',
|
||||
size: 'medium',
|
||||
}
|
||||
|
||||
})();
|
||||
Growl.growl = function (settings) {
|
||||
if (settings == null) {
|
||||
settings = {}
|
||||
}
|
||||
this.initialize()
|
||||
return new Growl(settings)
|
||||
}
|
||||
|
||||
Growl = (function() {
|
||||
Growl.settings = {
|
||||
namespace: 'growl',
|
||||
duration: 3200,
|
||||
close: "×",
|
||||
location: "default",
|
||||
style: "default",
|
||||
size: "medium"
|
||||
};
|
||||
Growl.initialize = function () {
|
||||
return $('body:not(:has(#growls))').append('<div id="growls" />')
|
||||
}
|
||||
|
||||
Growl.growl = function(settings) {
|
||||
if (settings == null) {
|
||||
settings = {};
|
||||
}
|
||||
this.initialize();
|
||||
return new Growl(settings);
|
||||
};
|
||||
function Growl(settings) {
|
||||
if (settings == null) {
|
||||
settings = {}
|
||||
}
|
||||
this.html = __bind(this.html, this)
|
||||
this.$growl = __bind(this.$growl, this)
|
||||
this.$growls = __bind(this.$growls, this)
|
||||
this.animate = __bind(this.animate, this)
|
||||
this.remove = __bind(this.remove, this)
|
||||
this.dismiss = __bind(this.dismiss, this)
|
||||
this.present = __bind(this.present, this)
|
||||
this.close = __bind(this.close, this)
|
||||
this.cycle = __bind(this.cycle, this)
|
||||
this.unbind = __bind(this.unbind, this)
|
||||
this.bind = __bind(this.bind, this)
|
||||
this.render = __bind(this.render, this)
|
||||
this.settings = $.extend({}, Growl.settings, settings)
|
||||
this.$growls().attr('class', this.settings.location)
|
||||
this.render()
|
||||
}
|
||||
|
||||
Growl.initialize = function() {
|
||||
return $("body:not(:has(#growls))").append('<div id="growls" />');
|
||||
};
|
||||
Growl.prototype.render = function () {
|
||||
var $growl
|
||||
$growl = this.$growl()
|
||||
this.$growls().append($growl)
|
||||
this.cycle($growl)
|
||||
}
|
||||
|
||||
function Growl(settings) {
|
||||
if (settings == null) {
|
||||
settings = {};
|
||||
}
|
||||
this.html = __bind(this.html, this);
|
||||
this.$growl = __bind(this.$growl, this);
|
||||
this.$growls = __bind(this.$growls, this);
|
||||
this.animate = __bind(this.animate, this);
|
||||
this.remove = __bind(this.remove, this);
|
||||
this.dismiss = __bind(this.dismiss, this);
|
||||
this.present = __bind(this.present, this);
|
||||
this.close = __bind(this.close, this);
|
||||
this.cycle = __bind(this.cycle, this);
|
||||
this.unbind = __bind(this.unbind, this);
|
||||
this.bind = __bind(this.bind, this);
|
||||
this.render = __bind(this.render, this);
|
||||
this.settings = $.extend({}, Growl.settings, settings);
|
||||
this.$growls().attr('class', this.settings.location);
|
||||
this.render();
|
||||
}
|
||||
Growl.prototype.bind = function ($growl) {
|
||||
if ($growl == null) {
|
||||
$growl = this.$growl()
|
||||
}
|
||||
return $growl
|
||||
.find('.' + this.settings.namespace + '-close')
|
||||
.on('click', this.close)
|
||||
}
|
||||
|
||||
Growl.prototype.render = function() {
|
||||
var $growl;
|
||||
$growl = this.$growl();
|
||||
this.$growls().append($growl);
|
||||
this.cycle($growl);
|
||||
};
|
||||
Growl.prototype.unbind = function ($growl) {
|
||||
if ($growl == null) {
|
||||
$growl = this.$growl()
|
||||
}
|
||||
return $growl
|
||||
.find('.' + (this.settings.namespace - close))
|
||||
.off('click', this.close)
|
||||
}
|
||||
|
||||
Growl.prototype.bind = function($growl) {
|
||||
if ($growl == null) {
|
||||
$growl = this.$growl();
|
||||
}
|
||||
return $growl.find("." + this.settings.namespace + "-close").on("click", this.close);
|
||||
};
|
||||
Growl.prototype.cycle = function ($growl) {
|
||||
if ($growl == null) {
|
||||
$growl = this.$growl()
|
||||
}
|
||||
return $growl
|
||||
.queue(this.present)
|
||||
.delay(this.settings.duration)
|
||||
.queue(this.dismiss)
|
||||
.queue(this.remove)
|
||||
}
|
||||
|
||||
Growl.prototype.unbind = function($growl) {
|
||||
if ($growl == null) {
|
||||
$growl = this.$growl();
|
||||
}
|
||||
return $growl.find("." + (this.settings.namespace - close)).off("click", this.close);
|
||||
};
|
||||
Growl.prototype.close = function (event) {
|
||||
var $growl
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
$growl = this.$growl()
|
||||
return $growl.stop().queue(this.dismiss).queue(this.remove)
|
||||
}
|
||||
|
||||
Growl.prototype.cycle = function($growl) {
|
||||
if ($growl == null) {
|
||||
$growl = this.$growl();
|
||||
}
|
||||
return $growl.queue(this.present).delay(this.settings.duration).queue(this.dismiss).queue(this.remove);
|
||||
};
|
||||
Growl.prototype.present = function (callback) {
|
||||
var $growl
|
||||
$growl = this.$growl()
|
||||
this.bind($growl)
|
||||
return this.animate(
|
||||
$growl,
|
||||
'' + this.settings.namespace + '-incoming',
|
||||
'out',
|
||||
callback
|
||||
)
|
||||
}
|
||||
|
||||
Growl.prototype.close = function(event) {
|
||||
var $growl;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
$growl = this.$growl();
|
||||
return $growl.stop().queue(this.dismiss).queue(this.remove);
|
||||
};
|
||||
Growl.prototype.dismiss = function (callback) {
|
||||
var $growl
|
||||
$growl = this.$growl()
|
||||
this.unbind($growl)
|
||||
return this.animate(
|
||||
$growl,
|
||||
'' + this.settings.namespace + '-outgoing',
|
||||
'in',
|
||||
callback
|
||||
)
|
||||
}
|
||||
|
||||
Growl.prototype.present = function(callback) {
|
||||
var $growl;
|
||||
$growl = this.$growl();
|
||||
this.bind($growl);
|
||||
return this.animate($growl, "" + this.settings.namespace + "-incoming", 'out', callback);
|
||||
};
|
||||
Growl.prototype.remove = function (callback) {
|
||||
this.$growl().remove()
|
||||
return callback()
|
||||
}
|
||||
|
||||
Growl.prototype.dismiss = function(callback) {
|
||||
var $growl;
|
||||
$growl = this.$growl();
|
||||
this.unbind($growl);
|
||||
return this.animate($growl, "" + this.settings.namespace + "-outgoing", 'in', callback);
|
||||
};
|
||||
Growl.prototype.animate = function ($element, name, direction, callback) {
|
||||
var transition
|
||||
if (direction == null) {
|
||||
direction = 'in'
|
||||
}
|
||||
transition = Animation.transition($element)
|
||||
$element[direction === 'in' ? 'removeClass' : 'addClass'](name)
|
||||
$element.offset().position
|
||||
$element[direction === 'in' ? 'addClass' : 'removeClass'](name)
|
||||
if (callback == null) {
|
||||
return
|
||||
}
|
||||
if (transition != null) {
|
||||
$element.one(transition, callback)
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
|
||||
Growl.prototype.remove = function(callback) {
|
||||
this.$growl().remove();
|
||||
return callback();
|
||||
};
|
||||
Growl.prototype.$growls = function () {
|
||||
return this.$_growls != null
|
||||
? this.$_growls
|
||||
: (this.$_growls = $('#growls'))
|
||||
}
|
||||
|
||||
Growl.prototype.animate = function($element, name, direction, callback) {
|
||||
var transition;
|
||||
if (direction == null) {
|
||||
direction = 'in';
|
||||
}
|
||||
transition = Animation.transition($element);
|
||||
$element[direction === 'in' ? 'removeClass' : 'addClass'](name);
|
||||
$element.offset().position;
|
||||
$element[direction === 'in' ? 'addClass' : 'removeClass'](name);
|
||||
if (callback == null) {
|
||||
return;
|
||||
}
|
||||
if (transition != null) {
|
||||
$element.one(transition, callback);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
Growl.prototype.$growl = function () {
|
||||
return this.$_growl != null
|
||||
? this.$_growl
|
||||
: (this.$_growl = $(this.html()))
|
||||
}
|
||||
|
||||
Growl.prototype.$growls = function() {
|
||||
return this.$_growls != null ? this.$_growls : this.$_growls = $('#growls');
|
||||
};
|
||||
Growl.prototype.html = function () {
|
||||
return (
|
||||
"<div class='" +
|
||||
this.settings.namespace +
|
||||
' ' +
|
||||
this.settings.namespace +
|
||||
'-' +
|
||||
this.settings.style +
|
||||
' ' +
|
||||
this.settings.namespace +
|
||||
'-' +
|
||||
this.settings.size +
|
||||
"'>\n <div class='" +
|
||||
this.settings.namespace +
|
||||
"-close'>" +
|
||||
this.settings.close +
|
||||
"</div>\n <div class='" +
|
||||
this.settings.namespace +
|
||||
"-title'>" +
|
||||
this.settings.title +
|
||||
"</div>\n <div class='" +
|
||||
this.settings.namespace +
|
||||
"-message'>" +
|
||||
this.settings.message +
|
||||
'</div>\n</div>'
|
||||
)
|
||||
}
|
||||
|
||||
Growl.prototype.$growl = function() {
|
||||
return this.$_growl != null ? this.$_growl : this.$_growl = $(this.html());
|
||||
};
|
||||
return Growl
|
||||
})()
|
||||
|
||||
Growl.prototype.html = function() {
|
||||
return "<div class='" + this.settings.namespace + " " + this.settings.namespace + "-" + this.settings.style + " " + this.settings.namespace + "-" + this.settings.size + "'>\n <div class='" + this.settings.namespace + "-close'>" + this.settings.close + "</div>\n <div class='" + this.settings.namespace + "-title'>" + this.settings.title + "</div>\n <div class='" + this.settings.namespace + "-message'>" + this.settings.message + "</div>\n</div>";
|
||||
};
|
||||
$.growl = function (options) {
|
||||
if (options == null) {
|
||||
options = {}
|
||||
}
|
||||
return Growl.growl(options)
|
||||
}
|
||||
|
||||
return Growl;
|
||||
$.growl.error = function (options) {
|
||||
var settings
|
||||
if (options == null) {
|
||||
options = {}
|
||||
}
|
||||
settings = {
|
||||
title: 'Error!',
|
||||
style: 'error',
|
||||
}
|
||||
return $.growl($.extend(settings, options))
|
||||
}
|
||||
|
||||
})();
|
||||
$.growl.notice = function (options) {
|
||||
var settings
|
||||
if (options == null) {
|
||||
options = {}
|
||||
}
|
||||
settings = {
|
||||
title: 'Notice!',
|
||||
style: 'notice',
|
||||
}
|
||||
return $.growl($.extend(settings, options))
|
||||
}
|
||||
|
||||
$.growl = function(options) {
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
return Growl.growl(options);
|
||||
};
|
||||
|
||||
$.growl.error = function(options) {
|
||||
var settings;
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
settings = {
|
||||
title: "Error!",
|
||||
style: "error"
|
||||
};
|
||||
return $.growl($.extend(settings, options));
|
||||
};
|
||||
|
||||
$.growl.notice = function(options) {
|
||||
var settings;
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
settings = {
|
||||
title: "Notice!",
|
||||
style: "notice"
|
||||
};
|
||||
return $.growl($.extend(settings, options));
|
||||
};
|
||||
|
||||
$.growl.warning = function(options) {
|
||||
var settings;
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
settings = {
|
||||
title: "Warning!",
|
||||
style: "warning"
|
||||
};
|
||||
return $.growl($.extend(settings, options));
|
||||
};
|
||||
|
||||
}).call(this);
|
||||
$.growl.warning = function (options) {
|
||||
var settings
|
||||
if (options == null) {
|
||||
options = {}
|
||||
}
|
||||
settings = {
|
||||
title: 'Warning!',
|
||||
style: 'warning',
|
||||
}
|
||||
return $.growl($.extend(settings, options))
|
||||
}
|
||||
}).call(this)
|
||||
|
||||
@@ -1,78 +1,81 @@
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
$(document).ready(function(){
|
||||
PdProductAttributesList.initFancyboxOnProductImages();
|
||||
PdProductAttributesList.initTouchSpinOnProductQtyInputs();
|
||||
PdProductAttributesList.initEventAddToCartToButtons();
|
||||
$(document).ready(function () {
|
||||
PdProductAttributesList.initFancyboxOnProductImages()
|
||||
PdProductAttributesList.initTouchSpinOnProductQtyInputs()
|
||||
PdProductAttributesList.initEventAddToCartToButtons()
|
||||
|
||||
$("#pdproductattributeslist table.table").tablesorter({
|
||||
theme : 'default',
|
||||
headerTemplate : '{content} {icon}',
|
||||
widgets : [ "uitheme", "columns" ],
|
||||
});
|
||||
$('#pdproductattributeslist table.table').tablesorter({
|
||||
theme: 'default',
|
||||
headerTemplate: '{content} {icon}',
|
||||
widgets: ['uitheme', 'columns'],
|
||||
})
|
||||
|
||||
prestashop.on('updateProductList', function(params) {
|
||||
if (typeof(params) !== 'undefined') {
|
||||
PdProductAttributesList.initFancyboxOnProductImages();
|
||||
PdProductAttributesList.initTouchSpinOnProductQtyInputs();
|
||||
PdProductAttributesList.initEventAddToCartToButtons();
|
||||
prestashop.on('updateProductList', function (params) {
|
||||
if (typeof params !== 'undefined') {
|
||||
PdProductAttributesList.initFancyboxOnProductImages()
|
||||
PdProductAttributesList.initTouchSpinOnProductQtyInputs()
|
||||
PdProductAttributesList.initEventAddToCartToButtons()
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
let PdProductAttributesList = {
|
||||
initFancyboxOnProductImages(){
|
||||
initFancyboxOnProductImages() {
|
||||
if (!!$.prototype.fancybox) {
|
||||
$('.option_image a.fancybox').fancybox({
|
||||
'hideOnContentClick': true,
|
||||
'openEffect' : 'elastic',
|
||||
'closeEffect' : 'elastic',
|
||||
'helpers' : {
|
||||
overlay: {
|
||||
locked: false
|
||||
}
|
||||
}
|
||||
});
|
||||
hideOnContentClick: true,
|
||||
openEffect: 'elastic',
|
||||
closeEffect: 'elastic',
|
||||
helpers: {
|
||||
overlay: {
|
||||
locked: false,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
initTouchSpinOnProductQtyInputs(){
|
||||
initTouchSpinOnProductQtyInputs() {
|
||||
if (!!$.prototype.TouchSpin) {
|
||||
var max = parseInt($("#pdproductattributeslist input[name='qty']").data('max'));
|
||||
var max = parseInt(
|
||||
$("#pdproductattributeslist input[name='qty']").data('max')
|
||||
)
|
||||
$("#pdproductattributeslist input[name='qty']").TouchSpin({
|
||||
min: 0,
|
||||
max: max,
|
||||
step: 1,
|
||||
decimals: 0,
|
||||
verticalbuttons: true,
|
||||
verticaldownclass: 'fa fa-minus touchspin-down bootstrap-touchspin-down material-icons touchspin-down',
|
||||
verticalupclass: 'fa fa-plus touchspin-up bootstrap-touchspin-up material-icons touchspin-up',
|
||||
verticaldownclass:
|
||||
'fa fa-minus touchspin-down bootstrap-touchspin-down material-icons touchspin-down',
|
||||
verticalupclass:
|
||||
'fa fa-plus touchspin-up bootstrap-touchspin-up material-icons touchspin-up',
|
||||
buttondown_class: 'btn btn-touchspin js-touchspin ',
|
||||
buttonup_class: 'btn btn-touchspin js-touchspin '
|
||||
});
|
||||
buttonup_class: 'btn btn-touchspin js-touchspin ',
|
||||
})
|
||||
|
||||
$("#pdproductattributeslist_grid input[name='qty']").TouchSpin({
|
||||
min: 0,
|
||||
@@ -80,82 +83,145 @@ let PdProductAttributesList = {
|
||||
step: 1,
|
||||
decimals: 0,
|
||||
verticalbuttons: true,
|
||||
verticaldownclass: 'fa fa-minus touchspin-down bootstrap-touchspin-down material-icons touchspin-down',
|
||||
verticalupclass: 'fa fa-plus touchspin-up bootstrap-touchspin-up material-icons touchspin-up',
|
||||
verticaldownclass:
|
||||
'fa fa-minus touchspin-down bootstrap-touchspin-down material-icons touchspin-down',
|
||||
verticalupclass:
|
||||
'fa fa-plus touchspin-up bootstrap-touchspin-up material-icons touchspin-up',
|
||||
buttondown_class: 'btn btn-touchspin js-touchspin ',
|
||||
buttonup_class: 'btn btn-touchspin js-touchspin '
|
||||
});
|
||||
buttonup_class: 'btn btn-touchspin js-touchspin ',
|
||||
})
|
||||
}
|
||||
},
|
||||
executeAddProductsToCart(products) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: pdproductattributeslist_ajax_link,
|
||||
dataType: "json",
|
||||
data: {
|
||||
'action': 'addProductsToCart',
|
||||
'products': products,
|
||||
'secure_key': pdproductattributeslist_secure_key,
|
||||
'ajax': 1
|
||||
},
|
||||
success: function(resp) {
|
||||
if (resp) {
|
||||
prestashop.emit('updateCart', {
|
||||
reason: {
|
||||
cart: []
|
||||
},
|
||||
resp: resp
|
||||
});
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: pdproductattributeslist_ajax_link,
|
||||
dataType: 'json',
|
||||
data: {
|
||||
action: 'addProductsToCart',
|
||||
products: products,
|
||||
secure_key: pdproductattributeslist_secure_key,
|
||||
ajax: 1,
|
||||
},
|
||||
success: function (resp) {
|
||||
if (resp) {
|
||||
prestashop.emit('updateCart', {
|
||||
reason: {
|
||||
cart: [],
|
||||
},
|
||||
resp: resp,
|
||||
})
|
||||
|
||||
Object.entries(resp).forEach(([k, v]) => {
|
||||
if (v.response) {
|
||||
if (v.id_product_attribute > 0) {
|
||||
message_ok = pdproductattributeslist_product + '<b> ' + v.product_name + '</b>, ' + pdproductattributeslist_variant + ' <b> ' + v.combination_name + ' </b>' + pdproductattributeslist_add_ok;
|
||||
$.growl({ title: pdproductattributeslist_title_ok, message: message_ok, duration: 7000});
|
||||
} else {
|
||||
message_ok = pdproductattributeslist_product + '<b> ' + v.product_name + '</b>, ' + pdproductattributeslist_add_ok;
|
||||
$.growl({ title: pdproductattributeslist_title_ok, message: message_ok, duration: 7000});
|
||||
}
|
||||
|
||||
} else if (v.response == false) {
|
||||
if (v.id_product_attribute > 0) {
|
||||
message_error = pdproductattributeslist_product + '<b> ' + v.product_name + '</b>, ' + pdproductattributeslist_variant + ' <b> ' + v.combination_name +'</b>, ' + pdproductattributeslist_max_qty + ' <b>' + v.max_quantity + '</b> ' + pdproductattributeslist_pcs;
|
||||
$.growl.error({ title: pdproductattributeslist_title_error, message: message_error, duration: 15000});
|
||||
} else {
|
||||
message_error = pdproductattributeslist_product + '<b> ' + v.product_name + '</b>, ' + pdproductattributeslist_max_qty + ' <b>' + v.max_quantity + '</b> ' + pdproductattributeslist_pcs;
|
||||
$.growl.error({ title: pdproductattributeslist_title_error, message: message_error, duration: 15000});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
$.growl.error({ title: pdproductattributeslist_title_error, message: pdproductattributeslist_add_error, duration: 15000});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
initEventAddToCartToButtons() {
|
||||
$('body').on('click', 'button.add-to-cart-pdproductattributeslist', function(){
|
||||
var products_array = [];
|
||||
var tr_colection = $(this).parent().parent().parent().find('tr');
|
||||
$(tr_colection).each(function(index) {
|
||||
elem = $(this).find('td.option_gty');
|
||||
qty = parseInt(elem.find('input.quantity').val());
|
||||
if (elem.length > 0 && qty > 0) {
|
||||
var product = {
|
||||
'id_product': parseInt(elem.data('id-product')),
|
||||
'id_product_attribute': parseInt(elem.data('id-product-attribute')),
|
||||
'quantity': qty,
|
||||
'id_customization': 0
|
||||
};
|
||||
products_array.push(product);
|
||||
}
|
||||
});
|
||||
if (products_array.length > 0) {
|
||||
PdProductAttributesList.executeAddProductsToCart(products_array);
|
||||
} else {
|
||||
$.growl.error({ title: pdproductattributeslist_title_error, message: pdproductattributeslist_add_error});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Object.entries(resp).forEach(([k, v]) => {
|
||||
if (v.response) {
|
||||
if (v.id_product_attribute > 0) {
|
||||
message_ok =
|
||||
pdproductattributeslist_product +
|
||||
'<b> ' +
|
||||
v.product_name +
|
||||
'</b>, ' +
|
||||
pdproductattributeslist_variant +
|
||||
' <b> ' +
|
||||
v.combination_name +
|
||||
' </b>' +
|
||||
pdproductattributeslist_add_ok
|
||||
$.growl({
|
||||
title: pdproductattributeslist_title_ok,
|
||||
message: message_ok,
|
||||
duration: 1000,
|
||||
})
|
||||
} else {
|
||||
message_ok =
|
||||
pdproductattributeslist_product +
|
||||
'<b> ' +
|
||||
v.product_name +
|
||||
'</b>, ' +
|
||||
pdproductattributeslist_add_ok
|
||||
$.growl({
|
||||
title: pdproductattributeslist_title_ok,
|
||||
message: message_ok,
|
||||
duration: 1000,
|
||||
})
|
||||
}
|
||||
} else if (v.response == false) {
|
||||
if (v.id_product_attribute > 0) {
|
||||
message_error =
|
||||
pdproductattributeslist_product +
|
||||
'<b> ' +
|
||||
v.product_name +
|
||||
'</b>, ' +
|
||||
pdproductattributeslist_variant +
|
||||
' <b> ' +
|
||||
v.combination_name +
|
||||
'</b>, ' +
|
||||
pdproductattributeslist_max_qty +
|
||||
' <b>' +
|
||||
v.max_quantity +
|
||||
'</b> ' +
|
||||
pdproductattributeslist_pcs
|
||||
$.growl.error({
|
||||
title: pdproductattributeslist_title_error,
|
||||
message: message_error,
|
||||
duration: 1000,
|
||||
})
|
||||
} else {
|
||||
message_error =
|
||||
pdproductattributeslist_product +
|
||||
'<b> ' +
|
||||
v.product_name +
|
||||
'</b>, ' +
|
||||
pdproductattributeslist_max_qty +
|
||||
' <b>' +
|
||||
v.max_quantity +
|
||||
'</b> ' +
|
||||
pdproductattributeslist_pcs
|
||||
$.growl.error({
|
||||
title: pdproductattributeslist_title_error,
|
||||
message: message_error,
|
||||
duration: 1000,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$.growl.error({
|
||||
title: pdproductattributeslist_title_error,
|
||||
message: pdproductattributeslist_add_error,
|
||||
duration: 15000,
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
initEventAddToCartToButtons() {
|
||||
$('body').on(
|
||||
'click',
|
||||
'button.add-to-cart-pdproductattributeslist',
|
||||
function () {
|
||||
var products_array = []
|
||||
var tr_colection = $(this).parent().parent().parent().find('tr')
|
||||
$(tr_colection).each(function (index) {
|
||||
elem = $(this).find('td.option_gty')
|
||||
qty = parseInt(elem.find('input.quantity').val())
|
||||
if (elem.length > 0 && qty > 0) {
|
||||
var product = {
|
||||
id_product: parseInt(elem.data('id-product')),
|
||||
id_product_attribute: parseInt(elem.data('id-product-attribute')),
|
||||
quantity: qty,
|
||||
id_customization: 0,
|
||||
}
|
||||
products_array.push(product)
|
||||
}
|
||||
})
|
||||
if (products_array.length > 0) {
|
||||
PdProductAttributesList.executeAddProductsToCart(products_array)
|
||||
} else {
|
||||
$.growl.error({
|
||||
title: pdproductattributeslist_title_error,
|
||||
message: pdproductattributeslist_add_error,
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
116790
themes/at_movic/assets/cache/bottom-06ccf6904.js
vendored
116790
themes/at_movic/assets/cache/bottom-06ccf6904.js
vendored
File diff suppressed because one or more lines are too long
116078
themes/at_movic/assets/cache/bottom-39e208904.js
vendored
116078
themes/at_movic/assets/cache/bottom-39e208904.js
vendored
File diff suppressed because one or more lines are too long
115950
themes/at_movic/assets/cache/bottom-65fff4904.js
vendored
115950
themes/at_movic/assets/cache/bottom-65fff4904.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
117231
themes/at_movic/assets/cache/bottom-e2a33c904.js
vendored
117231
themes/at_movic/assets/cache/bottom-e2a33c904.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user