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 eb7c6e0..24792c7 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 @@ -541,4 +541,4 @@ document.addEventListener('DOMContentLoaded', function() { modalAside.style.width = ''; modalAside.style.right = '-30vw'; } -}); \ No newline at end of file +}); diff --git a/wp-content/themes/cosmopet/static/front-page/css/style.css b/wp-content/themes/cosmopet/static/front-page/css/style.css index 12bdf8b..80883d8 100644 --- a/wp-content/themes/cosmopet/static/front-page/css/style.css +++ b/wp-content/themes/cosmopet/static/front-page/css/style.css @@ -4557,4 +4557,5 @@ color: #f4f1f0; .modal__aside.active { right: 0; -} \ No newline at end of file +} + diff --git a/wp-content/themes/cosmopet/woocommerce/archive-product.php b/wp-content/themes/cosmopet/woocommerce/archive-product.php index 895e8c6..7143dd5 100644 --- a/wp-content/themes/cosmopet/woocommerce/archive-product.php +++ b/wp-content/themes/cosmopet/woocommerce/archive-product.php @@ -8,6 +8,49 @@ wp_enqueue_style( 'shop_styles_order', get_template_directory_uri() . '/woocommerce/assets/css/gp-style-order.css'); wp_enqueue_style( 'shop_styles_ultra', get_template_directory_uri() . '/woocommerce/assets/css/gp-style-ultra.css'); + function get_active_woobewoo_filters_for_twig() { + $filters = []; + error_log('=== WooBeWoo: фильтры проверяются ==='); + + foreach ($_GET as $key => $value) { + error_log("Ключ: $key => " . print_r($value, true)); + + if (strpos($key, 'wpf_filter_') === 0) { + $raw_taxonomy = str_replace('wpf_filter_', '', $key); + error_log("→ Обнаружен фильтр: $raw_taxonomy"); + + $slugs = is_array($value) ? $value : explode(',', $value); + error_log("→ Slugs: " . implode(', ', $slugs)); + + // Попробуем с pa_ и без, в зависимости от существования таксономии + $taxonomy = taxonomy_exists('pa_' . $raw_taxonomy) ? 'pa_' . $raw_taxonomy : $raw_taxonomy; + + foreach ($slugs as $slug) { + $term = get_term_by('slug', $slug, $taxonomy); + + if ($term) { + error_log("✔ Найден термин: {$term->name} (ID: {$term->term_id}) в таксономии: $taxonomy"); + $filters[] = [ + 'id' => $term->term_id, + 'name' => $term->name, + 'slug' => $term->slug, + 'taxonomy' => $taxonomy, + ]; + } else { + error_log("✖ Термин не найден: $slug в таксономии: $taxonomy"); + } + } + } + } + + if (empty($filters)) { + error_log('‼️ Ни один активный фильтр не найден.'); + } + + return $filters; +} + + $context = Timber::context(); //$context['posts'] = Timber::get_posts(); $context['criteria_for_new_product'] = date('Y-m-d', strtotime('-30 days')); @@ -68,6 +111,8 @@ $count_args = array_merge($count_args, $categories); } + $context['active_filters'] = get_active_woobewoo_filters_for_twig(); + $context['posts'] = Timber::get_posts($args); $context['count'] = count(Timber::get_posts($count_args)); $context['sidebar_filters'] = Timber::get_widgets('sidebar_filters'); diff --git a/wp-content/themes/cosmopet/woocommerce/archive-product/archive-product-modal.twig b/wp-content/themes/cosmopet/woocommerce/archive-product/archive-product-modal.twig index 2df58e0..e69de29 100644 --- a/wp-content/themes/cosmopet/woocommerce/archive-product/archive-product-modal.twig +++ b/wp-content/themes/cosmopet/woocommerce/archive-product/archive-product-modal.twig @@ -1,221 +0,0 @@ -{#