remove one js file
This commit is contained in:
parent
54b55fbd6b
commit
b5fc8defed
@ -45,7 +45,7 @@ class Cms_Pack extends Module
|
||||
}
|
||||
|
||||
public function hookdisplayFooter() {
|
||||
$this->context->controller->addJS(($this->_path).'pack.js', 'all');
|
||||
// $this->context->controller->addJS(($this->_path).'pack.js', 'all');
|
||||
return $this->display(__FILE__, 'lightbox_footer.tpl');
|
||||
}
|
||||
|
||||
|
@ -21,4 +21,94 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layer_cart_overlay_pack fancybox-overlay-fixed"></div>
|
||||
<div class="layer_cart_overlay_pack fancybox-overlay-fixed"></div>
|
||||
|
||||
{literal}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#add_pack_right').on('click', function(e){
|
||||
addCmsPackToCart(".checkbox_add_right", ".pack_left");
|
||||
});
|
||||
|
||||
$('#add_pack_bottom').on('click', function(e){
|
||||
addCmsPackToCart(".checkbox_add_bottom", ".pack_bottom");
|
||||
});
|
||||
|
||||
updateInfo(".checkbox_add_right", ".pack_left");
|
||||
$('.checkbox_add_right').on('click', function(e) {
|
||||
updateInfo(".checkbox_add_right", ".pack_left");
|
||||
});
|
||||
$('.quantity_right').on('focusout', function(e) {
|
||||
updateInfo(".checkbox_add_right", ".pack_left");
|
||||
});
|
||||
|
||||
|
||||
updateInfo(".checkbox_add_bottom", ".pack_bottom");
|
||||
$('.checkbox_add_bottom').on('click', function(e) {
|
||||
updateInfo(".checkbox_add_bottom", ".pack_bottom");
|
||||
});
|
||||
$('.quantity_bottom').on('focusout', function(e) {
|
||||
updateInfo(".checkbox_add_bottom", ".pack_bottom");
|
||||
});
|
||||
|
||||
$('#layer_cart_pack .cross, .layer_cart_overlay_pack, #layer_cart_pack .continue.link').on('click',function(){
|
||||
if($('#layer_cart_pack').hasClass('open') == true)
|
||||
$('#layer_cart_pack').removeClass('open');
|
||||
$('.layer_cart_overlay_pack').hide();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
function updateInfo(checkboxes, pack) {
|
||||
var total = 0;
|
||||
$(checkboxes).each(function( index ) {
|
||||
if ($(this).is(':checked')) {
|
||||
var idProduct = $(this).attr('name');
|
||||
var quantity = $(pack+' input[name="quantity_'+idProduct+'"]').val();
|
||||
var price = $(pack+' input[name="quantity_'+idProduct+'"]').data('product-price-nf');
|
||||
total += (parseFloat(quantity)*parseFloat(price));
|
||||
}
|
||||
});
|
||||
$(pack).find('.price_info').children('.price').html(parseFloat(total).toFixed(2) + " €");
|
||||
}
|
||||
|
||||
function addCmsPackToCart(checkboxes, pack) {
|
||||
var addProducts = [];
|
||||
var html = "";
|
||||
var quantity_add = 0;
|
||||
|
||||
var n = parseInt($(window).scrollTop() + 20) + 'px';
|
||||
$('#layer_cart_pack').css({'top': n});
|
||||
|
||||
$(checkboxes).each(function( index ) {
|
||||
if ($(this).is(':checked')) {
|
||||
var idProduct = $(this).attr('name');
|
||||
var quantity = $(pack+' input[name="quantity_'+idProduct+'"]').val();
|
||||
var name = $(pack+' input[name="quantity_'+idProduct+'"]').data('product-name');
|
||||
var img = $(pack+' input[name="quantity_'+idProduct+'"]').data('product-img');
|
||||
var price = $(pack+' input[name="quantity_'+idProduct+'"]').data('product-price');
|
||||
|
||||
if (result = ajaxCart.add(idProduct, null, false, '', quantity, false, true)) {
|
||||
addProducts.push(idProduct);
|
||||
}
|
||||
if(quantity > 0) {
|
||||
html += "<div class='col-xs-12 product-info-container'><div class='product-image-container col-xs-2 col-xxs-12'><img src='"+img+"' class='img-responsive' ></div><div class='product-box col-xs-10 col-xxs-12'><p class='product-name'>"+name+"</p><p class='prices'><span class='product-price'>"+price+"</span></p><p class='product-attributes col-xs-2'>x <span class='nb_quantity'>"+quantity+"</span></p></div></div></div>";
|
||||
quantity_add += + parseInt(quantity);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
ajaxCart.updateInfoCart(quantity_add);
|
||||
|
||||
$('#layer_cart_pack #product-info').html(html);
|
||||
if($('#layer_cart_pack').hasClass('open') == false)
|
||||
$('#layer_cart_pack').addClass('open');
|
||||
$('.layer_cart_overlay_pack').show();
|
||||
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
</script>
|
||||
{/literal}
|
Loading…
Reference in New Issue
Block a user