From 865ec23ab67ad94ed594fc39f2335083baa7a41a Mon Sep 17 00:00:00 2001 From: maksim Date: Fri, 13 Jun 2025 02:46:09 +0300 Subject: [PATCH] =?UTF-8?q?Maks=20|=20wip:=20=D1=80=D0=B5=D1=84=D0=B0?= =?UTF-8?q?=D0=BA=D1=82=D0=B8=D0=BD=D0=B3=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA?= =?UTF-8?q?=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wp-content/themes/cosmopet/functions.php | 53 ------------------- .../global-functions/multisite-functions.php | 1 + .../archive/component-controller.php | 2 +- .../cosmopet/temp-functions/modules-logic.php | 29 ++++++++++ .../cosmopet/temp-functions/timber-logic.php | 28 ++++++++++ 5 files changed, 59 insertions(+), 54 deletions(-) diff --git a/wp-content/themes/cosmopet/functions.php b/wp-content/themes/cosmopet/functions.php index d5e7caf..3c179fa 100644 --- a/wp-content/themes/cosmopet/functions.php +++ b/wp-content/themes/cosmopet/functions.php @@ -37,32 +37,10 @@ add_action('init', function() { }, 1); -/* Вставить в поиск по модулям */ -$modules_path = get_template_directory() . '/modules/*/editor-blocks/*/editor-block-controller.php'; -foreach (glob($modules_path) as $file) { - require_once $file; // Подключаем каждый найденный файл -} - - -// include_module('blog'); -require_once('modules/blog/module-ajax-controller.php'); // !!! внутри него include_module('blog'); -require_once('modules/forms/module-ajax-controller.php'); -require_once('modules/shop/module-ajax-controller.php'); -require_once('modules/profile/module-ajax-controller.php'); -require_once('modules/footer/module-ajax-controller.php'); -require_once('modules/author/module-ajax-controller.php'); -add_action('wp', 'my_custom_checkout_code'); -function my_custom_checkout_code() { - if (function_exists('is_checkout') && is_checkout() && !is_order_received_page()) { - include_component('shop', 'checkout'); - } -} -include_module('forms'); -include_module('layout'); // include_module('forms'); // include_module('shop'); @@ -72,38 +50,7 @@ include_module('layout'); // include_module('layout'); -class WooProduct extends Timber\Post { - protected $wc_product; - - public function __construct ($pid = null) { - parent::__construct($pid); - $this->wc_product = wc_get_product($this->ID); - } - - public function price() { - return $this->wc_product->get_price(); - } - public function get_price_html() { - return $this->wc_product->get_price_html(); - } - - public function get_attr() { - return $this->wc_product->get_attribute('pa_compound'); - } - - public function get_test() { - return 'test'; - } - -}; - -add_filter('timber/post/classmap', function ($classmap) { - $custom_classmap = [ - 'product' => WooProduct::class, - ]; - return array_merge($classmap, $custom_classmap); -}); //Ajax подгрузка товаров в архиве add_action( 'wp_ajax_nopriv_get_products', 'get_products' ); diff --git a/wp-content/themes/cosmopet/global-functions/multisite-functions.php b/wp-content/themes/cosmopet/global-functions/multisite-functions.php index 56a61ca..4cc7780 100644 --- a/wp-content/themes/cosmopet/global-functions/multisite-functions.php +++ b/wp-content/themes/cosmopet/global-functions/multisite-functions.php @@ -11,6 +11,7 @@ class SiteEnvironment $map = [ 'cosmopet.ru' => ['mode' => 'production', 'region' => 'ru'], 'cosmopet.ae' => ['mode' => 'production', 'region' => 'ae'], + 'cosmopet-test-dumb.cp.good-production.xyz' => ['mode' => 'develope', 'region' => 'ru'], 'cosmopet-test-ru.cp.good-production.xyz' => ['mode' => 'develope', 'region' => 'ru'], 'cosmopet-test-ae.cp.good-production.xyz' => ['mode' => 'develope', 'region' => 'ae'], ]; diff --git a/wp-content/themes/cosmopet/modules/blog/components/archive/component-controller.php b/wp-content/themes/cosmopet/modules/blog/components/archive/component-controller.php index 34d5fc6..61c4425 100644 --- a/wp-content/themes/cosmopet/modules/blog/components/archive/component-controller.php +++ b/wp-content/themes/cosmopet/modules/blog/components/archive/component-controller.php @@ -1,4 +1,4 @@ -wc_product = wc_get_product($this->ID); + } + + public function price() { + return $this->wc_product->get_price(); + } + + public function get_price_html() { + return $this->wc_product->get_price_html(); + } + + public function get_attr() { + return $this->wc_product->get_attribute('pa_compound'); + } +}; + +add_filter('timber/post/classmap', function ($classmap) { + $custom_classmap = [ + 'product' => WooProduct::class, + ]; + return array_merge($classmap, $custom_classmap); +});