|
|
|
@ -66,89 +66,89 @@ $(document).ready(function () { |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$('.product-min-thumbnails a').each(function(){ |
|
|
|
$('.product-min-thumbnails a').each(function(){ |
|
|
|
var link = $(this); |
|
|
|
var link = $(this); |
|
|
|
link.on('click', function(){ |
|
|
|
link.on('click', function(){ |
|
|
|
$('.product-big-thumbnail img').prop('src', link.prop('href')); |
|
|
|
$('.product-big-thumbnail img').prop('src', link.prop('href')); |
|
|
|
$('.product-big-thumbnail-container').trigger('zoom.destroy'); |
|
|
|
$('.product-big-thumbnail-container').trigger('zoom.destroy'); |
|
|
|
$('.product-big-thumbnail-container').zoom({url: link.attr("data-big-url")}); |
|
|
|
$('.product-big-thumbnail-container').zoom({url: link.attr("data-big-url")}); |
|
|
|
//$('a#product-big-image-url').prop('href', link.attr('data-big-url'))
|
|
|
|
//$('a#product-big-image-url').prop('href', link.attr('data-big-url'))
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
}) |
|
|
|
}) |
|
|
|
}); |
|
|
|
}); |
|
|
|
$('.product-big-thumbnail-container').zoom({url: $('#product-big-image-url').prop("href")}); |
|
|
|
$('.product-big-thumbnail-container').zoom({url: $('#product-big-image-url').prop("href")}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function create_cart_add_link(product_pk, count){ |
|
|
|
function create_cart_add_link(product_pk, count){ |
|
|
|
return $.param.querystring('/store/cart/add/', 'pk=' + product_pk + '&count=' + count + '&next=' + window.location.pathname); |
|
|
|
return $.param.querystring('/store/cart/add/', 'pk=' + product_pk + '&count=' + count + '&next=' + window.location.pathname); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function selectVariation(value, index){ |
|
|
|
function selectVariation(value, index){ |
|
|
|
var price = $('.product-variations-selecter option[value=' + value + ']').attr('data-price'); |
|
|
|
var price = $('.product-variations-selecter option[value=' + value + ']').attr('data-price'); |
|
|
|
var in_stock = $('.product-variations-selecter option[value=' + value + ']').attr('data-count'); |
|
|
|
var in_stock = $('.product-variations-selecter option[value=' + value + ']').attr('data-count'); |
|
|
|
$('.product-detail-price-span').html(price); |
|
|
|
$('.product-detail-price-span').html(price); |
|
|
|
if (in_stock > 0){ |
|
|
|
if (in_stock > 0){ |
|
|
|
$(".product-count-selecter").selecter('destroy'); |
|
|
|
$(".product-count-selecter").selecter('destroy'); |
|
|
|
$('.product-in-stock').show(); |
|
|
|
$('.product-in-stock').show(); |
|
|
|
$('.product-not-in-stock').hide(); |
|
|
|
$('.product-not-in-stock').hide(); |
|
|
|
$('.product-count-selecter').html(''); |
|
|
|
$('.product-count-selecter').html(''); |
|
|
|
for (i=0; i<in_stock; i++){ |
|
|
|
for (i=0; i<in_stock; i++){ |
|
|
|
var option = $('<option/>'); |
|
|
|
var option = $('<option/>'); |
|
|
|
option.attr({ 'value': i+1 }).text((i+1) + ' шт.'); |
|
|
|
option.attr({ 'value': i+1 }).text((i+1) + ' шт.'); |
|
|
|
$('.product-count-selecter').append(option); |
|
|
|
$('.product-count-selecter').append(option); |
|
|
|
} |
|
|
|
|
|
|
|
$(".product-count-selecter").selecter({ |
|
|
|
|
|
|
|
callback: selectCount |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
selectCount(1, index); |
|
|
|
|
|
|
|
$('#product-add-to-cart-link').prop('href', |
|
|
|
|
|
|
|
create_cart_add_link($('.product-variations-selecter').val(), |
|
|
|
|
|
|
|
$('.product-count-selecter').val())); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
$('.product-count-selecter').selecter('destroy'); |
|
|
|
|
|
|
|
$('.product-in-stock').hide(); |
|
|
|
|
|
|
|
$('.product-not-in-stock').show(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$(".product-count-selecter").selecter({ |
|
|
|
|
|
|
|
callback: selectCount |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
selectCount(1, index); |
|
|
|
|
|
|
|
$('#product-add-to-cart-link').prop('href', |
|
|
|
|
|
|
|
create_cart_add_link($('.product-variations-selecter').val(), |
|
|
|
|
|
|
|
$('.product-count-selecter').val())); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
$('.product-count-selecter').selecter('destroy'); |
|
|
|
|
|
|
|
$('.product-in-stock').hide(); |
|
|
|
|
|
|
|
$('.product-not-in-stock').show(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$(".product-variations-selecter").selecter({ |
|
|
|
} |
|
|
|
callback: selectVariation |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function selectCount(value, index){ |
|
|
|
$(".product-variations-selecter").selecter({ |
|
|
|
var price = parseInt($('.product-detail-price-span').html()); |
|
|
|
callback: selectVariation |
|
|
|
$('.itogo-span').html(price*value); |
|
|
|
}); |
|
|
|
$('#product-add-to-cart-link').prop('href', |
|
|
|
|
|
|
|
create_cart_add_link($('.product-variations-selecter').val(), |
|
|
|
|
|
|
|
$('.product-count-selecter').val())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(".product-count-selecter").selecter({ |
|
|
|
function selectCount(value, index){ |
|
|
|
callback: selectCount |
|
|
|
var price = parseInt($('.product-detail-price-span').html()); |
|
|
|
}); |
|
|
|
$('.itogo-span').html(price*value); |
|
|
|
|
|
|
|
$('#product-add-to-cart-link').prop('href', |
|
|
|
|
|
|
|
create_cart_add_link($('.product-variations-selecter').val(), |
|
|
|
|
|
|
|
$('.product-count-selecter').val())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(".product-count-selecter").selecter({ |
|
|
|
|
|
|
|
callback: selectCount |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($('.product-count-selecter option').size() < 1){ |
|
|
|
|
|
|
|
$('.product-in-stock').hide(); |
|
|
|
|
|
|
|
$('.product-not-in-stock').show(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
if ($('.product-count-selecter option').size() < 1){ |
|
|
|
$(".product-count-selecter").selecter(); |
|
|
|
$('.product-in-stock').hide(); |
|
|
|
} |
|
|
|
$('.product-not-in-stock').show(); |
|
|
|
|
|
|
|
|
|
|
|
$('ul.messages li').each(function(){ |
|
|
|
}else{ |
|
|
|
var li = $(this); |
|
|
|
$(".product-count-selecter").selecter(); |
|
|
|
var messageType = li.attr('data-type'); |
|
|
|
} |
|
|
|
swal({ |
|
|
|
|
|
|
|
html: true, |
|
|
|
$('ul.messages li').each(function(){ |
|
|
|
type: messageType, |
|
|
|
var li = $(this); |
|
|
|
title: "OK!", |
|
|
|
var messageType = li.attr('data-type'); |
|
|
|
text: li.html() |
|
|
|
swal({ |
|
|
|
|
|
|
|
html: true, |
|
|
|
|
|
|
|
type: messageType, |
|
|
|
|
|
|
|
title: "OK!", |
|
|
|
|
|
|
|
text: li.html() |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|