|
|
|
@ -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' ); |
|
|
|
|