diff --git a/wp-content/themes/cosmopet/modules/profile/module-ajax-controller.php b/wp-content/themes/cosmopet/modules/profile/module-ajax-controller.php index 2b2cc89..02390d5 100644 --- a/wp-content/themes/cosmopet/modules/profile/module-ajax-controller.php +++ b/wp-content/themes/cosmopet/modules/profile/module-ajax-controller.php @@ -138,11 +138,6 @@ add_action('wp_ajax_update_subscription_address', 'handle_subscription_address_u add_action('wp_ajax_nopriv_update_subscription_address', 'handle_subscription_address_update'); function handle_subscription_address_update() { - error_log('=== [AJAX] Запуск update_subscription_address ==='); - - error_log('[AJAX] Nonce из формы: ' . ($_POST['address_nonce'] ?? 'none')); - error_log('[AJAX] Проверка nonce: ' . (wp_verify_nonce($_POST['address_nonce'], 'update_subscription_address') ? 'OK' : 'FAIL')); - if (!isset($_POST['address_nonce']) || !wp_verify_nonce($_POST['address_nonce'], 'update_subscription_address')) { error_log('[AJAX] Ошибка nonce'); wp_send_json_error(['message' => pll__('Ошибка безопасности. Обновите страницу.')]); @@ -158,8 +153,6 @@ function handle_subscription_address_update() { $city = sanitize_text_field($_POST['city'] ?? ''); $comment = sanitize_textarea_field($_POST['comment'] ?? ''); - error_log("[AJAX] Получено: ID={$subscription_id}, Address={$address_1}, City={$city}, Comment={$comment}"); - if (!$subscription_id || empty($address_1)) { wp_send_json_error(['message' => pll__('Недостаточно данных.')]); } @@ -177,6 +170,8 @@ function handle_subscription_address_update() { $subscription->set_customer_note($comment); $subscription->save(); - error_log('[AJAX] Подписка обновлена: ' . $subscription_id); + wp_send_json_success(['message' => pll__('Адрес доставки успешно обновлён.')]); } + + diff --git a/wp-content/themes/cosmopet/modules/shop/components/catalog/assets/css/catalog.css b/wp-content/themes/cosmopet/modules/shop/components/catalog/assets/css/catalog.css index b6d1d0b..a46b6df 100644 --- a/wp-content/themes/cosmopet/modules/shop/components/catalog/assets/css/catalog.css +++ b/wp-content/themes/cosmopet/modules/shop/components/catalog/assets/css/catalog.css @@ -806,9 +806,7 @@ display: none; text-align: right; color: var(--text-black); } - .product-item-overlay__price::after{ - content: 'AED'; - } + .product-item-overlay__block-button{ margin-top: 32px; } diff --git a/wp-content/themes/cosmopet/modules/shop/components/catalog/assets/js/filters.js b/wp-content/themes/cosmopet/modules/shop/components/catalog/assets/js/filters.js new file mode 100644 index 0000000..5c91869 --- /dev/null +++ b/wp-content/themes/cosmopet/modules/shop/components/catalog/assets/js/filters.js @@ -0,0 +1,89 @@ +document.addEventListener("DOMContentLoaded", () => { + const filterButtons = document.querySelectorAll('.product-tagitem'); + + filterButtons.forEach(button => { + button.addEventListener('click', () => { + const slug = button.dataset.slug; + const taxonomy = button.dataset.taxonomy; + + const param = 'wpf_filter_' + taxonomy; + const url = new URL(window.location.href); + const params = new URLSearchParams(url.search); + + if (params.has(param)) { + let values = params.get(param).split(','); + values = values.filter(v => v !== slug); + + if (values.length > 0) { + params.set(param, values.join(',')); + } else { + params.delete(param); + } + + url.search = params.toString(); + window.location.href = url.toString(); + } + }); + }); + +// Обработка клика на теги активных фильтров +document.querySelectorAll('.active-filter-tag').forEach(tag => { + tag.addEventListener('click', function(e) { + e.preventDefault(); + const slug = this.dataset.filterSlug; + const taxonomy = this.dataset.filterTaxonomy; + const urlParam = 'wpf_filter_' + taxonomy.replace('pa_', ''); + + const url = new URL(window.location.href); + const params = new URLSearchParams(url.search); + + if (params.has(urlParam)) { + const currentValue = params.get(urlParam); + + // Разделяем значения, учитывая как закодированные, так и обычные разделители + let values = currentValue.split(/\||%7C|,/); + + // Декодируем и фильтруем значения + const newValues = values.filter(v => { + return decodeURIComponent(v.trim()) !== slug.trim(); + }); + + // Обновляем URL параметры + if (newValues.length > 0) { + // Используем | как разделитель (можно заменить на ',', если нужно) + params.set(urlParam, newValues.join('|')); + } else { + params.delete(urlParam); + // Дополнительно очищаем связанные параметры + if (urlParam.includes('price')) { + params.delete('wpf_min_price'); + params.delete('wpf_max_price'); + } + params.delete('wpf_fbv'); + } + + // Обновляем URL и перезагружаем страницу + url.search = params.toString(); + window.location.href = url.href; + } + }); +}); + + // Обработка кнопки "Очистить все" + const clearAllBtn = document.querySelector('.active-filters__clear'); + if (clearAllBtn) { + clearAllBtn.addEventListener('click', () => { + const url = new URL(window.location.href); + const params = new URLSearchParams(url.search); + + for (const key of Array.from(params.keys())) { + if (key.startsWith('wpf_')) { + params.delete(key); + } + } + + url.search = params.toString(); + window.location.href = url.toString(); + }); + } +}); \ No newline at end of file diff --git a/wp-content/themes/cosmopet/modules/shop/components/catalog/assets/js/gp-main.js b/wp-content/themes/cosmopet/modules/shop/components/catalog/assets/js/gp-main.js index 24a9b29..7411ca6 100644 --- a/wp-content/themes/cosmopet/modules/shop/components/catalog/assets/js/gp-main.js +++ b/wp-content/themes/cosmopet/modules/shop/components/catalog/assets/js/gp-main.js @@ -38,7 +38,7 @@ jQuery(document).ready(function ($) { // Обновляем цену без символа валюты (он добавляется через ::after) console.log(price * qty.val()) - product.find('.product-item-overlay__price').html((price * qty.val())); + product.find('.product-item-overlay__price-val').html((price * qty.val())); }); @@ -50,7 +50,7 @@ jQuery(document).ready(function ($) { let id = $(this).data('product_id'); let qty = product.find('.counter__input').val(); console.log('qty', price * qty) - window.t = product.find('.product-item-overlay__price') + window.t = product.find('.product-item-overlay__price-val') console.log(t) var new_price = price * Number(qty) product.find('.product-item-overlay__price').html(new_price + ' '); diff --git a/wp-content/themes/cosmopet/temp-functions/woocommerce-logic.php b/wp-content/themes/cosmopet/temp-functions/woocommerce-logic.php index 7392fde..a2b28a4 100644 --- a/wp-content/themes/cosmopet/temp-functions/woocommerce-logic.php +++ b/wp-content/themes/cosmopet/temp-functions/woocommerce-logic.php @@ -302,3 +302,6 @@ function custom_get_wc_notices() { 'html' => $html, ]); } + + + diff --git a/wp-content/themes/cosmopet/templates/_blocks/shop/archive-product-tease.twig b/wp-content/themes/cosmopet/templates/_blocks/shop/archive-product-tease.twig index dd055d2..846edc5 100644 --- a/wp-content/themes/cosmopet/templates/_blocks/shop/archive-product-tease.twig +++ b/wp-content/themes/cosmopet/templates/_blocks/shop/archive-product-tease.twig @@ -133,18 +133,21 @@