From a06af1ecc3e2684a5875817112a99f2d42c40b91 Mon Sep 17 00:00:00 2001 From: maksim Date: Sun, 22 Jun 2025 23:43:48 +0300 Subject: [PATCH] =?UTF-8?q?Maks=20|=20=D1=81=D0=BB=D0=B5=D0=B3=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=BE=D1=82=D1=80=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=BC=D1=83?= =?UTF-8?q?=D0=BB=D1=8C=D1=82=D0=B8=D1=8F=D0=B7=D1=8B=D1=87=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D0=B8=20=D0=B8=20=D0=BC=D1=83=D0=BB=D1=8C=D1=82?= =?UTF-8?q?=D0=B8=D1=81=D0=B0=D0=B9=D1=82=D0=BE=D0=B2=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8,=20=D1=80=D0=B5=D1=88=D0=B0=D1=8F=20=D0=B2=D0=BE=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=81=20=D0=BF=D0=BE=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=B4=D0=B0=D1=87=D0=B5=20=D1=81=D0=BE=D0=B1=D1=8B=D1=82=D0=B8?= =?UTF-8?q?=D0=B9=20=D0=BF=D0=BE=D0=BA=D1=83=D0=BF=D0=BA=D0=B8=20=D0=B2=20?= =?UTF-8?q?=D0=BC=D0=B5=D1=82=D1=80=D0=B8=D0=BA=D1=83=20=D0=B8=20Pixel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wp-content/themes/cosmopet/functions.php | 11 +- .../global-functions/multilang-functions.php | 3 + .../global-functions/multisite-functions.php | 172 +++++++----------- .../author-banner/assets/css/style.css | 1 + 4 files changed, 76 insertions(+), 111 deletions(-) diff --git a/wp-content/themes/cosmopet/functions.php b/wp-content/themes/cosmopet/functions.php index 5aba1cf..49caa1f 100644 --- a/wp-content/themes/cosmopet/functions.php +++ b/wp-content/themes/cosmopet/functions.php @@ -6,10 +6,10 @@ Timber\Timber::init(); // require once вместо include использовать! -require_once __DIR__ . '/temp-functions/cart-logic.php'; require_once __DIR__ . '/temp-functions/timber-logic.php'; -require_once __DIR__ . '/temp-functions/woocommerce-logic.php'; require_once __DIR__ . '/temp-functions/modules-logic.php'; +require_once __DIR__ . '/temp-functions/cart-logic.php'; +require_once __DIR__ . '/temp-functions/woocommerce-logic.php'; require_once __DIR__ . '/temp-functions/ajax-logic.php'; require_once __DIR__ . '/temp-functions/shortcodes-logic.php'; require_once __DIR__ . '/temp-functions/blog-logic.php'; @@ -22,9 +22,4 @@ require_once __DIR__ . '/temp-functions/login-logic.php'; // include_module('profile'); // include_module('footer'); // include_module('author'); -// include_module('layout'); - - - - - +// include_module('layout'); \ No newline at end of file diff --git a/wp-content/themes/cosmopet/global-functions/multilang-functions.php b/wp-content/themes/cosmopet/global-functions/multilang-functions.php index 27f112c..ae615e7 100644 --- a/wp-content/themes/cosmopet/global-functions/multilang-functions.php +++ b/wp-content/themes/cosmopet/global-functions/multilang-functions.php @@ -1,4 +1,7 @@ site_region add_action('init', function() { diff --git a/wp-content/themes/cosmopet/global-functions/multisite-functions.php b/wp-content/themes/cosmopet/global-functions/multisite-functions.php index 153ffc2..7aaa7d3 100644 --- a/wp-content/themes/cosmopet/global-functions/multisite-functions.php +++ b/wp-content/themes/cosmopet/global-functions/multisite-functions.php @@ -1,6 +1,8 @@ site_mode = $config['mode']; $this->site_region = $config['region']; } + } + add_filter('timber/twig', function (\Twig\Environment $twig) { - $site_env = new SiteEnvironment(); + global $site_env; + $twig->addGlobal('site_region', $site_env->site_region); $twig->addGlobal('site_mode', $site_env->site_mode); $twig->addGlobal('header_scripts', get_field('header_scripts', 'option')); // со страницы "Общих настроек контента ACF" @@ -82,67 +87,12 @@ function custom_canonical_url() { } } -add_action('woocommerce_thankyou', 'send_purchase_to_metrika'); -function send_purchase_to_metrika($order_id) { - if (!$order_id) return; // Проверка, что заказ существует - - $order = wc_get_order($order_id); - if ($order->get_status() !== 'processing' && $order->get_status() !== 'completed') return; // Отправляем только для оплаченных заказов - - $items = []; - foreach ($order->get_items() as $item) { - $product = $item->get_product(); - $items[] = [ - 'id' => $product->get_id(), - 'name' => $product->get_name(), - 'price' => $product->get_price(), - 'quantity' => $item->get_quantity() - ]; - } - - // Получаем валюту заказа - $currency = $order->get_currency(); - ?> - - site_mode == 'production' and $site_env->site_region == 'ae') { + /* Передача просто по url */ add_action('wp_footer', 'add_facebook_pixel_events'); function add_facebook_pixel_events() { // 1. Событие AddToCart (Добавление в корзину) @@ -185,7 +135,7 @@ if($site_env->site_mode == 'production' and $site_env->site_region == 'ae') { }); }); }); - + site_mode == 'production' and $site_env->site_region == 'ae') { get_status() !== 'processing' && $order->get_status() !== 'completed') + return; // Отправляем только для оплаченных заказов + + $items = []; + foreach ($order->get_items() as $item) { + $product = $item->get_product(); + $items[] = [ + 'id' => $product->get_id(), + 'name' => $product->get_name(), + 'price' => $product->get_price(), + 'quantity' => $item->get_quantity() + ]; + } + + // Получаем валюту заказа + $currency = $order->get_currency(); + ?> + + ' . "\n"; - echo '' . "\n"; - } -} - - +}); \ No newline at end of file diff --git a/wp-content/themes/cosmopet/modules/blog/components/author-banner/assets/css/style.css b/wp-content/themes/cosmopet/modules/blog/components/author-banner/assets/css/style.css index 5ca3c76..f2765ef 100644 --- a/wp-content/themes/cosmopet/modules/blog/components/author-banner/assets/css/style.css +++ b/wp-content/themes/cosmopet/modules/blog/components/author-banner/assets/css/style.css @@ -13,6 +13,7 @@ align-items: center; justify-content: space-between; padding: 35px 42px 35px 209px; + gap: 20px; position: relative; box-shadow: 6px 9px 20px rgba(0, 0, 0, 15%); }