diff --git a/wp-content/themes/cosmopet/modules/footer/assets/js/footer.js b/wp-content/themes/cosmopet/modules/footer/assets/js/footer.js
index d362208..c2fa472 100644
--- a/wp-content/themes/cosmopet/modules/footer/assets/js/footer.js
+++ b/wp-content/themes/cosmopet/modules/footer/assets/js/footer.js
@@ -219,13 +219,13 @@
});
})
- $('body').on('click', '.product-item-overlay__field .counter__button', function(){
- var input = $(this).closest('.counter').find('.counter__input').val()
- var price = $(this).closest('.product-item__form').find('.product-item-overlay__price')
+ // $('body').on('click', '.product-item-overlay__field .counter__button', function(){
+ // var input = $(this).closest('.counter').find('.counter__input').val()
+ // var price = $(this).closest('.product-item__form').find('.product-item-overlay__price')
- $(price).html(Number(input) * $(price).data('basecost'))
- })
+ // $(price).html(Number(input) * $(price).data('basecost'))
+ // })
$('body').on('click', '.modal-basket__item-before', function(){
var key = $(this).data('id')
diff --git a/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js b/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js
index 85f1651..a7eb44b 100644
--- a/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js
+++ b/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js
@@ -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('Добавить в корзину');
- })
-
- $('.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'));
+ // $('.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('Добавить в корзину');
+ // })
+
+ // $('.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 (!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() + ' ');
+ // })
$('.product__main').on('click', '.select__state', function(evt) {
evt.preventDefault();
diff --git a/wp-content/themes/cosmopet/woocommerce/archive-product/archive-product-tease.twig b/wp-content/themes/cosmopet/woocommerce/archive-product/archive-product-tease.twig
index 905bc45..8bb76ab 100644
--- a/wp-content/themes/cosmopet/woocommerce/archive-product/archive-product-tease.twig
+++ b/wp-content/themes/cosmopet/woocommerce/archive-product/archive-product-tease.twig
@@ -95,7 +95,7 @@
-
+
diff --git a/wp-content/themes/cosmopet/woocommerce/assets/js/gp-main.js b/wp-content/themes/cosmopet/woocommerce/assets/js/gp-main.js
index 438dc06..b176193 100644
--- a/wp-content/themes/cosmopet/woocommerce/assets/js/gp-main.js
+++ b/wp-content/themes/cosmopet/woocommerce/assets/js/gp-main.js
@@ -25,27 +25,33 @@ jQuery(document).ready(function ($) {
product.find('.product-item-overlay__button').prepend('Добавить в корзину');
})
- $('.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 || isNaN(price)) {
- let priceText = product.find('.product-item__price p').text();
- price = parseFloat(priceText.replace(/[^0-9\.,]/g, '').replace(',', '.'));
- }
- let qty = product.find('.counter__input');
+$('.product__main').on('click', '.counter__button', function(evt) {
+ evt.preventDefault();
+ let product = $(this).closest('.product__item');
+ let priceElement = product.find('.select__state');
+ let price = parseFloat(priceElement.data('product_price'));
+ let qty = product.find('.counter__input');
+
+ // Если цена не найдена, пытаемся взять её из .product-item__price
+ if (!price || isNaN(price)) {
+ let priceText = product.find('.product-item__price p').text();
+ price = parseFloat(priceText.replace(/[^0-9\.,]/g, '').replace(',', '.'));
+ }
- 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);
- }
- }
+ // Обновляем количество
+ 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()) + ' ');
- })
+ // Обновляем атрибут data-quantity для кнопки "Добавить в корзину"
+ product.find('.product-item-overlay__button a').attr('data-quantity', qty.val());
+
+ // Обновляем цену без символа валюты (он добавляется через ::after)
+ console.log(price * qty.val())
+ product.find('.product-item-overlay__price').html((price * qty.val()));
+});
$('.product__main').on('click', '.select__state', function(evt) {
evt.preventDefault();