Andrei | фикс каталога (поместил файлы single страницы в правильные директории удалил лишние файлы которые не использовались)
parent
39ef43e7fd
commit
c74600377a
@ -1,494 +1,494 @@ |
||||
{% set current_path = template_path ~ '/modules/shop/components/single-product' %} |
||||
{% set bodyClass = 'bg-white' %} |
||||
{% set mainClass = 'wrapper' %} |
||||
{% extends 'layout.twig' %} |
||||
|
||||
{% block content %} |
||||
<div class="wrapper"> |
||||
<div class="breadcrumbs"> |
||||
{% if wc_breadcrumbs %} |
||||
{% for crumb in wc_breadcrumbs %} |
||||
<a href="{{ crumb.url }}" class="breadcrumbs__item"> |
||||
{{ crumb.text }} |
||||
</a> |
||||
{% endfor %} |
||||
{% endif %} |
||||
</div> |
||||
|
||||
<a href="{{ fn('get_permalink', fn('wc_get_page_id', 'shop')) }}" class="back back-detail"> |
||||
{{ function('pll_e', 'к каталогу') }} |
||||
</a> |
||||
|
||||
<div class="detail"> |
||||
<div class="detail__images"> |
||||
{% for image in gallery_images %} |
||||
<div class="detail__image detail__image--width-perc-{% if loop.index == 1 or loop.index == 4 %}100{% else %}50{% endif %}" data-count-img="{{ loop.index0 }}"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}" class=""> |
||||
</div> |
||||
{% endfor %} |
||||
<div class="swiper-pagination"></div> |
||||
</div> |
||||
|
||||
<div class="detail__content"> |
||||
|
||||
{# Start | Теги = категории #} |
||||
<div class="detail__label"> |
||||
<div class="detail__label-wrap"> |
||||
{% for tag in product_tags %} |
||||
<div class="product-item-label__tag product-item-label__tag--black"> |
||||
{{ tag }} |
||||
</div> |
||||
{% endfor %} |
||||
|
||||
{% if product_attributes.Flavor is defined and product_attributes.Flavor|length > 0 %} |
||||
<div class="product-item-label__tag product-item-label__tag--black"> |
||||
{{ product_attributes.Flavor[0].name }} |
||||
</div> |
||||
{% endif %} |
||||
{% if product_attributes.Вкус is defined and product_attributes.Вкус|length > 0 %} |
||||
<div class="product-item-label__tag product-item-label__tag--black"> |
||||
<a href="{{ product_attributes.Вкус[0].link }}">{{ product_attributes.Вкус[0].name }}</a> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_attributes.Тег is defined and product_attributes.Тег|length > 0 %} |
||||
<div class="product-item-label__tag product-item-label__tag--title"> |
||||
<a href="{{ product_attributes.Тег[0].link }}">{{ product_attributes.Тег[0].name }}</a> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
</div> |
||||
{% if product.is_on_sale %} |
||||
<div class="product-item-label__tag product-item-label__tag--sale"> |
||||
{{ function('pll_e', 'Распродажа %') }} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{# End | Теги = категории #} |
||||
|
||||
<h1 class="detail__title"> |
||||
{{ product.get_title }} |
||||
</h1> |
||||
|
||||
<div class="detail__images-phone"> |
||||
<div class="swiper-wrapper"> |
||||
{% for image in gallery_images %} |
||||
<div class="swiper-slide"> |
||||
<div class="detail-images-phone__image-block" data-count-img="{{ loop.index0 }}"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}"> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="swiper-pagination"></div> |
||||
</div> |
||||
|
||||
{# Start | Цена для неподписочного товара #} |
||||
{% if product.get_price %} |
||||
<div class="detail__block-price"> |
||||
{% if is_subscription %} |
||||
{% if product.get_regular_price %} |
||||
<div class="detail-block-price__sale"> |
||||
<p class="detail-block-price-sale__text"> |
||||
{{ product.get_regular_price }} {{ fn('get_woocommerce_currency_symbol') }} |
||||
</p> |
||||
<p class="detail-block-price-sale__perc"> |
||||
{{ ((product.get_regular_price - product.get_price) / product.get_regular_price * 100)|round }} |
||||
</p> |
||||
</div> |
||||
{% else %} |
||||
не задана цена по подписке |
||||
{% endif %} |
||||
{% else %} |
||||
<p class="detail-block-price__price"> |
||||
{{ product.get_price }} {{ fn('get_woocommerce_currency_symbol') }} |
||||
{% if product.is_on_sale %} |
||||
|
||||
<div class="detail-block-price__sale"> |
||||
<p class="detail-block-price-sale__text"> |
||||
{{ product.get_regular_price }} {{ fn('get_woocommerce_currency_symbol') }} |
||||
</p> |
||||
<p class="detail-block-price-sale__perc"> |
||||
{% set discount = ((product.get_regular_price - product.get_sale_price) / product.get_regular_price * 100)|round(0, 'floor') %} |
||||
{{ discount }} |
||||
</p> |
||||
</div> |
||||
{% endif %} |
||||
</p> |
||||
{% endif %} |
||||
</div> |
||||
{% endif %} |
||||
{# End | Цена для неподписочного товара #} |
||||
|
||||
{# Start | Кнопка добавить в корзину + варинанты подписки на товар #} |
||||
<form action="" class="detail-block__form" data-product-id="{{ product.id }}"> |
||||
{% set collection = fn('wc_get_product_terms', product.id, 'pa_collection') %} |
||||
{% if collection %} |
||||
{% set siblings = function('get_collection_siblings', collection[0].term_id) %} |
||||
{% if siblings %} |
||||
<div class="detail-block-form__item detail-block-form__item--radio radio-button"> |
||||
{% for sibling in siblings %} |
||||
{% set weight = function('get_product_info', sibling.ID, 'weight') %} |
||||
{% set current_weight = function('get_product_info', product.id, 'weight') %} |
||||
{% set class = weight == current_weight ? 'active' : '' %} |
||||
|
||||
<a |
||||
href="{{ function('get_permalink', sibling.ID) }}" |
||||
class="button button--white button--red-48-px {{ class }}" |
||||
data-product_id="{{ sibling.ID }}" |
||||
data-product_price="{{ function('get_product_info', sibling.ID, 'price') }}" |
||||
> |
||||
{{ weight|upper }} |
||||
</a> |
||||
{% endfor %} |
||||
<input type="text" class="radio-button__input" value="{{ current_weight|upper }}" readonly> |
||||
</div> |
||||
{% endif %} |
||||
{% endif %} |
||||
</form> |
||||
|
||||
{% if product.in_stock %} |
||||
|
||||
{{ function('do_action', 'woocommerce_' ~ product.get_type() ~ '_add_to_cart') }} |
||||
{# Start | Вывод кнопки узнать о поступлении если товара нет в наличии #} |
||||
{% 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 %} |
||||
{# End | Вывод кнопки узнать о поступлении если товара нет в наличии #} |
||||
{# End | Кнопка добавить в корзину + варинанты подписки на товар #} |
||||
|
||||
{# Start | Табы с информацией #} |
||||
<div class="detail__toggle"> |
||||
|
||||
{# Start | Описание товара #} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'ОПИСАНИЕ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
<p class="toggle__text"> |
||||
{{ product.get_description() }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{# End | Описание товара #} |
||||
|
||||
{# Start | Состав товара #} |
||||
{% if product_meta.composition %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'СОСТАВ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
<p class="toggle__text"> |
||||
{{ product_meta.composition }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
{# End | Состав товара #} |
||||
|
||||
{# Start | Рекомендации по кормлению #} |
||||
{% if product_meta.feeding_recommendations_table %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'РЕКОМЕНДАЦИИ ПО КОРМЛЕНИЮ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
|
||||
|
||||
<style> |
||||
.toggle__table { |
||||
width: 100%; |
||||
border-collapse: collapse; |
||||
table-layout: fixed; |
||||
} |
||||
|
||||
.toggle__table th, |
||||
.toggle__table td { |
||||
width: 33.33%; |
||||
vertical-align: top; |
||||
padding: 8px; |
||||
text-align: left; |
||||
} |
||||
|
||||
.toggle-table__title { |
||||
font-weight: bold; |
||||
font-size: 16px; |
||||
} |
||||
|
||||
.toggle-table__item { |
||||
position: relative; |
||||
padding-bottom: 10px; |
||||
} |
||||
|
||||
.toggle-table__item p { |
||||
display: inline-block; |
||||
margin: 0; |
||||
background: #fff; /* подложка, если нужно перекрыть линию */ |
||||
padding-right: 4px; |
||||
z-index: 1; |
||||
position: relative; |
||||
} |
||||
|
||||
/* Линия-многоточие */ |
||||
.toggle-table-item__line { |
||||
position: absolute; |
||||
left: 0; |
||||
bottom: 4px; |
||||
width: 100%; |
||||
border-bottom: 1px dotted #aaa; |
||||
z-index: 0; |
||||
} |
||||
|
||||
/* Адаптив */ |
||||
@media (max-width: 768px) { |
||||
.toggle__table th, |
||||
.toggle__table td { |
||||
font-size: 14px; |
||||
padding: 6px; |
||||
} |
||||
} |
||||
|
||||
/* Maks */ |
||||
.toggle__table tbody, |
||||
.toggle__table thead, |
||||
.toggle__table thead tr{ |
||||
width: 100%; |
||||
} |
||||
.toggle__table thead tr{ |
||||
display:flex; |
||||
} |
||||
.toggle__table tbody tr{ |
||||
display: flex; |
||||
gap: 8px; |
||||
} |
||||
</style> |
||||
|
||||
|
||||
<table class="toggle__table toggle__table--three"> |
||||
{% if product_meta.feeding_recommendations_table.header is defined %} |
||||
<thead> |
||||
<tr> |
||||
{% for col in product_meta.feeding_recommendations_table.header %} |
||||
<th class="toggle-table__title">{{ col.c }}</th> |
||||
{% endfor %} |
||||
</tr> |
||||
</thead> |
||||
{% endif %} |
||||
<tbody> |
||||
{% for row in product_meta.feeding_recommendations_table.body %} |
||||
<tr> |
||||
{% for cell in row %} |
||||
<td class="toggle-table__item"> |
||||
<p>{{ cell.c }}</p> |
||||
<div class="toggle-table-item__line"></div> |
||||
</td> |
||||
{% endfor %} |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
|
||||
|
||||
|
||||
|
||||
{# Старая таблица #} |
||||
{# <div class="toggle__table toggle__table--three"> |
||||
{% if product_meta.feeding_recommendations_table.header %} |
||||
<div class="toggle-table__block"> |
||||
<p class="toggle-table__title">{{ product_meta.feeding_recommendations_table.header.0 is iterable ? product_meta.feeding_recommendations_table.header.0|join(', ') : product_meta.feeding_recommendations_table.header.0 }}</p> |
||||
{% for row in product_meta.feeding_recommendations_table.body %} |
||||
<div class="toggle-table__item"> |
||||
<p>{{ row.0 is iterable ? row.0|join(', ') : row.0 }}</p> |
||||
<div class="toggle-table-item__line"></div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="toggle-table__block"> |
||||
<p class="toggle-table__title">{{ product_meta.feeding_recommendations_table.header.1 is iterable ? product_meta.feeding_recommendations_table.header.1|join(', ') : product_meta.feeding_recommendations_table.header.1 }}</p> |
||||
{% for row in product_meta.feeding_recommendations_table.body %} |
||||
<div class="toggle-table__item"> |
||||
<p>{{ row.1 is iterable ? row.1|join(', ') : row.1 }}</p> |
||||
<div class="toggle-table-item__line"></div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="toggle-table__block"> |
||||
<p class="toggle-table__title">{{ product_meta.feeding_recommendations_table.header.2 is iterable ? product_meta.feeding_recommendations_table.header.2|join(', ') : product_meta.feeding_recommendations_table.header.2 }}</p> |
||||
{% for row in product_meta.feeding_recommendations_table.body %} |
||||
<div class="toggle-table__item"> |
||||
<p>{{ row.2 is iterable ? row.2|join(', ') : row.2 }}</p> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
{% endif %} |
||||
</div> #} |
||||
|
||||
|
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% elseif product_meta.feeding_recommendations %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'РЕКОМЕНДАЦИИ ПО КОРМЛЕНИЮ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
{{ product_meta.feeding_recommendations }} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
{# End | Рекомендации по кормлению #} |
||||
|
||||
{% if product_meta.nutritional_value or product_meta.vitamins or product_meta.additives or product_meta.energy_value %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'ПИЩЕВАЯ ЦЕННОСТЬ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
{% if product_meta.nutritional_value and product_meta.vitamins %} |
||||
<div class="toggle__table toggle__table--two"> |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ПИЩЕВАЯ ЦЕННОСТЬ') }}</p> |
||||
{{ product_meta.nutritional_value }} |
||||
</div> |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ВИТАМИНЫ НА КГ') }}</p> |
||||
{{ product_meta.vitamins }} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_meta.additives or product_meta.energy_value %} |
||||
<div class="toggle__table toggle__table--two"> |
||||
{% if product_meta.additives %} |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ПИТАТЕЛЬНЫЕ ДОБАВКИ НА КГ') }}</p> |
||||
{{ product_meta.additives }} |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_meta.energy_value %} |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ЭНЕРГЕТИЧЕСКАЯ ЦЕННОСТЬ НА 100 ГРАММ') }}</p> |
||||
<div class="toggle-table__item"> |
||||
<div class="detail__warning warning"> |
||||
<div class="detail-warning__content"> |
||||
<p class="detail-warning__title">{{ product_meta.energy_value }}</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{# End | Табы с информацией #} |
||||
|
||||
{% if product_meta.important %} |
||||
<div class="detail__warning"> |
||||
<div class="detail-warning__content"> |
||||
<p class="detail-warning__title">{{ function('pll_e', 'Важно') }}</p> |
||||
<p class="detail-warning__text"> |
||||
{{ product_meta.important }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
|
||||
<div class="product__main"> |
||||
{% set recommended_products = function('get_field', 'recommended_products', product.id) %} |
||||
{% set related_products = recommended_products ? recommended_products : function('wc_get_related_products', product.id, 4) %} |
||||
{% if related_products %} |
||||
<div class="detail__wrapper-catalot"> |
||||
<div class="detail__catalot"> |
||||
<div class="detail-catalot__header"> |
||||
<p class="detail-catalot__title"> |
||||
{{ function('pll_e', 'вашему питомцу может понравиться') }} |
||||
</p> |
||||
|
||||
<div class="detail-catalot__control"> |
||||
<button class="detail-catalot-control__button prev"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-left.svg" alt=""> |
||||
</button> |
||||
|
||||
<button class="detail-catalot-control__button next"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-right.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
<div class="detail-catalot__content swiper-wrapper"> |
||||
{% for related_product in related_products %} |
||||
<div class="swiper-slide"> |
||||
{% set post_id = related_product.ID is defined ? related_product.ID : related_product %} |
||||
{% set wc_product = fn('wc_get_product', post_id) %} |
||||
{% if wc_product %} |
||||
{% include '_blocks/shop/archive-product-tease.twig' with {post: wc_product} %} |
||||
{% endif %} |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<div class="gallery"> |
||||
<button class="gallery__close gallery-button"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
|
||||
<div class="gallery__wrapper"> |
||||
<div class="gallery__pagination"> |
||||
{% for image in gallery_images %} |
||||
<button class="gallery-pagination__item" data-count-img="{{ loop.index0 }}"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}"> |
||||
</button> |
||||
{% endfor %} |
||||
</div> |
||||
|
||||
<div class="gallery__slider swiper"> |
||||
<div class="swiper-wrapper"> |
||||
{% for image in gallery_images %} |
||||
<div class="swiper-slide"> |
||||
<div class="gallery__block"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}"> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
|
||||
<div class="swiper-pagination"></div> |
||||
|
||||
<div class="swiper-button-prev gallery-button"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-left.svg" alt=""> |
||||
</div> |
||||
<div class="swiper-button-next gallery-button"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-right.svg" alt=""> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
{% set current_path = template_path ~ '/modules/shop/components/single-product' %} |
||||
{% set bodyClass = 'bg-white' %} |
||||
{% set mainClass = 'wrapper' %} |
||||
{% extends 'layout.twig' %} |
||||
|
||||
{% block content %} |
||||
<div class="wrapper"> |
||||
<div class="breadcrumbs"> |
||||
{% if wc_breadcrumbs %} |
||||
{% for crumb in wc_breadcrumbs %} |
||||
<a href="{{ crumb.url }}" class="breadcrumbs__item"> |
||||
{{ crumb.text }} |
||||
</a> |
||||
{% endfor %} |
||||
{% endif %} |
||||
</div> |
||||
|
||||
<a href="{{ fn('get_permalink', fn('wc_get_page_id', 'shop')) }}" class="back back-detail"> |
||||
{{ function('pll_e', 'к каталогу') }} |
||||
</a> |
||||
|
||||
<div class="detail"> |
||||
<div class="detail__images"> |
||||
{% for image in gallery_images %} |
||||
<div class="detail__image detail__image--width-perc-{% if loop.index == 1 or loop.index == 4 %}100{% else %}50{% endif %}" data-count-img="{{ loop.index0 }}"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}" class=""> |
||||
</div> |
||||
{% endfor %} |
||||
<div class="swiper-pagination"></div> |
||||
</div> |
||||
|
||||
<div class="detail__content"> |
||||
|
||||
{# Start | Теги = категории #} |
||||
<div class="detail__label"> |
||||
<div class="detail__label-wrap"> |
||||
{% for tag in product_tags %} |
||||
<div class="product-item-label__tag product-item-label__tag--black"> |
||||
{{ tag }} |
||||
</div> |
||||
{% endfor %} |
||||
|
||||
{% if product_attributes.Flavor is defined and product_attributes.Flavor|length > 0 %} |
||||
<div class="product-item-label__tag product-item-label__tag--black"> |
||||
{{ product_attributes.Flavor[0].name }} |
||||
</div> |
||||
{% endif %} |
||||
{% if product_attributes.Вкус is defined and product_attributes.Вкус|length > 0 %} |
||||
<div class="product-item-label__tag product-item-label__tag--black"> |
||||
<a href="{{ product_attributes.Вкус[0].link }}">{{ product_attributes.Вкус[0].name }}</a> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_attributes.Тег is defined and product_attributes.Тег|length > 0 %} |
||||
<div class="product-item-label__tag product-item-label__tag--title"> |
||||
<a href="{{ product_attributes.Тег[0].link }}">{{ product_attributes.Тег[0].name }}</a> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
</div> |
||||
{% if product.is_on_sale %} |
||||
<div class="product-item-label__tag product-item-label__tag--sale"> |
||||
{{ function('pll_e', 'Распродажа %') }} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{# End | Теги = категории #} |
||||
|
||||
<h1 class="detail__title"> |
||||
{{ product.get_title }} |
||||
</h1> |
||||
|
||||
<div class="detail__images-phone"> |
||||
<div class="swiper-wrapper"> |
||||
{% for image in gallery_images %} |
||||
<div class="swiper-slide"> |
||||
<div class="detail-images-phone__image-block" data-count-img="{{ loop.index0 }}"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}"> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="swiper-pagination"></div> |
||||
</div> |
||||
|
||||
{# Start | Цена для неподписочного товара #} |
||||
{% if product.get_price %} |
||||
<div class="detail__block-price"> |
||||
{% if is_subscription %} |
||||
{% if product.get_regular_price %} |
||||
<div class="detail-block-price__sale"> |
||||
<p class="detail-block-price-sale__text"> |
||||
{{ product.get_regular_price }} {{ fn('get_woocommerce_currency_symbol') }} |
||||
</p> |
||||
<p class="detail-block-price-sale__perc"> |
||||
{{ ((product.get_regular_price - product.get_price) / product.get_regular_price * 100)|round }} |
||||
</p> |
||||
</div> |
||||
{% else %} |
||||
не задана цена по подписке |
||||
{% endif %} |
||||
{% else %} |
||||
<p class="detail-block-price__price"> |
||||
{{ product.get_price }} {{ fn('get_woocommerce_currency_symbol') }} |
||||
{% if product.is_on_sale %} |
||||
|
||||
<div class="detail-block-price__sale"> |
||||
<p class="detail-block-price-sale__text"> |
||||
{{ product.get_regular_price }} {{ fn('get_woocommerce_currency_symbol') }} |
||||
</p> |
||||
<p class="detail-block-price-sale__perc"> |
||||
{% set discount = ((product.get_regular_price - product.get_sale_price) / product.get_regular_price * 100)|round(0, 'floor') %} |
||||
{{ discount }} |
||||
</p> |
||||
</div> |
||||
{% endif %} |
||||
</p> |
||||
{% endif %} |
||||
</div> |
||||
{% endif %} |
||||
{# End | Цена для неподписочного товара #} |
||||
|
||||
{# Start | Кнопка добавить в корзину + варинанты подписки на товар #} |
||||
<form action="" class="detail-block__form" data-product-id="{{ product.id }}"> |
||||
{% set collection = fn('wc_get_product_terms', product.id, 'pa_collection') %} |
||||
{% if collection %} |
||||
{% set siblings = function('get_collection_siblings', collection[0].term_id) %} |
||||
{% if siblings %} |
||||
<div class="detail-block-form__item detail-block-form__item--radio radio-button"> |
||||
{% for sibling in siblings %} |
||||
{% set weight = function('get_product_info', sibling.ID, 'weight') %} |
||||
{% set current_weight = function('get_product_info', product.id, 'weight') %} |
||||
{% set class = weight == current_weight ? 'active' : '' %} |
||||
|
||||
<a |
||||
href="{{ function('get_permalink', sibling.ID) }}" |
||||
class="button button--white button--red-48-px {{ class }}" |
||||
data-product_id="{{ sibling.ID }}" |
||||
data-product_price="{{ function('get_product_info', sibling.ID, 'price') }}" |
||||
> |
||||
{{ weight|upper }} |
||||
</a> |
||||
{% endfor %} |
||||
<input type="text" class="radio-button__input" value="{{ current_weight|upper }}" readonly> |
||||
</div> |
||||
{% endif %} |
||||
{% endif %} |
||||
</form> |
||||
|
||||
{% if product.in_stock %} |
||||
|
||||
{{ function('do_action', 'woocommerce_' ~ product.get_type() ~ '_add_to_cart') }} |
||||
{# Start | Вывод кнопки узнать о поступлении если товара нет в наличии #} |
||||
{% 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 %} |
||||
{# End | Вывод кнопки узнать о поступлении если товара нет в наличии #} |
||||
{# End | Кнопка добавить в корзину + варинанты подписки на товар #} |
||||
|
||||
{# Start | Табы с информацией #} |
||||
<div class="detail__toggle"> |
||||
|
||||
{# Start | Описание товара #} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'ОПИСАНИЕ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
<p class="toggle__text"> |
||||
{{ product.get_description() }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{# End | Описание товара #} |
||||
|
||||
{# Start | Состав товара #} |
||||
{% if product_meta.composition %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'СОСТАВ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
<p class="toggle__text"> |
||||
{{ product_meta.composition }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
{# End | Состав товара #} |
||||
|
||||
{# Start | Рекомендации по кормлению #} |
||||
{% if product_meta.feeding_recommendations_table %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'РЕКОМЕНДАЦИИ ПО КОРМЛЕНИЮ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
|
||||
|
||||
<style> |
||||
.toggle__table { |
||||
width: 100%; |
||||
border-collapse: collapse; |
||||
table-layout: fixed; |
||||
} |
||||
|
||||
.toggle__table th, |
||||
.toggle__table td { |
||||
width: 33.33%; |
||||
vertical-align: top; |
||||
padding: 8px; |
||||
text-align: left; |
||||
} |
||||
|
||||
.toggle-table__title { |
||||
font-weight: bold; |
||||
font-size: 16px; |
||||
} |
||||
|
||||
.toggle-table__item { |
||||
position: relative; |
||||
padding-bottom: 10px; |
||||
} |
||||
|
||||
.toggle-table__item p { |
||||
display: inline-block; |
||||
margin: 0; |
||||
background: #fff; /* подложка, если нужно перекрыть линию */ |
||||
padding-right: 4px; |
||||
z-index: 1; |
||||
position: relative; |
||||
} |
||||
|
||||
/* Линия-многоточие */ |
||||
.toggle-table-item__line { |
||||
position: absolute; |
||||
left: 0; |
||||
bottom: 4px; |
||||
width: 100%; |
||||
border-bottom: 1px dotted #aaa; |
||||
z-index: 0; |
||||
} |
||||
|
||||
/* Адаптив */ |
||||
@media (max-width: 768px) { |
||||
.toggle__table th, |
||||
.toggle__table td { |
||||
font-size: 14px; |
||||
padding: 6px; |
||||
} |
||||
} |
||||
|
||||
/* Maks */ |
||||
.toggle__table tbody, |
||||
.toggle__table thead, |
||||
.toggle__table thead tr{ |
||||
width: 100%; |
||||
} |
||||
.toggle__table thead tr{ |
||||
display:flex; |
||||
} |
||||
.toggle__table tbody tr{ |
||||
display: flex; |
||||
gap: 8px; |
||||
} |
||||
</style> |
||||
|
||||
|
||||
<table class="toggle__table toggle__table--three"> |
||||
{% if product_meta.feeding_recommendations_table.header is defined %} |
||||
<thead> |
||||
<tr> |
||||
{% for col in product_meta.feeding_recommendations_table.header %} |
||||
<th class="toggle-table__title">{{ col.c }}</th> |
||||
{% endfor %} |
||||
</tr> |
||||
</thead> |
||||
{% endif %} |
||||
<tbody> |
||||
{% for row in product_meta.feeding_recommendations_table.body %} |
||||
<tr> |
||||
{% for cell in row %} |
||||
<td class="toggle-table__item"> |
||||
<p>{{ cell.c }}</p> |
||||
<div class="toggle-table-item__line"></div> |
||||
</td> |
||||
{% endfor %} |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
|
||||
|
||||
|
||||
|
||||
{# Старая таблица #} |
||||
{# <div class="toggle__table toggle__table--three"> |
||||
{% if product_meta.feeding_recommendations_table.header %} |
||||
<div class="toggle-table__block"> |
||||
<p class="toggle-table__title">{{ product_meta.feeding_recommendations_table.header.0 is iterable ? product_meta.feeding_recommendations_table.header.0|join(', ') : product_meta.feeding_recommendations_table.header.0 }}</p> |
||||
{% for row in product_meta.feeding_recommendations_table.body %} |
||||
<div class="toggle-table__item"> |
||||
<p>{{ row.0 is iterable ? row.0|join(', ') : row.0 }}</p> |
||||
<div class="toggle-table-item__line"></div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="toggle-table__block"> |
||||
<p class="toggle-table__title">{{ product_meta.feeding_recommendations_table.header.1 is iterable ? product_meta.feeding_recommendations_table.header.1|join(', ') : product_meta.feeding_recommendations_table.header.1 }}</p> |
||||
{% for row in product_meta.feeding_recommendations_table.body %} |
||||
<div class="toggle-table__item"> |
||||
<p>{{ row.1 is iterable ? row.1|join(', ') : row.1 }}</p> |
||||
<div class="toggle-table-item__line"></div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
<div class="toggle-table__block"> |
||||
<p class="toggle-table__title">{{ product_meta.feeding_recommendations_table.header.2 is iterable ? product_meta.feeding_recommendations_table.header.2|join(', ') : product_meta.feeding_recommendations_table.header.2 }}</p> |
||||
{% for row in product_meta.feeding_recommendations_table.body %} |
||||
<div class="toggle-table__item"> |
||||
<p>{{ row.2 is iterable ? row.2|join(', ') : row.2 }}</p> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
{% endif %} |
||||
</div> #} |
||||
|
||||
|
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% elseif product_meta.feeding_recommendations %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'РЕКОМЕНДАЦИИ ПО КОРМЛЕНИЮ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
{{ product_meta.feeding_recommendations }} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
{# End | Рекомендации по кормлению #} |
||||
|
||||
{% if product_meta.nutritional_value or product_meta.vitamins or product_meta.additives or product_meta.energy_value %} |
||||
<div class="toggle"> |
||||
<p class="toggle__title"> |
||||
{{ function('pll_e', 'ПИЩЕВАЯ ЦЕННОСТЬ') }} |
||||
</p> |
||||
<div class="toggle__block-content"> |
||||
<div class="toggle__content"> |
||||
{% if product_meta.nutritional_value and product_meta.vitamins %} |
||||
<div class="toggle__table toggle__table--two"> |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ПИЩЕВАЯ ЦЕННОСТЬ') }}</p> |
||||
{{ product_meta.nutritional_value }} |
||||
</div> |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ВИТАМИНЫ НА КГ') }}</p> |
||||
{{ product_meta.vitamins }} |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_meta.additives or product_meta.energy_value %} |
||||
<div class="toggle__table toggle__table--two"> |
||||
{% if product_meta.additives %} |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ПИТАТЕЛЬНЫЕ ДОБАВКИ НА КГ') }}</p> |
||||
{{ product_meta.additives }} |
||||
</div> |
||||
{% endif %} |
||||
|
||||
{% if product_meta.energy_value %} |
||||
<div class="toggle-table__block "> |
||||
<p class="toggle-table__title toggle-table__title--center">{{ function('pll_e', 'ЭНЕРГЕТИЧЕСКАЯ ЦЕННОСТЬ НА 100 ГРАММ') }}</p> |
||||
<div class="toggle-table__item"> |
||||
<div class="detail__warning warning"> |
||||
<div class="detail-warning__content"> |
||||
<p class="detail-warning__title">{{ product_meta.energy_value }}</p> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
{# End | Табы с информацией #} |
||||
|
||||
{% if product_meta.important %} |
||||
<div class="detail__warning"> |
||||
<div class="detail-warning__content"> |
||||
<p class="detail-warning__title">{{ function('pll_e', 'Важно') }}</p> |
||||
<p class="detail-warning__text"> |
||||
{{ product_meta.important }} |
||||
</p> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
|
||||
<div class="product__main"> |
||||
{% set recommended_products = function('get_field', 'recommended_products', product.id) %} |
||||
{% set related_products = recommended_products ? recommended_products : function('wc_get_related_products', product.id, 4) %} |
||||
{% if related_products %} |
||||
<div class="detail__wrapper-catalot"> |
||||
<div class="detail__catalot"> |
||||
<div class="detail-catalot__header"> |
||||
<p class="detail-catalot__title"> |
||||
{{ function('pll_e', 'вашему питомцу может понравиться') }} |
||||
</p> |
||||
|
||||
<div class="detail-catalot__control"> |
||||
<button class="detail-catalot-control__button prev"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-left.svg" alt=""> |
||||
</button> |
||||
|
||||
<button class="detail-catalot-control__button next"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-right.svg" alt=""> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
<div class="detail-catalot__content swiper-wrapper"> |
||||
{% for related_product in related_products %} |
||||
<div class="swiper-slide"> |
||||
{% set post_id = related_product.ID is defined ? related_product.ID : related_product %} |
||||
{% set wc_product = fn('wc_get_product', post_id) %} |
||||
{% if wc_product %} |
||||
{% include '_blocks/shop/archive-product-tease.twig' with {post: wc_product} %} |
||||
{% endif %} |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
</div> |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<div class="gallery"> |
||||
<button class="gallery__close gallery-button"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/black-x.svg" alt=""> |
||||
</button> |
||||
|
||||
<div class="gallery__wrapper"> |
||||
<div class="gallery__pagination"> |
||||
{% for image in gallery_images %} |
||||
<button class="gallery-pagination__item" data-count-img="{{ loop.index0 }}"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}"> |
||||
</button> |
||||
{% endfor %} |
||||
</div> |
||||
|
||||
<div class="gallery__slider swiper"> |
||||
<div class="swiper-wrapper"> |
||||
{% for image in gallery_images %} |
||||
<div class="swiper-slide"> |
||||
<div class="gallery__block"> |
||||
<img src="{{ image.src }}" alt="{{ image.alt }}"> |
||||
</div> |
||||
</div> |
||||
{% endfor %} |
||||
</div> |
||||
|
||||
<div class="swiper-pagination"></div> |
||||
|
||||
<div class="swiper-button-prev gallery-button"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-left.svg" alt=""> |
||||
</div> |
||||
<div class="swiper-button-next gallery-button"> |
||||
<img src="{{ theme.uri }}/static/shop/img/svg/main/arrow-right.svg" alt=""> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
{% endblock %} |
@ -1 +0,0 @@ |
||||
123 |
@ -1,63 +0,0 @@ |
||||
<?php |
||||
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) { |
||||
exit; |
||||
} |
||||
|
||||
if (is_product()) { |
||||
|
||||
include_module('shop'); |
||||
include_component('shop', 'single-product'); |
||||
|
||||
$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 = wc_get_related_products($product_id, 5); |
||||
|
||||
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; |
||||
} |
||||
} |
||||
} |
||||
|
||||
Timber::render('modules/shop/components/single-product/component-template.twig', $context); |
||||
} |
@ -1,19 +0,0 @@ |
||||
<?php |
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) { |
||||
exit; |
||||
} |
||||
|
||||
get_header(); |
||||
|
||||
$template_path = 'templates/shop/single-product.php'; |
||||
if (file_exists(get_template_directory() . '/' . $template_path)) { |
||||
include_once get_template_directory() . '/' . $template_path; |
||||
} else { |
||||
|
||||
while (have_posts()) : the_post(); |
||||
wc_get_template_part('content', 'single-product'); |
||||
endwhile; |
||||
} |
||||
|
||||
get_footer(); |
Loading…
Reference in new issue