Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 459 B After Width: | Height: | Size: 459 B |
Before Width: | Height: | Size: 481 B After Width: | Height: | Size: 481 B |
Before Width: | Height: | Size: 456 B After Width: | Height: | Size: 456 B |
Before Width: | Height: | Size: 458 B After Width: | Height: | Size: 458 B |
Before Width: | Height: | Size: 954 B After Width: | Height: | Size: 954 B |
Before Width: | Height: | Size: 455 B After Width: | Height: | Size: 455 B |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
@ -0,0 +1,20 @@ |
||||
<?php |
||||
use Timber\Timber; |
||||
global $post; |
||||
|
||||
$context = Timber::get_context(); |
||||
|
||||
// Получаем текущий продукт |
||||
$product_id = get_the_ID(); |
||||
$product = wc_get_product($product_id); |
||||
|
||||
// Добавляем продукт в контекст |
||||
$context['product'] = $product; |
||||
$context['post'] = Timber::get_post(); |
||||
|
||||
include_module('shop'); |
||||
include_component('shop', 'reviews'); |
||||
|
||||
?> |
||||
<?php |
||||
Timber::render('woocommerce/single-product.twig', $context); |
@ -0,0 +1,49 @@ |
||||
/* Стили для загрузки корзины на single странице */ |
||||
|
||||
.product-incart__wrap.loading { |
||||
position: relative; |
||||
pointer-events: none; |
||||
opacity: 0.7; |
||||
} |
||||
|
||||
.product-incart__wrap.loading::before { |
||||
content: ''; |
||||
position: absolute; |
||||
top: 0; |
||||
left: 0; |
||||
right: 0; |
||||
bottom: 0; |
||||
background: rgba(255, 255, 255, 0.8); |
||||
z-index: 10; |
||||
} |
||||
|
||||
.product-incart__wrap.loading::after { |
||||
content: ''; |
||||
position: absolute; |
||||
top: 50%; |
||||
left: 50%; |
||||
width: 20px; |
||||
height: 20px; |
||||
margin: -10px 0 0 -10px; |
||||
border: 2px solid #f3f3f3; |
||||
border-top: 2px solid #3498db; |
||||
border-radius: 50%; |
||||
animation: spin 1s linear infinite; |
||||
z-index: 11; |
||||
} |
||||
|
||||
@keyframes spin { |
||||
0% { transform: rotate(0deg); } |
||||
100% { transform: rotate(360deg); } |
||||
} |
||||
|
||||
/* Стили для кнопок во время загрузки */ |
||||
.product-incart__wrap.loading .product-incart__btn { |
||||
opacity: 0.5; |
||||
pointer-events: none; |
||||
} |
||||
|
||||
/* Стили для счетчика во время загрузки */ |
||||
.product-incart__wrap.loading .product-incart__count { |
||||
opacity: 0.5; |
||||
} |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 459 B After Width: | Height: | Size: 459 B |
Before Width: | Height: | Size: 481 B After Width: | Height: | Size: 481 B |
Before Width: | Height: | Size: 456 B After Width: | Height: | Size: 456 B |
Before Width: | Height: | Size: 458 B After Width: | Height: | Size: 458 B |
Before Width: | Height: | Size: 954 B After Width: | Height: | Size: 954 B |
Before Width: | Height: | Size: 455 B After Width: | Height: | Size: 455 B |
@ -0,0 +1,156 @@ |
||||
<?php |
||||
|
||||
$product; |
||||
$product_type; |
||||
$context_for_twig; |
||||
|
||||
// Получаем данные продукта |
||||
$product_id = get_the_ID(); |
||||
$product = wc_get_product($product_id); |
||||
|
||||
// Проверяем, что продукт существует |
||||
if (!$product) { |
||||
return; // Просто выходим, если продукт не найден |
||||
} |
||||
|
||||
$attributes = []; |
||||
$product_attributes = $product->get_attributes(); |
||||
|
||||
/* Получение категорий */ |
||||
$tags = get_the_terms($product_id, 'product_cat'); |
||||
if (!empty($tags) && !is_wp_error($tags)) { |
||||
foreach ($tags as $tag) { |
||||
$context_for_twig['product_tags'][] = $tag->name; |
||||
} |
||||
} |
||||
|
||||
/* Получение атрибутов */ |
||||
if (!empty($product_attributes)) { |
||||
foreach ($product_attributes as $taxonomy => $attribute) { |
||||
if ($attribute->is_taxonomy()) { |
||||
$terms = wc_get_product_terms($product_id, $taxonomy, ['fields' => 'all']); |
||||
// $tags = wc_get_product_terms( $product_id, 'pa_catalog_tags' ); |
||||
|
||||
if (!empty($terms)) { |
||||
$attr_values = []; |
||||
foreach ($terms as $term) { |
||||
$attr_values[] = [ |
||||
'name' => $term->name, |
||||
'slug' => $term->slug, |
||||
'term_id' => $term->term_id, |
||||
'link' => get_term_link($term->term_id, $taxonomy), |
||||
]; |
||||
} |
||||
$attributes[wc_attribute_label($taxonomy)] = $attr_values; |
||||
} |
||||
} else { |
||||
$attributes[wc_attribute_label($taxonomy)] = $attribute->get_options(); |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
$context_for_twig['product_attributes'] = $attributes; |
||||
|
||||
/* Получение вариаций товара */ |
||||
if ($product->is_type('variable')) { |
||||
$available_variations = $product->get_available_variations(); |
||||
$variations_data = []; |
||||
|
||||
foreach ($available_variations as $variation) { |
||||
$variation_id = $variation['variation_id']; |
||||
$variation_obj = wc_get_product($variation_id); |
||||
|
||||
$variations_data[] = [ |
||||
'variation_id' => $variation_id, |
||||
'price' => $variation_obj->get_price(), |
||||
'regular_price' => $variation_obj->get_regular_price(), |
||||
'sale_price' => $variation_obj->get_sale_price(), |
||||
'attributes' => $variation['attributes'] |
||||
]; |
||||
} |
||||
|
||||
$context_for_twig['variations'] = $variations_data; |
||||
} |
||||
|
||||
/* ACF-поля и мета-данные продукта */ |
||||
$meta_fields = [ |
||||
'composition' => get_post_meta($product_id, '_composition', true), |
||||
'feeding_recommendations' => get_post_meta($product_id, '_feeding_recommendations', true), // Ранее выводились HTML-полем «Рекомендации по кормлению» |
||||
'feeding_recommendations_table' => get_field('feeding_recommendations_table', get_post(get_field('p_tables_field', $product_id))) , // Таблица «Рекомендации по кормлению» |
||||
'nutritional_value' => get_post_meta($product_id, '_nutritional_value', true), |
||||
'vitamins' => get_post_meta($product_id, '_vitamins', true), |
||||
'additives' => get_post_meta($product_id, '_additives', true), |
||||
'energy_value' => get_post_meta($product_id, '_energy_value', true), |
||||
'important' => get_post_meta($product_id, '_important', true), |
||||
]; |
||||
|
||||
$context_for_twig['product_meta'] = $meta_fields; |
||||
|
||||
|
||||
/* Товар оформляется по подписке? */ |
||||
$context_for_twig['is_subscription'] = $product->is_type( array( 'subscription', 'subscription_variation', 'variable-subscription' )) ? true : false; |
||||
|
||||
$context = Timber::get_context(); |
||||
$post = Timber::get_post(); |
||||
$context['post'] = $post; |
||||
$context['wc_breadcrumbs'] = array(); |
||||
|
||||
if (function_exists('woocommerce_breadcrumb')) { |
||||
$args = array( |
||||
'delimiter' => '', |
||||
'wrap_before' => '', |
||||
'wrap_after' => '', |
||||
'before' => '', |
||||
'after' => '', |
||||
'home' => _x('Home', 'breadcrumb', 'woocommerce'), |
||||
); |
||||
|
||||
$breadcrumbs = new WC_Breadcrumb(); |
||||
$breadcrumbs->generate(); |
||||
|
||||
$formatted_breadcrumbs = array(); |
||||
foreach ($breadcrumbs->get_breadcrumb() as $crumb) { |
||||
$formatted_breadcrumbs[] = array( |
||||
'text' => $crumb[0], |
||||
'url' => $crumb[1] |
||||
); |
||||
} |
||||
|
||||
$context['wc_breadcrumbs'] = $formatted_breadcrumbs; |
||||
} |
||||
|
||||
$context['product'] = $product; |
||||
|
||||
$context['related_products'] = array(); |
||||
$related_products_ids = $product->get_upsell_ids(); |
||||
if ($related_products_ids) { |
||||
foreach ($related_products_ids as $related_id) { |
||||
$related_product = wc_get_product($related_id); |
||||
if ($related_product) { |
||||
$context['related_products'][] = $related_product; |
||||
} |
||||
} |
||||
} |
||||
if (class_exists('WCS_ATT_Product_Schemes')) { |
||||
$schemes = WCS_ATT_Product_Schemes::get_subscription_schemes($product); |
||||
$context['has_subscription_options'] = !empty($schemes); |
||||
} else { |
||||
$context['has_subscription_options'] = false; |
||||
} |
||||
|
||||
Timber::render('_pages/shop/product-single.twig', $context); |
||||
|
||||
// Подключение стилей для загрузки корзины |
||||
add_action('wp_enqueue_scripts', 'single_product_cart_styles'); |
||||
|
||||
function single_product_cart_styles() { |
||||
if (is_product()) { |
||||
wp_enqueue_style( |
||||
'single-product-cart-loading', |
||||
get_template_directory_uri() . '/modules/shop/components/single-product/assets/css/cart-loading.css', |
||||
array(), |
||||
'1.0.0' |
||||
); |
||||
} |
||||
} |
@ -1,152 +0,0 @@ |
||||
<?php |
||||
|
||||
|
||||
$product; |
||||
$product_type; |
||||
$context_for_twig; |
||||
|
||||
if (function_exists('is_product') && is_product()) { |
||||
$product_id = get_the_ID(); |
||||
$product = wc_get_product($product_id); |
||||
|
||||
$attributes = []; |
||||
$product_attributes = $product->get_attributes(); |
||||
|
||||
/* Получение категорий */ |
||||
$tags = get_the_terms($product_id, 'product_cat'); |
||||
if (!empty($tags) && !is_wp_error($tags)) { |
||||
foreach ($tags as $tag) { |
||||
$context_for_twig['product_tags'][] = $tag->name; |
||||
} |
||||
} |
||||
|
||||
/* Получение атрибутов */ |
||||
if (!empty($product_attributes)) { |
||||
foreach ($product_attributes as $taxonomy => $attribute) { |
||||
if ($attribute->is_taxonomy()) { |
||||
$terms = wc_get_product_terms($product_id, $taxonomy, ['fields' => 'all']); |
||||
// $tags = wc_get_product_terms( $product_id, 'pa_catalog_tags' ); |
||||
|
||||
if (!empty($terms)) { |
||||
$attr_values = []; |
||||
foreach ($terms as $term) { |
||||
$attr_values[] = [ |
||||
'name' => $term->name, |
||||
'slug' => $term->slug, |
||||
'term_id' => $term->term_id, |
||||
'link' => get_term_link($term->term_id, $taxonomy), |
||||
]; |
||||
} |
||||
$attributes[wc_attribute_label($taxonomy)] = $attr_values; |
||||
} |
||||
} else { |
||||
$attributes[wc_attribute_label($taxonomy)] = $attribute->get_options(); |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
$context_for_twig['product_attributes'] = $attributes; |
||||
|
||||
/* Получение вариаций товара */ |
||||
if ($product->is_type('variable')) { |
||||
$available_variations = $product->get_available_variations(); |
||||
$variations_data = []; |
||||
|
||||
foreach ($available_variations as $variation) { |
||||
$variation_id = $variation['variation_id']; |
||||
$variation_obj = wc_get_product($variation_id); |
||||
|
||||
$variations_data[] = [ |
||||
'variation_id' => $variation_id, |
||||
'price' => $variation_obj->get_price(), |
||||
'regular_price' => $variation_obj->get_regular_price(), |
||||
'sale_price' => $variation_obj->get_sale_price(), |
||||
'attributes' => $variation['attributes'] |
||||
]; |
||||
} |
||||
|
||||
$context_for_twig['variations'] = $variations_data; |
||||
} |
||||
|
||||
/* ACF-поля и мета-данные продукта */ |
||||
$meta_fields = [ |
||||
'composition' => get_post_meta($product_id, '_composition', true), |
||||
'feeding_recommendations' => get_post_meta($product_id, '_feeding_recommendations', true), // Ранее выводились HTML-полем «Рекомендации по кормлению» |
||||
'feeding_recommendations_table' => get_field('feeding_recommendations_table', get_post(get_field('p_tables_field', $product_id))) , // Таблица «Рекомендации по кормлению» |
||||
'nutritional_value' => get_post_meta($product_id, '_nutritional_value', true), |
||||
'vitamins' => get_post_meta($product_id, '_vitamins', true), |
||||
'additives' => get_post_meta($product_id, '_additives', true), |
||||
'energy_value' => get_post_meta($product_id, '_energy_value', true), |
||||
'important' => get_post_meta($product_id, '_important', true), |
||||
]; |
||||
|
||||
$context_for_twig['product_meta'] = $meta_fields; |
||||
|
||||
|
||||
|
||||
/* Товар оформляется по подписке? */ |
||||
$context_for_twig['is_subscription'] = $product->is_type( array( 'subscription', 'subscription_variation', 'variable-subscription' )) ? true : false; |
||||
} |
||||
|
||||
|
||||
add_filter('timber/context', function ($context) use ($context_for_twig) { |
||||
return array_merge($context, $context_for_twig); |
||||
}); |
||||
|
||||
|
||||
|
||||
$context = Timber::get_context(); |
||||
$post = Timber::get_post(); |
||||
$context['post'] = $post; |
||||
|
||||
$context['wc_breadcrumbs'] = array(); |
||||
|
||||
if (function_exists('woocommerce_breadcrumb')) { |
||||
$args = array( |
||||
'delimiter' => '', |
||||
'wrap_before' => '', |
||||
'wrap_after' => '', |
||||
'before' => '', |
||||
'after' => '', |
||||
'home' => _x('Home', 'breadcrumb', 'woocommerce'), |
||||
); |
||||
|
||||
$breadcrumbs = new WC_Breadcrumb(); |
||||
$breadcrumbs->generate(); |
||||
|
||||
$formatted_breadcrumbs = array(); |
||||
foreach ($breadcrumbs->get_breadcrumb() as $crumb) { |
||||
$formatted_breadcrumbs[] = array( |
||||
'text' => $crumb[0], |
||||
'url' => $crumb[1] |
||||
); |
||||
} |
||||
|
||||
$context['wc_breadcrumbs'] = $formatted_breadcrumbs; |
||||
} |
||||
|
||||
$product_id = get_the_ID(); |
||||
$product = wc_get_product($product_id); |
||||
|
||||
$context['product'] = $product; |
||||
|
||||
$context['related_products'] = array(); |
||||
$related_products_ids = $product->get_upsell_ids(); |
||||
if ($related_products_ids) { |
||||
foreach ($related_products_ids as $related_id) { |
||||
$related_product = wc_get_product($related_id); |
||||
if ($related_product) { |
||||
$context['related_products'][] = $related_product; |
||||
} |
||||
} |
||||
} |
||||
if (class_exists('WCS_ATT_Product_Schemes')) { |
||||
$schemes = WCS_ATT_Product_Schemes::get_subscription_schemes($product); |
||||
$context['has_subscription_options'] = !empty($schemes); |
||||
} else { |
||||
$context['has_subscription_options'] = false; |
||||
} |
||||
|
||||
|
||||
Timber::render('_pages/shop/product-single.twig', $context); |
@ -1,13 +0,0 @@ |
||||
<?php |
||||
use Timber\Timber; |
||||
global $post; |
||||
|
||||
$context = Timber::get_context(); |
||||
|
||||
include_module('shop'); |
||||
include_component('shop', 'reviews'); |
||||
include_component('shop', 'product-card'); |
||||
|
||||
?> |
||||
<?php |
||||
Timber::render('shop/single-product.twig', $context); |
@ -1,6 +0,0 @@ |
||||
<?php |
||||
|
||||
include_module('author'); |
||||
include_component('author', 'author-single'); |
||||
|
||||
?> |
@ -1,6 +0,0 @@ |
||||
<?php |
||||
|
||||
include_module('blog'); |
||||
include_component('blog', 'single'); |
||||
|
||||
?> |
@ -1,22 +0,0 @@ |
||||
<?php |
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) { |
||||
exit; |
||||
} |
||||
|
||||
if (is_product()) { |
||||
|
||||
include_module('shop'); |
||||
global $product; |
||||
// Get the product ID |
||||
$product_id = get_the_ID(); |
||||
if ($product_id == 1105){ |
||||
include_component('shop', 'single-product_new'); |
||||
} |
||||
else{ |
||||
// include_component('shop', 'single-product'); |
||||
include_component('shop', 'single-product_new'); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,26 @@ |
||||
<?php |
||||
/** |
||||
* The Template for displaying all single posts |
||||
* |
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/ |
||||
*/ |
||||
|
||||
namespace App; |
||||
|
||||
use Timber\Timber; |
||||
|
||||
$context = Timber::context(); |
||||
$post = $context['post']; |
||||
|
||||
if ( is_singular('post') ) { |
||||
include_module('blog'); |
||||
include_component('blog', 'single'); |
||||
} elseif ( is_singular('blog_author') ) { |
||||
include_module('author'); |
||||
include_component('author', 'author-single'); |
||||
} else { |
||||
// Для других типов записей |
||||
$templates = [ 'views/single-' . get_post_type() . '.twig', 'views/single.twig' ]; |
||||
} |
||||
|
||||
Timber::render( $templates, $context ); |
@ -1,43 +1,56 @@ |
||||
<? |
||||
|
||||
use Timber; |
||||
use Timber\PostCollection; |
||||
use Timber\Integrations\WooCommerce\Product as TimberProduct; |
||||
|
||||
|
||||
Timber::$dirname = [ |
||||
[ |
||||
'modules', |
||||
'views' |
||||
], |
||||
]; |
||||
|
||||
|
||||
add_filter( 'timber/integrations', function ( array $integrations ): array { |
||||
$integrations[] = new \Timber\Integrations\WooCommerce\WooCommerceIntegration(); |
||||
return $integrations; |
||||
} ); |
||||
|
||||
add_action('timber/init', function() { |
||||
// Инициализируем WooCommerce интеграцию |
||||
if (class_exists('Timber\Integrations\WooCommerce\WooCommerce')) { |
||||
Timber\Integrations\WooCommerce\WooCommerce::init(); |
||||
} |
||||
}); |
||||
|
||||
|
||||
// Add the function to the Timber context |
||||
add_filter('timber/context', function($context) { |
||||
$context['template_path'] = get_template_directory_uri(); |
||||
$current_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
||||
$context['current_url'] = htmlspecialchars($current_url); |
||||
return $context; |
||||
}); |
||||
|
||||
|
||||
add_action('init', function() { |
||||
add_filter('timber/context', function($context) { |
||||
$context['current_lang'] = pll_current_language(); |
||||
return $context; |
||||
}); |
||||
}, 1); |
||||
<? |
||||
|
||||
use Timber; |
||||
use Timber\PostCollection; |
||||
use Timber\Integrations\WooCommerce\Product as TimberProduct; |
||||
|
||||
|
||||
Timber::$dirname = [ |
||||
'views', |
||||
'modules' |
||||
]; |
||||
|
||||
// Настройка путей для WooCommerce шаблонов |
||||
add_filter('timber/loader/paths', function($paths) { |
||||
$paths[] = get_template_directory() . '/views/woocommerce'; |
||||
return $paths; |
||||
}); |
||||
|
||||
add_filter( 'timber/integrations', function ( array $integrations ): array { |
||||
$integrations[] = new \Timber\Integrations\WooCommerce\WooCommerceIntegration(); |
||||
return $integrations; |
||||
} ); |
||||
|
||||
|
||||
// Add the function to the Timber context |
||||
add_filter('timber/context', function($context) { |
||||
$context['template_path'] = get_template_directory_uri(); |
||||
$current_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
||||
$context['current_url'] = htmlspecialchars($current_url); |
||||
|
||||
// Добавляем WooCommerce контекст если WooCommerce активен |
||||
if (class_exists('WooCommerce')) { |
||||
// WooCommerce автоматически добавляет свой контекст через интеграцию |
||||
// Но мы можем его расширить |
||||
if (is_woocommerce()) { |
||||
$context['is_woocommerce'] = true; |
||||
} |
||||
} |
||||
|
||||
return $context; |
||||
}); |
||||
|
||||
|
||||
add_action('init', function() { |
||||
add_filter('timber/context', function($context) { |
||||
$context['current_lang'] = pll_current_language(); |
||||
|
||||
// Добавляем функцию для получения иконки термина |
||||
$context['get_term_icon'] = function($term_id, $taxonomy) { |
||||
$product = new CosmopetProduct(); |
||||
return $product->getTermIcon($term_id, $taxonomy); |
||||
}; |
||||
|
||||
return $context; |
||||
}); |
||||
}, 1); |
||||
|
@ -0,0 +1,26 @@ |
||||
{% set in_stock = post.meta('_stock_status') == 'instock' %} |
||||
|
||||
{% set cart_quantity = post.getCartQuantity %} |
||||
{% if in_stock %} |
||||
{% if post.getCartQuantity == 0 %} |
||||
{{ function('do_action', 'woocommerce_' ~ post.product.get_type() ~ '_add_to_cart') }} |
||||
{% else %} |
||||
<div class="product-incart__wrap" data-product-id="{{ post.id }}"> |
||||
<div class="product-incart counter"> |
||||
<button class="product-incart__btn product-incart__btn--minus" data-key="{{post.getCartItemKey}}" data-action="decrease"></button> |
||||
|
||||
<div class="product-incart__count" data-key="{{post.getCartItemKey}}">{{ cart_quantity }}</div> |
||||
<button class="product-incart__btn product-incart__btn--plus" data-key="{{post.getCartItemKey}}" data-action="increase"></button> |
||||
</div> |
||||
<div class="product-incart__label"> |
||||
{{fn('pll_e', 'В корзине')}} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
{% else %} |
||||
<div class="detail-block-form__item detail-block-form__item--tn"> |
||||
<button type="button" data-pname="{{ product.title }}" class="to-know open-to-know" > |
||||
<p>{{ function('pll_e', 'Узнать о поступлении') }}</p> |
||||
</button> |
||||
</div> |
||||
{% endif %} |
@ -1,321 +1,326 @@ |
||||
{% set bodyClass = 'bg-white' %} |
||||
{% set mainClass = '' %} |
||||
{% extends 'layout.twig' %} |
||||
|
||||
{% block content %} |
||||
<div class="product-single"> |
||||
<div class="wrapper"> |
||||
<div class="breadcrumbs"> |
||||
<a href="{{ fn('home_url') }}" class="breadcrumbs__item"> |
||||
{{ fn('pll_e', 'Главная') }} |
||||
</a> |
||||
{% set product_categories = post.get_terms('product_cat') %} |
||||
{% if product_categories %} |
||||
{% set category = product_categories[0] %} |
||||
<a href="{{ category.link }}" class="breadcrumbs__item"> |
||||
{{ category.name }} |
||||
</a> |
||||
{% endif %} |
||||
<a href="{{post.link}}" class="breadcrumbs__item"> |
||||
{{post.title}} |
||||
</a> |
||||
</div> |
||||
<div class="product_main {{ post.getTasteClass() }}"> |
||||
<div class="product-info"> |
||||
<h1 class="product-title --pc"> |
||||
{{post.title}} |
||||
</h1> |
||||
<div class="product-contains"> |
||||
<h2 class="product-block-title">{{ fn('pll_e', 'СОСТАВ') }}</h2> |
||||
<div class="product-contains-text">{{ post.getComposition }}</div> |
||||
</div> |
||||
<div class="product-values"> |
||||
<h2 class="product-values-title">{{ fn('pll_e', 'ПИЩЕВАЯ ЦЕННОСТЬ') }}</h2> |
||||
<div class="product-values-list"> |
||||
|
||||
{% set nutritional_value = post.nutritional_value %} |
||||
{% if nutritional_value.protein %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Сырой белок') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.protein}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.fat %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Сырой жир') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.fat}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.fiber %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Сырая клетчатка') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.fiber}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.ash %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Сырая зола') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.ash}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.wat %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Влажность') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.wat}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.calcium %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Кальций') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.calcium}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.phosphorus %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Фосфор') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.phosphorus}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.omega_6 %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Омега 6') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.omega_6}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.omega_3 %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Омега 3') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.omega_3}}</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{% set vitamins = post.vitamins %} |
||||
{% if vitamins %} |
||||
<div class="product-vitamins"> |
||||
<div class="product-vitamins-title"> |
||||
{{ fn('pll_e', 'Витамины на кг') }} |
||||
</div> |
||||
<div class="product-vitamins-list"> |
||||
|
||||
{% if vitamins.vitamin_a_me %} |
||||
<div class="product-vitamins-item">A, ME — {{vitamins.vitamin_a_me}}</div> |
||||
{% endif %} |
||||
{% if vitamins.vitamin_d3_me %} |
||||
<div class="product-vitamins-item">D3, ME — {{vitamins.vitamin_d3_me}}</div> |
||||
{% endif %} |
||||
{% if vitamins.vitamin_e %} |
||||
<div class="product-vitamins-item">E — {{vitamins.vitamin_e}}</div> |
||||
{% endif %} |
||||
{% if vitamins.tiamin %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Тиамин') }} — {{vitamins.tiamin}}</div> |
||||
{% endif %} |
||||
{% if vitamins.riboflavin %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Рибофлавин') }} — {{vitamins.riboflavin}}</div> |
||||
{% endif %} |
||||
{% if vitamins.pantothenic_acid %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Пантотеновая кислота') }} — {{vitamins.pantothenic_acid}}</div> |
||||
{% endif %} |
||||
{% if vitamins.niaczin %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Ниацин') }} — {{vitamins.niaczin}}</div> |
||||
{% endif %} |
||||
{% if vitamins.piridoksin %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Пиридоксин') }} — {{vitamins.piridoksin}}</div> |
||||
{% endif %} |
||||
{% if vitamins.folic_acid %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Фолиевая кислота') }} — {{vitamins.folic_acid}}</div> |
||||
{% endif %} |
||||
{% if vitamins.vitamin_b12 %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Витамин B12') }} — {{vitamins.vitamin_b12}}</div> |
||||
{% endif %} |
||||
{% if vitamins.holin %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Холин') }} — {{vitamins.holin}}</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
<div class="product-show"> |
||||
<div class="product-gallery"> |
||||
<div class="swiper product-gallery__mainSlider"> |
||||
<div class="swiper-wrapper"> |
||||
{% set image_list = post.getImageGallery('full') %} |
||||
{% for image in image_list %} |
||||
<div class="swiper-slide"> |
||||
<img src="{{ image.url }}" alt="{{image.alt}}"> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
<div thumbsSlider="" class="swiper product-gallery__thumbsSlider"> |
||||
<div class="swiper-wrapper"> |
||||
{% set image_list = post.getImageGallery('medium') %} |
||||
{% for image in image_list %} |
||||
<div class="swiper-slide"> |
||||
<img src="{{ image.url }}" alt="{{image.alt}}"> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="product-gallery-arrows"> |
||||
<button class="product-gallery-arrow product-gallery-prev"></button> |
||||
<button class="product-gallery-arrow product-gallery-next"></button> |
||||
</div> |
||||
</div> |
||||
<div class="product-gallery-bullets"></div> |
||||
</div> |
||||
<h1 class="product-title --m"> |
||||
{{post.title}} |
||||
</h1> |
||||
</div> |
||||
<div class="product-constructor"> |
||||
{% set constructor = post.getProductConstructor %} |
||||
{% for taxonomy, attribute_data in constructor %} |
||||
<div class="product-constructor__block"> |
||||
<div class="product-constructor__block-title">{{attribute_data.label}}</div> |
||||
<div class="product-constructor__block-list"> |
||||
{% for option_id, option in attribute_data.options %} |
||||
{% set first_product = option.products[0] %} |
||||
<a href="{{first_product.link}}" class="product-constructor__block-item{% if attribute_data.current_value == option.term_id %} active{% endif %}"> |
||||
{% if taxonomy == 'pa_compound' %} |
||||
{% set icon_map = { |
||||
'govyadina': 'beef', |
||||
'indejka': 'turkey', |
||||
'krolik': 'rabbit', |
||||
'losos': 'salmon', |
||||
'ryba': 'fish', |
||||
'utka': 'duck', |
||||
'yagnenok': 'lamb' |
||||
} %} |
||||
{% set icon_class = icon_map[option.slug] ?? 'default' %} |
||||
<img src="/wp-content/themes/cosmopet/modules/shop/components/single-product_new/assets/img/{{icon_class}}.svg" alt="" class="product-constructor__block-item-icon{% if attribute_data.current_value == option.term_id %} active{% endif %} svg"> |
||||
{% elseif taxonomy == 'pa_age-of-the-dog' %} |
||||
<img src="/wp-content/themes/cosmopet/modules/shop/components/single-product_new/assets/img/dog-face.svg" alt="" class="product-constructor__block-item-icon{% if attribute_data.current_value == option.term_id %} active{% endif %} svg"> |
||||
{% elseif taxonomy == 'pa_age-of-the-cat' %} |
||||
<img src="/wp-content/themes/cosmopet/modules/shop/components/single-product_new/assets/img/cat-face.svg" alt="" class="product-constructor__block-item-icon{% if attribute_data.current_value == option.term_id %} active{% endif %} svg"> |
||||
{% elseif taxonomy == 'pa_reproductive-status' %} |
||||
<img src="/wp-content/themes/cosmopet/modules/shop/components/single-product_new/assets/img/heart.svg" alt="" class="product-constructor__block-item-icon{% if attribute_data.current_value == option.term_id %} active{% endif %} svg"> |
||||
{% elseif taxonomy == 'pa_series' %} |
||||
<img src="/wp-content/themes/cosmopet/modules/shop/components/single-product_new/assets/img/star.svg" alt="" class="product-constructor__block-item-icon{% if attribute_data.current_value == option.term_id %} active{% endif %} svg"> |
||||
{% endif %} |
||||
<div class="product-constructor__block-item-name">{{option.name}}</div> |
||||
</a> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
|
||||
{% set size_siblings = post.getSizeSiblings %} |
||||
{% if size_siblings %} |
||||
<div class="product-constructor__block"> |
||||
<div class="product-constructor__block-title">{{fn('pll_e', 'ВЕС УПАКОВКИ')}}</div> |
||||
<div class="product-constructor__block-list"> |
||||
{% for sibling in size_siblings %} |
||||
<a href="{{sibling.link}}" class="product-constructor__block-item{% if post.get_weight == sibling.get_weight %} active{% endif %}"> |
||||
<div class="product-constructor__block-item-name">{{sibling.get_weight}}</div> |
||||
</a> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
<div class="product-price"> |
||||
<div class="product-price-main"> |
||||
{{post.getPrice}} |
||||
</div> |
||||
{% if post.getRegularPrice %} |
||||
<div class="product-price-disc"> |
||||
<div class="product-price-old">{{post.getRegularPrice}}</div> |
||||
<div class="product-price-percent"> |
||||
{{ post.getPriceDifferenceInPercent }} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{% set in_stock = post.meta('_stock_status') == 'instock' %} |
||||
{% if in_stock %} |
||||
{{ function('do_action', 'woocommerce_' ~ product.get_type() ~ '_add_to_cart') }} |
||||
{% else %} |
||||
<div class="detail-block-form__item detail-block-form__item--tn"> |
||||
<button type="button" data-pname="{{ product.title }}" class="to-know open-to-know" > |
||||
<p>{{ function('pll_e', 'Узнать о поступлении') }}</p> |
||||
</button> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="product-desc"> |
||||
<div class="product-block-title"> |
||||
{{ fn('pll_e', 'ОПИСАНИЕ') }} |
||||
</div> |
||||
<div class="product-desc-text"> |
||||
{{post.content}} |
||||
|
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="product-reviews"> |
||||
<div class="product-reviews__head wrapper"> |
||||
<div class="product-block-title"> |
||||
{{ fn('pll_e', 'Отзывы Специалистов') }} |
||||
</div> |
||||
<div class="product-block-arrows"> |
||||
<button class="slider-button-prev slider-button product-reviews-prev"></button> |
||||
<button class="slider-button-next slider-button product-reviews-next"></button> |
||||
</div> |
||||
</div> |
||||
<div class="product-reviews-slider swiper"> |
||||
<div class="swiper-wrapper"> |
||||
{% for slide in post.getReviews %} |
||||
{% include "shop/reviews-slide_element.twig" with {slide: slide} %} |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="product-block-arrows--m"> |
||||
<button class="slider-button-prev slider-button product-reviews-prev"></button> |
||||
<button class="slider-button-next slider-button product-reviews-next"></button> |
||||
</div> |
||||
</div> |
||||
|
||||
{% if post.getRelatedProducts %} |
||||
<div class="product-similar "> |
||||
<div class="product-similar__head wrapper"> |
||||
<div class="product-block-title"> |
||||
{{ fn('pll_e', 'вашему питомцу может понравиться') }} |
||||
</div> |
||||
<div class="product-block-arrows"> |
||||
<button class="slider-button-prev slider-button product-similar-prev"></button> |
||||
<button class="slider-button-next slider-button product-similar-next"></button> |
||||
</div> |
||||
|
||||
</div> |
||||
<div class="product-similar-slider wrapper"> |
||||
<div class="swiper-wrapper"> |
||||
{% for related_product in post.getRelatedProducts %} |
||||
|
||||
{% set class = related_product.getTasteClass %} |
||||
{% set section = class ~ ' swiper-slide' %} |
||||
|
||||
<!-- TO_DO (избавиться от wc_get_product) --> |
||||
{% include 'shop/product-card.twig' with {_product : fn('wc_get_product', related_product.id), section: section} %} |
||||
|
||||
|
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
<div class="product-block-arrows--m"> |
||||
<button class="slider-button-prev slider-button product-similar-prev"></button> |
||||
<button class="slider-button-next slider-button product-similar-next"></button> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
</div> |
||||
{% for slide in reviews %} |
||||
|
||||
{% include 'modal/rewiew_modal.twig' with {slide : slide} %} |
||||
|
||||
{% endfor %} |
||||
{% set bodyClass = 'bg-white' %} |
||||
{% set mainClass = '' %} |
||||
{% extends 'layout.twig' %} |
||||
|
||||
{% block content %} |
||||
<div class="product-single" data-product-id="{{ post.id }}"> |
||||
<div class="wrapper"> |
||||
<div class="breadcrumbs"> |
||||
<a href="{{ fn('home_url') }}" class="breadcrumbs__item"> |
||||
{{ fn('pll_e', 'Главная') }} |
||||
</a> |
||||
{% set product_categories = post.get_terms('product_cat') %} |
||||
{% if product_categories %} |
||||
{% set category = product_categories[0] %} |
||||
<a href="{{ category.link }}" class="breadcrumbs__item"> |
||||
{{ category.name }} |
||||
</a> |
||||
{% endif %} |
||||
<a href="{{post.link}}" class="breadcrumbs__item"> |
||||
{{post.title}} |
||||
</a> |
||||
</div> |
||||
<div class="product_main {{ post.getTasteClass() }}"> |
||||
<div class="product-info"> |
||||
<h1 class="product-title --pc"> |
||||
{{post.title}} |
||||
</h1> |
||||
<div class="product-contains"> |
||||
<h2 class="product-block-title">{{ fn('pll_e', 'СОСТАВ') }}</h2> |
||||
<div class="product-contains-text">{{ post.getComposition }}</div> |
||||
</div> |
||||
{% set nutritional_value = post.nutritional_value %} |
||||
{% set vitamins = post.vitamins %} |
||||
{% if nutritional_value or vitamins %} |
||||
<div class="product-values"> |
||||
{% if nutritional_value %} |
||||
<h2 class="product-values-title">{{ fn('pll_e', 'ПИЩЕВАЯ ЦЕННОСТЬ') }}</h2> |
||||
<div class="product-values-list"> |
||||
|
||||
{% if nutritional_value.protein %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Сырой белок') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.protein}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.fat %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Сырой жир') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.fat}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.fiber %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Сырая клетчатка') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.fiber}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.ash %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Сырая зола') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.ash}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.wat %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Влажность') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.wat}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.calcium %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Кальций') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.calcium}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.phosphorus %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Фосфор') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.phosphorus}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.omega_6 %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Омега 6') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.omega_6}}</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if nutritional_value.omega_3 %} |
||||
<div class="product-values-item"> |
||||
<div class="product-values-item__name">{{ fn('pll_e', 'Омега 3') }}</div> |
||||
<div class="product-values-item-val">{{nutritional_value.omega_3}}</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{% endif %} |
||||
{% set vitamins = post.vitamins %} |
||||
{% if vitamins %} |
||||
<div class="product-vitamins"> |
||||
<div class="product-vitamins-title"> |
||||
{{ fn('pll_e', 'Витамины на кг') }} |
||||
</div> |
||||
<div class="product-vitamins-list"> |
||||
|
||||
{% if vitamins.vitamin_a_me %} |
||||
<div class="product-vitamins-item">A, ME — {{vitamins.vitamin_a_me}}</div> |
||||
{% endif %} |
||||
{% if vitamins.vitamin_d3_me %} |
||||
<div class="product-vitamins-item">D3, ME — {{vitamins.vitamin_d3_me}}</div> |
||||
{% endif %} |
||||
{% if vitamins.vitamin_e %} |
||||
<div class="product-vitamins-item">E — {{vitamins.vitamin_e}}</div> |
||||
{% endif %} |
||||
{% if vitamins.tiamin %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Тиамин') }} — {{vitamins.tiamin}}</div> |
||||
{% endif %} |
||||
{% if vitamins.riboflavin %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Рибофлавин') }} — {{vitamins.riboflavin}}</div> |
||||
{% endif %} |
||||
{% if vitamins.pantothenic_acid %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Пантотеновая кислота') }} — {{vitamins.pantothenic_acid}}</div> |
||||
{% endif %} |
||||
{% if vitamins.niaczin %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Ниацин') }} — {{vitamins.niaczin}}</div> |
||||
{% endif %} |
||||
{% if vitamins.piridoksin %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Пиридоксин') }} — {{vitamins.piridoksin}}</div> |
||||
{% endif %} |
||||
{% if vitamins.folic_acid %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Фолиевая кислота') }} — {{vitamins.folic_acid}}</div> |
||||
{% endif %} |
||||
{% if vitamins.vitamin_b12 %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Витамин B12') }} — {{vitamins.vitamin_b12}}</div> |
||||
{% endif %} |
||||
{% if vitamins.holin %} |
||||
<div class="product-vitamins-item">{{ fn('pll_e', 'Холин') }} — {{vitamins.holin}}</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
<div class="product-show"> |
||||
<div class="product-gallery"> |
||||
<div class="swiper product-gallery__mainSlider"> |
||||
<div class="swiper-wrapper"> |
||||
{% set image_list = post.getImageGallery('full') %} |
||||
{% for image in image_list %} |
||||
<div class="swiper-slide"> |
||||
<img src="{{ image.url }}" alt="{{image.alt}}"> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
<div thumbsSlider="" class="swiper product-gallery__thumbsSlider"> |
||||
<div class="swiper-wrapper"> |
||||
{% set image_list = post.getImageGallery('medium') %} |
||||
{% for image in image_list %} |
||||
<div class="swiper-slide"> |
||||
<img src="{{ image.url }}" alt="{{image.alt}}"> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="product-gallery-arrows"> |
||||
<button class="product-gallery-arrow product-gallery-prev"></button> |
||||
<button class="product-gallery-arrow product-gallery-next"></button> |
||||
</div> |
||||
</div> |
||||
<div class="product-gallery-bullets"></div> |
||||
</div> |
||||
<h1 class="product-title --m"> |
||||
{{post.title}} |
||||
</h1> |
||||
</div> |
||||
<div class="product-constructor"> |
||||
{% set constructor = post.getProductConstructor %} |
||||
{% for taxonomy, attribute_data in constructor %} |
||||
{% if taxonomy != 'pa_series' %} |
||||
<div class="product-constructor__block"> |
||||
<div class="product-constructor__block-title">{{attribute_data.label}}</div> |
||||
<div class="product-constructor__block-list"> |
||||
{% for option_id, option in attribute_data.options %} |
||||
{% set first_product = option.products[0] %} |
||||
<a href="{{first_product.link}}" class="product-constructor__block-item{% if attribute_data.current_value == option.term_id %} active{% endif %}"> |
||||
{% if option.icon %} |
||||
<img src="{{option.icon}}" alt="" class="product-constructor__block-item-icon{% if attribute_data.current_value == option.term_id %} active{% endif %} svg"> |
||||
{% endif %} |
||||
<div class="product-constructor__block-item-name">{{option.name}}</div> |
||||
</a> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
{% endfor %} |
||||
|
||||
{% set size_siblings = post.getSizeSiblings %} |
||||
{% if size_siblings %} |
||||
<div class="product-constructor__block"> |
||||
<div class="product-constructor__block-title">{{fn('pll_e', 'ВЕС УПАКОВКИ')}}</div> |
||||
<div class="product-constructor__block-list"> |
||||
{% for sibling in size_siblings %} |
||||
<a href="{{sibling.link}}" class="product-constructor__block-item{% if post.get_weight == sibling.get_weight %} active{% endif %}"> |
||||
<div class="product-constructor__block-item-name">{{sibling.get_weight}}</div> |
||||
</a> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{# Отображаем pa_series после вариантов веса #} |
||||
{% for taxonomy, attribute_data in constructor %} |
||||
{% if taxonomy == 'pa_series' %} |
||||
<div class="product-constructor__block"> |
||||
<div class="product-constructor__block-title">{{attribute_data.label}}</div> |
||||
<div class="product-constructor__block-list"> |
||||
{% for option_id, option in attribute_data.options %} |
||||
{% set first_product = option.products[0] %} |
||||
<a href="{{first_product.link}}" class="product-constructor__block-item{% if attribute_data.current_value == option.term_id %} active{% endif %}"> |
||||
{% if option.icon %} |
||||
<img src="{{option.icon}}" alt="" class="product-constructor__block-item-icon{% if attribute_data.current_value == option.term_id %} active{% endif %} svg"> |
||||
{% endif %} |
||||
<div class="product-constructor__block-item-name">{{option.name}}</div> |
||||
</a> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
{% endfor %} |
||||
|
||||
<div class="product-price"> |
||||
<div class="product-price-main"> |
||||
{{post.getPrice}} |
||||
</div> |
||||
{% if post.getRegularPrice %} |
||||
<div class="product-price-disc"> |
||||
<div class="product-price-old">{{post.getRegularPrice}}</div> |
||||
<div class="product-price-percent"> |
||||
{{ post.getPriceDifferenceInPercent }} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
|
||||
|
||||
<div id="product-buy-block-wrapper"> |
||||
{% include 'blocks/modules/shop/product-single-add_to_cart.twig' %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="product-desc"> |
||||
<div class="product-block-title"> |
||||
{{ fn('pll_e', 'ОПИСАНИЕ') }} |
||||
</div> |
||||
<div class="product-desc-text"> |
||||
{{post.content}} |
||||
|
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% set reviews = post.getReviews %} |
||||
{% if reviews %} |
||||
<div class="product-reviews"> |
||||
<div class="product-reviews__head wrapper"> |
||||
<div class="product-block-title"> |
||||
{{ fn('pll_e', 'Отзывы Специалистов') }} |
||||
</div> |
||||
<div class="product-block-arrows"> |
||||
<button class="slider-button-prev slider-button product-reviews-prev"></button> |
||||
<button class="slider-button-next slider-button product-reviews-next"></button> |
||||
</div> |
||||
</div> |
||||
<div class="product-reviews-slider swiper"> |
||||
<div class="swiper-wrapper"> |
||||
{% for slide in reviews %} |
||||
{% include "shop/reviews-slide_element.twig" with {slide: slide} %} |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="product-block-arrows--m"> |
||||
<button class="slider-button-prev slider-button product-reviews-prev"></button> |
||||
<button class="slider-button-next slider-button product-reviews-next"></button> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
{% if post.getRelatedProducts %} |
||||
<div class="product-similar "> |
||||
<div class="product-similar__head wrapper"> |
||||
<div class="product-block-title"> |
||||
{{ fn('pll_e', 'вашему питомцу может понравиться') }} |
||||
</div> |
||||
<div class="product-block-arrows"> |
||||
<button class="slider-button-prev slider-button product-similar-prev"></button> |
||||
<button class="slider-button-next slider-button product-similar-next"></button> |
||||
</div> |
||||
|
||||
</div> |
||||
<div class="product-similar-slider wrapper"> |
||||
<div class="swiper-wrapper"> |
||||
{% for related_product in post.getRelatedProducts %} |
||||
|
||||
{% set class = related_product.getTasteClass %} |
||||
{% set section = class ~ ' swiper-slide' %} |
||||
|
||||
<!-- TO_DO (избавиться от wc_get_product) --> |
||||
{% include 'shop/product-card.twig' with {_product : fn('wc_get_product', related_product.id), section: section} %} |
||||
|
||||
|
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
<div class="product-block-arrows--m"> |
||||
<button class="slider-button-prev slider-button product-similar-prev"></button> |
||||
<button class="slider-button-next slider-button product-similar-next"></button> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
</div> |
||||
{% for slide in reviews %} |
||||
|
||||
{% include 'modal/rewiew_modal.twig' with {slide : slide} %} |
||||
|
||||
{% endfor %} |
||||
{% endblock %} |
@ -0,0 +1,52 @@ |
||||
<?php |
||||
/** |
||||
* The template for displaying WooCommerce pages |
||||
*/ |
||||
|
||||
if (!defined('ABSPATH')) { |
||||
exit; |
||||
} |
||||
|
||||
$context = Timber::context(); |
||||
|
||||
// Добавляем WooCommerce контекст |
||||
if (class_exists('WooCommerce')) { |
||||
$context['is_woocommerce'] = true; |
||||
$context['is_product'] = is_product(); |
||||
$context['is_shop'] = is_shop(); |
||||
|
||||
// Получаем текущий продукт если это страница товара |
||||
if (is_product()) { |
||||
$context['product'] = wc_get_product(get_the_ID()); |
||||
} |
||||
} |
||||
|
||||
// Определяем какой шаблон использовать |
||||
if (is_product()) { |
||||
$product_id = get_the_ID(); |
||||
$categories = get_the_terms($product_id, 'product_cat'); |
||||
$use_new_template = false; |
||||
|
||||
if ($categories && !is_wp_error($categories)) { |
||||
foreach ($categories as $category) { |
||||
if (in_array($category->slug, ['korm', 'lakomstva'])) { |
||||
$use_new_template = true; |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
|
||||
if ($use_new_template) { |
||||
include_component('shop', 'product-single--new'); |
||||
} else { |
||||
include_component('shop', 'product-single'); |
||||
} |
||||
} elseif (is_shop()) { |
||||
include_component('shop', 'catalog'); |
||||
} elseif (is_product_category()) { |
||||
include_component('shop', 'catalog'); |
||||
} else { |
||||
include_component('shop', 'catalog'); |
||||
} |
||||
|
||||
// Рендеринг уже происходит внутри компонентов, поэтому здесь ничего не нужно |
@ -1,5 +0,0 @@ |
||||
<?php |
||||
|
||||
include_component('shop', 'catalog') |
||||
|
||||
?> |