From 81962b283a1d1a1afc531b6fc6a6442f40bbb8c3 Mon Sep 17 00:00:00 2001 From: maksim Date: Fri, 13 Jun 2025 12:31:46 +0300 Subject: [PATCH] =?UTF-8?q?Task:6761=20|=20=D0=BF=D0=BE=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D0=BB=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D1=83=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8=D1=82=D1=8C=20=D0=B5?= =?UTF-8?q?=D1=89=D0=B5=20=D0=B2=20=D0=B1=D0=BB=D0=BE=D0=B3=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../blog/assets/css/gp-style-desktop.css | 22 +++++++ .../components/cart/component-controller.php | 66 +++++++++++++------ 2 files changed, 67 insertions(+), 21 deletions(-) diff --git a/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-desktop.css b/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-desktop.css index b4b3192..4e8d326 100644 --- a/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-desktop.css +++ b/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-desktop.css @@ -65,4 +65,26 @@ main{ background-color: #fff !important; margin-top: 2rem; width: 100%; +} + + +.anons-article__more-link { + display: flex; + align-items: center; + justify-content: center; +} + +.anons-article__more-link{ + background: var(--accent-3); + color: var(--main_white); + border-radius: 20px; + border: 1px solid var(--main_white); + padding: 16px 24px; + font-size: 20px; + font-weight: 600; + line-height: 24px; + text-transform: uppercase; + margin-right: auto; + margin-left: auto; + width: max-content; } \ No newline at end of file diff --git a/wp-content/themes/cosmopet/modules/shop/components/cart/component-controller.php b/wp-content/themes/cosmopet/modules/shop/components/cart/component-controller.php index 4e9f8ad..c5354f9 100644 --- a/wp-content/themes/cosmopet/modules/shop/components/cart/component-controller.php +++ b/wp-content/themes/cosmopet/modules/shop/components/cart/component-controller.php @@ -1,22 +1,46 @@ -cart->get_cart_contents_count(); - return $context; -}); - - -add_action('wp_enqueue_scripts', 'enable_ajax_add_to_cart_single'); -function enable_ajax_add_to_cart_single() { - if (is_product()) { - wp_enqueue_script('wc-add-to-cart-variation'); // для вариативных товаров - wp_enqueue_script('wc-add-to-cart'); // основной скрипт для добавления в корзину - } +cart)) { + $context['cart_count'] = WC()->cart->get_cart_contents_count(); + } + if (defined('WP_IMPORTING') && WP_IMPORTING) { + $context['cart_count'] = 0; + } + return $context; + }); +}, 20); + +// Подключение скриптов для AJAX-добавления в корзину +add_action('wp_enqueue_scripts', 'enable_ajax_add_to_cart_single'); +function enable_ajax_add_to_cart_single() { + if (is_product()) { + wp_enqueue_script('wc-add-to-cart-variation'); + wp_enqueue_script('wc-add-to-cart'); + error_log('WooCommerce scripts enqueued on product page'); + } +} + +// Добавление перевода для WooCommerce скриптов +add_filter('woocommerce_get_script_data', 'add_custom_woocommerce_params', 10, 2); +function add_custom_woocommerce_params($params, $handle) { + if (in_array($handle, ['wc-cart', 'wc-add-to-cart'])) { + $params['i18n_restore_item'] = function_exists('pll__') ? pll__('Восстановить') : __('Восстановить', 'cosmopet'); + } + return $params; } \ No newline at end of file