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 @@

+ {{ post._price() }} -

+   + {{ fn('get_woocommerce_currency_symbol') }} +
{{ function('get_add_to_cart_button', post.id) }} diff --git a/wp-content/themes/cosmopet/templates/_pages/shop/archive-product.twig b/wp-content/themes/cosmopet/templates/_pages/shop/archive-product.twig index 555f1e6..471d2d9 100644 --- a/wp-content/themes/cosmopet/templates/_pages/shop/archive-product.twig +++ b/wp-content/themes/cosmopet/templates/_pages/shop/archive-product.twig @@ -3,14 +3,6 @@ {% extends 'layout.twig' %} {% block content %} - - {% if site_region == 'ru' %} - - {% endif %}
- - - {% endblock %} \ No newline at end of file diff --git a/wp-content/themes/cosmopet/templates/archive-product/archive-product-ajaxload.twig b/wp-content/themes/cosmopet/templates/archive-product/archive-product-ajaxload.twig deleted file mode 100644 index 7b476ec..0000000 --- a/wp-content/themes/cosmopet/templates/archive-product/archive-product-ajaxload.twig +++ /dev/null @@ -1,9 +0,0 @@ -{% for post in posts %} - {% include 'archive-product/archive-product-tease.twig' with {post: post} %} -{% endfor %} - -{% if not ended %} - -{% endif %} \ No newline at end of file diff --git a/wp-content/themes/cosmopet/templates/archive-product/archive-product-tease.twig b/wp-content/themes/cosmopet/templates/archive-product/archive-product-tease.twig deleted file mode 100644 index ec52d75..0000000 --- a/wp-content/themes/cosmopet/templates/archive-product/archive-product-tease.twig +++ /dev/null @@ -1,128 +0,0 @@ -{% if post.id is defined and post.id %} - {% set cur_product = fn('wc_get_product', post.id) %} - {% set attrs = post.product.get_attributes() %} - {% set cur_weight = function('get_product_info', post.id, 'weight') %} - -
-
- {% if post.date('Y-m-d') >= criteria_for_new_product %} - - {{ function('pll_e', 'Новинка') }} - - {% endif %} - - {% if post._sale_price %} - - {{ function('pll_e', 'Распродажа %') }} - - {% endif %} -
-
- {{ post.title }} - -
-
- {% set compound = fn('wc_get_product_terms', post.id, 'pa_compound') %} - {% for option in compound %} - - {% set term = get_term(option) %} - {{ term.name }} - {% endfor %} -
- {{ post.title }} -
-

{{ post._price() }} {{ fn('get_woocommerce_currency_symbol') }}

-
- {% set stock_status = fn('wc_get_product_stock_status', post.id) %} - {% if stock_status == 'instock' %} -
- -
- {% else %} - - {% endif %} -
-
-
- {{ post.title }} - -
    - {% set features = fn('wc_get_product_terms', post.id, 'pa_features') %} - {% for option in features %} - {% set term = get_term(option) %} -
  • {{ term.name }}
  • - {% endfor %} -
-
- -
-
- {% set collection = fn('wc_get_product_terms', post.id, 'pa_collection') %} - {% if collection %} -
-

{{ fn('pll_e', 'Объем') }}

- -
- -
-
    - - {% for option in collection %} - {% set term = get_term(option) %} - {% set siblings = function('get_collection_siblings' , term.id) %} - - {% for sibling in siblings %} - - {% set weight = function('get_product_info', sibling.ID, 'weight') %} - - {% set class = '' %} - {% if weight == cur_weight %} - {% set class = 'active' %} - {% endif %} -
  • - -
  • - {% endfor %} - {% endfor %} -
-
-
-
- {% endif %} -
-

{{ fn('pll_e', 'Количество') }}

- -
- - - -
-
-
-

- {{ post._price() }} -

-
-
- {{ function('get_add_to_cart_button', post.id) }} -
- -
-
-
-
-{% endif %} \ No newline at end of file