|
|
|
@ -11,40 +11,40 @@ jQuery(document).ready(function ($) { |
|
|
|
|
}) |
|
|
|
|
// END OVERLAY
|
|
|
|
|
|
|
|
|
|
$('.product__main').on('click', '.state__button', function(evt) { |
|
|
|
|
evt.preventDefault(); |
|
|
|
|
let product = $(this).closest('.product__item'); |
|
|
|
|
let price = $(this).data('product_price'); |
|
|
|
|
let id = $(this).data('product_id'); |
|
|
|
|
let qty = product.find('.counter__input').val(); |
|
|
|
|
product.find('.product-item-overlay__price').html(price * qty + ' '); |
|
|
|
|
product.find('.select__state').data('product_price', price).data('product_id', id).val($(this).text().trim()); |
|
|
|
|
product.find('.state__block').removeClass('expanded').css('height', '0'); |
|
|
|
|
|
|
|
|
|
product.find('.add_to_cart_button').detach(); |
|
|
|
|
product.find('.product-item-overlay__button').prepend('<a href="?add-to-cart=' + id + '" data-quantity="' + qty +'" class="ajax_add_to_cart add_to_cart_button button button--gradient button--base button--100-perc" data-product_id="'+id+'">Добавить в корзину</a>'); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
$('.product__main').on('click', '.counter__button', function(evt) { |
|
|
|
|
evt.preventDefault(); |
|
|
|
|
let product = $(this).closest('.product__item'); |
|
|
|
|
let price = parseFloat(product.find('.select__state').data('product_price')); |
|
|
|
|
|
|
|
|
|
if (!price){ |
|
|
|
|
price = parseFloat(product.find('.product-item__price p').html()); |
|
|
|
|
} |
|
|
|
|
let qty = product.find('.counter__input'); |
|
|
|
|
// $('.product__main').on('click', '.state__button', function(evt) {
|
|
|
|
|
// evt.preventDefault();
|
|
|
|
|
// let product = $(this).closest('.product__item');
|
|
|
|
|
// let price = $(this).data('product_price');
|
|
|
|
|
// let id = $(this).data('product_id');
|
|
|
|
|
// let qty = product.find('.counter__input').val();
|
|
|
|
|
// product.find('.product-item-overlay__price').html(price * qty + ' ');
|
|
|
|
|
// product.find('.select__state').data('product_price', price).data('product_id', id).val($(this).text().trim());
|
|
|
|
|
// product.find('.state__block').removeClass('expanded').css('height', '0');
|
|
|
|
|
|
|
|
|
|
// product.find('.add_to_cart_button').detach();
|
|
|
|
|
// product.find('.product-item-overlay__button').prepend('<a href="?add-to-cart=' + id + '" data-quantity="' + qty +'" class="ajax_add_to_cart add_to_cart_button button button--gradient button--base button--100-perc" data-product_id="'+id+'">Добавить в корзину</a>');
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
// $('.product__main').on('click', '.counter__button', function(evt) {
|
|
|
|
|
// evt.preventDefault();
|
|
|
|
|
// let product = $(this).closest('.product__item');
|
|
|
|
|
// let price = parseFloat(product.find('.select__state').data('product_price'));
|
|
|
|
|
|
|
|
|
|
// if (!price){
|
|
|
|
|
// price = parseFloat(product.find('.product-item__price p').html());
|
|
|
|
|
// }
|
|
|
|
|
// let qty = product.find('.counter__input');
|
|
|
|
|
|
|
|
|
|
if ($(this).hasClass('minus') && parseInt(qty.val()) >= 2) { |
|
|
|
|
qty.val(parseInt(qty.val()) - 1); |
|
|
|
|
} else { |
|
|
|
|
if ($(this).hasClass('plus')) { |
|
|
|
|
qty.val(parseInt(qty.val()) + 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
product.find('.product-item-overlay__button a').attr('data-quantity', qty.val()) |
|
|
|
|
product.find('.product-item-overlay__price').html(price * qty.val() + ' '); |
|
|
|
|
}) |
|
|
|
|
// if ($(this).hasClass('minus') && parseInt(qty.val()) >= 2) {
|
|
|
|
|
// qty.val(parseInt(qty.val()) - 1);
|
|
|
|
|
// } else {
|
|
|
|
|
// if ($(this).hasClass('plus')) {
|
|
|
|
|
// qty.val(parseInt(qty.val()) + 1);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// product.find('.product-item-overlay__button a').attr('data-quantity', qty.val())
|
|
|
|
|
// product.find('.product-item-overlay__price').html(price * qty.val() + ' ');
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
$('.product__main').on('click', '.select__state', function(evt) { |
|
|
|
|
evt.preventDefault(); |
|
|
|
|