Initial commit
This commit is contained in:
19
playarea/templates/productCategory/about.php
Normal file
19
playarea/templates/productCategory/about.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php $page = $b->ls_get_key("page"); ?>
|
||||
<?php $about_title = $page->get_prop_render_value("about_title"); ?>
|
||||
<?php $about_block_left = $page->get_prop_render_value("about_block_left"); ?>
|
||||
<?php $about_block_right = $page->get_prop_render_value("about_block_right"); ?>
|
||||
<?php if(!$about_title || !$about_block_left) return; ?>
|
||||
|
||||
<section class="textblock section post">
|
||||
<div class="container">
|
||||
<h2 class="textblock__heading little"><?= $about_title; ?></h2>
|
||||
<div class="textblock__cont">
|
||||
<div class="textblock__left">
|
||||
<?= $about_block_left; ?>
|
||||
</div>
|
||||
<div class="textblock__right">
|
||||
<?= $about_block_right; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
75
playarea/templates/productCategory/block.php
Normal file
75
playarea/templates/productCategory/block.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php $page = $b->ls_get_key("page"); ?>
|
||||
<?php
|
||||
|
||||
log_message("- Формирую страницу " .time());
|
||||
|
||||
$params = $variables["params"];
|
||||
$_GET = $params;
|
||||
|
||||
$attributes = attribute_get_ids();
|
||||
$current_page = $params["page"] ?? 1;
|
||||
$products_per_page = 30;
|
||||
|
||||
$ranges = array();
|
||||
|
||||
if(isset($params["price_start"]) && isset($params["price_end"])) $ranges[] = array(
|
||||
"min_value" => $params["price_start"],
|
||||
"max_value" => $params["price_end"],
|
||||
"name" => "price"
|
||||
);
|
||||
|
||||
if(isset($params["power_start"]) && isset($params["power_end"])) $ranges[] = array(
|
||||
"min_value" => $params["power_start"],
|
||||
"max_value" => $params["power_end"],
|
||||
"name" => "power"
|
||||
);
|
||||
|
||||
$product_params = array(
|
||||
"category_id" => $page->item_id,
|
||||
"attributes" => $attributes,
|
||||
"page" => $current_page,
|
||||
"products_per_page" => $products_per_page,
|
||||
"ranges" => $ranges,
|
||||
"sale_price" => $params["price_sale"] ?? 0
|
||||
);
|
||||
$b->ls_set_key("product_params", $product_params);
|
||||
|
||||
log_message("- Получаю товары " .time());
|
||||
$products = category_search($product_params);
|
||||
log_message("- Считаю товары " .time());
|
||||
$product_count = category_search_count($product_params);
|
||||
log_message("- Получаю атрибуты " .time());
|
||||
|
||||
?>
|
||||
<section class="section first-other category">
|
||||
<div class="container">
|
||||
<h1><?= $page->get_item_name(); ?></h1>
|
||||
<div class="category__cont category-wrapper">
|
||||
<div class="category-wrapper__mobile category-mobile">
|
||||
<button class="category-mobile__filters">Фильтры</button>
|
||||
<button class="header-bottom__help header-bottom__help_mobile" data-popup-open="help-choose">помощь в выборе</button>
|
||||
</div>
|
||||
<div class="category-wrapper__left">
|
||||
<div class="category-wrapper__inner">
|
||||
<div class="category-wrapper__filters cat-filters">
|
||||
<p class="cat-filters__find">Найдено: <?= $product_count; ?> <?= $b->pluralize($product_count, array("товар", "товара", "товаров")); ?></p>
|
||||
<button class="header-bottom__help header-bottom__filter" data-popup-open="help-choose">
|
||||
помощь в выборе
|
||||
</button>
|
||||
<?php $b->template_load("productCategory/filter.php", array("category_id" => $page->item_id, "attributes" => $attributes)); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php $b->template_load("productCategory/termins.php", array()); ?>
|
||||
<?php $b->template_load("productCategory/news.php", array()); ?>
|
||||
</div>
|
||||
<div class="category-wrapper__main cat-main">
|
||||
<?php $b->template_load("productCategory/product_list.php", array("products" => $products, "current_page" => $current_page, "products_per_page" => $products_per_page, "product_count" => $product_count)); ?>
|
||||
</div>
|
||||
<div class="category-loading">
|
||||
<div class="category-loading__image">
|
||||
<img src="<?= $b->pa_get_assets_dir() ?>main/images/loading.gif"
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
20
playarea/templates/productCategory/faq.php
Normal file
20
playarea/templates/productCategory/faq.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php $page = $b->ls_get_key("page"); ?>
|
||||
<?php $product_category_faq = $page->get_prop_render_value("product_category_faq"); ?>
|
||||
<?php if(!$product_category_faq) return; ?>
|
||||
<section class="section faq-block faq-block__wrapper">
|
||||
<div class="container-small">
|
||||
<h2 class="little faq-block__heading">Часто задаваемые вопросы</h2>
|
||||
<div class="faq-block__accord faq-accord js-vacAccord">
|
||||
<?php foreach ($product_category_faq as $key => $faq) { ?>
|
||||
<div class="faq-accord__item accordion-item">
|
||||
<div class="accordion-header faq-accord__subheading">
|
||||
<div><?= $faq["title"]; ?></div>
|
||||
</div>
|
||||
<div class="post-content">
|
||||
<?= $faq["text"]; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<a class="button-for-more" href="/page/faq/">Показать ещё</a>
|
||||
</div>
|
||||
</section>
|
||||
32
playarea/templates/productCategory/filter.php
Normal file
32
playarea/templates/productCategory/filter.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
$product_params = $b->ls_get_key("product_params");
|
||||
|
||||
$attributes = category_search_attributes($product_params);
|
||||
log_message("- Получил данные " .time());
|
||||
|
||||
$search = new Search(array(
|
||||
"class" => "Attribute",
|
||||
"order" => array(
|
||||
"key" => "weight"
|
||||
)
|
||||
));
|
||||
|
||||
$AttributeBlocks = $search->collect(true, false);
|
||||
|
||||
?>
|
||||
|
||||
<?php $b->template_load("productCategory/filter_price.php", array()); ?>
|
||||
<?php $b->template_load("productCategory/filter_range.php", array("attribute_slug" => "power", "attribute_name" => "Мощность, кВт")); ?>
|
||||
<?php foreach ($AttributeBlocks as $key => $AttributeBlock) { ?>
|
||||
<?php $b->template_load("productCategory/filter_block.php", array("attribute_slug" => $AttributeBlock->get_item_slug(), "numeric" => false, "attributes" => $attributes, "open" => $AttributeBlock->get_prop_render_value("open"))); ?>
|
||||
<?php } ?>
|
||||
|
||||
<span class="close-filters">
|
||||
<svg class="close-filters__btn">
|
||||
<use xlink:href="<?= $b->pa_get_assets_dir() ?>main/images/icons/sprite.svg#closefilters"></use>
|
||||
</svg>
|
||||
<a href="<?= parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); ?>" data-href="?page=1" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("page" => 1))); ?>'>
|
||||
Сбросить все фильтры
|
||||
</a>
|
||||
</span>
|
||||
86
playarea/templates/productCategory/filter_block.php
Normal file
86
playarea/templates/productCategory/filter_block.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
log_message("- Формирую блок фильтров " .time());
|
||||
|
||||
$attributes = $variables["attributes"];
|
||||
$numeric = $variables["numeric"];
|
||||
$open = $variables["open"];
|
||||
|
||||
$block_active = false;
|
||||
|
||||
$search = new Search(array(
|
||||
"class" => "Attribute",
|
||||
"terms" => array("item_slug" => $variables["attribute_slug"])
|
||||
|
||||
));
|
||||
|
||||
$pages = $search->collect(true, false);
|
||||
if(!$pages) return;
|
||||
|
||||
$attribute = $pages[0];
|
||||
$attribute_slug = $attribute->get_item_slug();
|
||||
if(!count($attributes)) return;
|
||||
|
||||
if($attribute->get_prop("visible") == 0) return;
|
||||
|
||||
$attribute_list = array();
|
||||
foreach ($attributes as $key => $attribute_item) {
|
||||
if($attribute_item->parent_id != $attribute->item_id) continue;
|
||||
|
||||
$item_slug = $attribute_item->get_item_slug();
|
||||
$item_name = $attribute_item->get_item_name();
|
||||
|
||||
$attribute_list[] = array("slug" => $item_slug, "title" => $item_name);
|
||||
|
||||
if($item_slug) {
|
||||
$active = $_GET["filter_" . $attribute_slug] == $item_slug;
|
||||
if($active) $block_active = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!count($attribute_list)) return;
|
||||
$attribute_list = sortArrayByName($attribute_list);
|
||||
|
||||
?>
|
||||
<article class="section-article">
|
||||
<div class="section-btn">
|
||||
<div class="execphpwidget">
|
||||
<p>
|
||||
<button type="button" class="filters-item__title" data-form-type="other">
|
||||
<span><?= $attribute->get_item_name(); ?></span>
|
||||
<svg <?= $block_active || $open ? "" : 'class="active"'; ?>>
|
||||
<use xlink:href="<?= $b->pa_get_assets_dir() ?>main/images/icons/sprite.svg#galka_up"></use>
|
||||
</svg>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<div class="widget widget_block section-body list" <?= $block_active || $open ? "" : 'style="display: none;"'; ?>>
|
||||
<?php if(count($attribute_list) > 5) { ?>
|
||||
<div class="widget-search">
|
||||
<input placeholder="Поиск" class="widget-search__input">
|
||||
<svg class="widget-search__icon">
|
||||
<use xlink:href="<?= $b->pa_get_assets_dir() ?>main/images/icons/sprite.svg#search"></use>
|
||||
</svg>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="price-block__list">
|
||||
<?php foreach ($attribute_list as $key => $attribute_item) { ?>
|
||||
<?php
|
||||
$item_slug = $attribute_item["slug"];
|
||||
$active = $_GET["filter_" . $attribute_slug] == $item_slug;
|
||||
if(!$item_slug) continue;
|
||||
$params = array("filter_" . $attribute_slug => $item_slug, "page" => 1);
|
||||
$params_exclude = $active ? array("filter_" . $attribute_slug, "b_event") : array("b_event");
|
||||
?>
|
||||
<a class="price-block__row <?= $active ? "active" : ""; ?> col-auto" href="<?= $b->router_format_get_params($params, true, $params_exclude); ?>" data-href="<?= $b->router_format_get_params($params, true, $params_exclude); ?>" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params($params, true, $params_exclude)); ?>'>
|
||||
<label for="hits"><?= $attribute_item["title"]; ?></label>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="widget_block-show_buttons">
|
||||
<span class="widget-block__show-all">Показать всё</span>
|
||||
<span class="widget-block__hide">Скрыть</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
54
playarea/templates/productCategory/filter_price.php
Normal file
54
playarea/templates/productCategory/filter_price.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<article class="section-article">
|
||||
<div class="section-btn">
|
||||
<div class="execphpwidget">
|
||||
<p>
|
||||
<button type="button" class="filters-item__title">
|
||||
<span>Цена</span>
|
||||
<svg>
|
||||
<use xlink:href="<?= $b->pa_get_assets_dir() ?>main/images/icons/sprite.svg#galka_up"></use>
|
||||
</svg>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<div class="widget widget_block section-body">
|
||||
<form class="section-body__price price-block row align-items-center" method="get" data-category-form="true">
|
||||
<?php foreach ($_GET as $key => $value) { ?>
|
||||
<?php if($key == "price_start" || $key == "price_end" || $key == "page" || $key == "b_event") continue; ?>
|
||||
<input type="hidden" name="<?= $b->get_view($key); ?>" value="<?= $b->get_view($value); ?>">
|
||||
<?php } ?>
|
||||
<span class="price-block__item col-6 row align-items-center">
|
||||
<label for="price_before" class="col-auto">от</label>
|
||||
<input id="price_before" type="number" class="input-form col" placeholder="0" name="price_start" required value="<?= $b->get_view($_GET["price_start"]); ?>"/>
|
||||
</span>
|
||||
<span class="price-block__item col-6 row align-items-center">
|
||||
<label for="price_after" class="col-auto">до</label>
|
||||
<input id="price_after" type="number" class="input-form col" placeholder="99999" name="price_end" required value="<?= $b->get_view($_GET["price_end"]); ?>"/>
|
||||
</span>
|
||||
<input type="submit" style="display: none;">
|
||||
</form>
|
||||
<div class="price-block__list">
|
||||
<a class="price-block__row <?= $_GET["price_start"] == "0" || $_GET["price_end"] == "0" ? "active" : ""; ?> col-auto" href="<?= $b->router_format_get_params(array("price_start" => "0", "price_end" => "0"), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("price_start" => "0", "price_end" => "0"), true, array("b_event")); ?>" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("price_start" => "0", "price_end" => "0"), true, array("b_event"))); ?>'>
|
||||
<label for="hits">Все цены</label>
|
||||
</a>
|
||||
<a class="price-block__row <?= $_GET["price_start"] == 1 && $_GET["price_end"] == 120000 ? "active" : "" ?> col-auto" href="<?= $b->router_format_get_params(array("price_start" => "1", "price_end" => "120000"), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("price_start" => "1", "price_end" => "120000"), true, array("b_event")); ?>" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("price_start" => "1", "price_end" => "120000"), true, array("b_event"))); ?>'>
|
||||
<label for="hits">Менее 120.000 ₽</label>
|
||||
</a>
|
||||
<a class="price-block__row <?= $_GET["price_start"] == 1 && $_GET["price_end"] == 250000 ? "active" : "" ?> col-auto" href="<?= $b->router_format_get_params(array("price_start" => "1", "price_end" => "250000"), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("price_start" => "1", "price_end" => "250000"), true, array("b_event")); ?>" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("price_start" => "1", "price_end" => "250000"), true, array("b_event"))); ?>'>
|
||||
<label for="hits">Менее 250.000 ₽</label>
|
||||
</a>
|
||||
<a class="price-block__row <?= $_GET["price_start"] == 1 && $_GET["price_end"] == 350000 ? "active" : "" ?> col-auto" href="<?= $b->router_format_get_params(array("price_start" => "1", "price_end" => "350000"), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("price_start" => "1", "price_end" => "350000"), true, array("b_event")); ?>" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("price_start" => "1", "price_end" => "350000"), true, array("b_event"))); ?>'>
|
||||
<label for="hits">Менее 350.000 ₽</label>
|
||||
</a>
|
||||
<a class="price-block__row <?= $_GET["price_start"] == 1 && $_GET["price_end"] == 500000 ? "active" : "" ?> col-auto" href="<?= $b->router_format_get_params(array("price_start" => "1", "price_end" => "500000"), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("price_start" => "1", "price_end" => "500000"), true, array("b_event")); ?>" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("price_start" => "1", "price_end" => "500000"), true, array("b_event"))); ?>'>
|
||||
<label for="hits">Менее 500.000 ₽</label>
|
||||
</a>
|
||||
<a class="price-block__row <?= $_GET["price_start"] >= 500000 && $_GET["price_end"] <= 10000000 ? "active" : "" ?> col-auto" href="<?= $b->router_format_get_params(array("price_start" => "500000", "price_end" => "10000000"), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("price_start" => "500000", "price_end" => "10000000"), true, array("b_event")); ?>" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("price_start" => "500000", "price_end" => "10000000"), true, array("b_event"))); ?>'>
|
||||
<label for="hits">500.000 ₽ и более</label>
|
||||
</a>
|
||||
<a class="price-block__row <?= $_GET["price_sale"] == 1 ? "active" : "" ?> col-auto" href="<?= $b->router_format_get_params(array("price_sale" => $_GET["price_sale"] == 1 ? 0 : 1), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("price_sale" => $_GET["price_sale"] == 1 ? 0 : 1), true, array("b_event")); ?>" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("price_sale" => $_GET["price_sale"] == 1 ? 0 : 1), true, array("b_event"))); ?>'>
|
||||
<label for="hits">Товары со скидкой</label>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
35
playarea/templates/productCategory/filter_range.php
Normal file
35
playarea/templates/productCategory/filter_range.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
$attribute_name = $variables["attribute_name"];
|
||||
$attribute_slug = $variables["attribute_slug"];
|
||||
|
||||
?>
|
||||
<article class="section-article">
|
||||
<div class="section-btn">
|
||||
<div class="execphpwidget">
|
||||
<p>
|
||||
<button type="button" class="filters-item__title">
|
||||
<span><?= $attribute_name; ?></span>
|
||||
<svg><use xlink:href="<?= $b->pa_get_assets_dir() ?>main/images/icons/sprite.svg#galka_up"></use></svg>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<div class="widget widget_block section-body">
|
||||
<form class="section-body__price price-block row align-items-center" method="get" data-category-form="true">
|
||||
<?php foreach ($_GET as $key => $value) { ?>
|
||||
<?php if($key == $attribute_slug . "_start" || $key == $attribute_slug . "_end" || $key == "page" || $key == "b_event") continue; ?>
|
||||
<input type="hidden" name="<?= $b->get_view($key); ?>" value="<?= $b->get_view($value); ?>">
|
||||
<?php } ?>
|
||||
<span class="price-block__item col-6 row align-items-center">
|
||||
<label for="price_before" class="col-auto">от</label>
|
||||
<input id="price_before" type="number" class="input-form col" placeholder="0" name="<?= $attribute_slug; ?>_start" required value="<?= $b->get_view($_GET[$attribute_slug. "_start"]); ?>"/>
|
||||
</span>
|
||||
<span class="price-block__item col-6 row align-items-center">
|
||||
<label for="price_after" class="col-auto">до</label>
|
||||
<input id="price_after" type="number" class="input-form col" placeholder="300" name="<?= $attribute_slug; ?>_end" required value="<?= $b->get_view($_GET[$attribute_slug . "_end"]); ?>"/>
|
||||
</span>
|
||||
<input type="submit" style="display: none;">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
20
playarea/templates/productCategory/news.php
Normal file
20
playarea/templates/productCategory/news.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php $page = $b->ls_get_key("page"); ?>
|
||||
<?php $news = $page->get_prop_render_value("product_news_field"); ?>
|
||||
<?php if(!$news) return; ?>
|
||||
<div class="category-wrapper__inner articles">
|
||||
<h2 class="category-wrapper__heading">Статьи</h2>
|
||||
<ul class="category-wrapper__articles">
|
||||
<?php foreach ($news as $key => $value) { ?>
|
||||
<?php $post = new Post(intval($value["item_id"])); ?>
|
||||
<?php if(!$post->get_item()) continue; ?>
|
||||
<li>
|
||||
<figure class="category-wrapper__image">
|
||||
<img src="<?= $post->get_prop_render_value('post_photo') ?>" alt="" />
|
||||
</figure>
|
||||
<a class="category-wrapper__link" href="/post/<?= $post->get_item_slug() ?>/">
|
||||
<?= $post->get_item_name() ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
</div>
|
||||
67
playarea/templates/productCategory/pagination.php
Normal file
67
playarea/templates/productCategory/pagination.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
$current_page = $variables["current_page"];
|
||||
$items_per_page = $variables["items_per_page"];
|
||||
$items_count = $variables["items_count"];
|
||||
|
||||
$space = 4;
|
||||
|
||||
$delta = intval($items_count / $items_per_page);
|
||||
$pages_max = $delta > 0 ? $items_count % $items_per_page > 0 ? $delta + 1: $delta: 1;
|
||||
|
||||
$last_page = $current_page > 1 ? $current_page - 1 : $current_page;
|
||||
$next_page = $current_page < $pages_max ? $current_page + 1 : $current_page;
|
||||
|
||||
$first_pages = min($pages_max, $space);
|
||||
if($current_page == $space || $current_page == $space + 1) $first_pages++;
|
||||
|
||||
$last_pages = $pages_max - ($space - 1);
|
||||
if($last_pages == $current_page || $last_pages - 1 == $current_page) $last_pages--;
|
||||
|
||||
?>
|
||||
|
||||
<ul id="pagination" class="article-rew__list list-digits row">
|
||||
<li class="list-digits__item col-auto">
|
||||
<a href="<?= $b->router_format_get_params(array("page" => $last_page), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("page" => $last_page), true, array("b_event")); ?>" class="list-digits__arrow" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("page" => $last_page), true)); ?>'>
|
||||
<svg class="list-digits__image">
|
||||
<use xlink:href="<?= $b->pa_get_assets_dir() ?>main/images/icons/sprite.svg#pag-prev"></use>
|
||||
</svg>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php for($i = 1; $i <= $first_pages; $i++) { ?>
|
||||
<li class="list-digits__item <?= $i == $current_page ? "active" : ""; ?> col-auto">
|
||||
<a href="<?= $b->router_format_get_params(array("page" => $i), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("page" => $i), true, array("b_event")); ?>" class="list-digits__link" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("page" => $i), true)); ?>'><?= $i; ?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($current_page < $last_pages && $current_page > $first_pages) { ?>
|
||||
<li class="list-digits__item col-auto">
|
||||
<div class="list-digits__link">...</div>
|
||||
</li>
|
||||
<?php for($i = $current_page - 1; $i <= $current_page + 1; $i++) { ?>
|
||||
<li class="list-digits__item <?= $i == $current_page ? "active" : ""; ?> col-auto">
|
||||
<a href="<?= $b->router_format_get_params(array("page" => $i), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("page" => $i), true, array("b_event")); ?>" class="list-digits__link" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("page" => $i), true)); ?>'><?= $i; ?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($pages_max > $space * 2) { ?>
|
||||
<li class="list-digits__item col-auto">
|
||||
<div class="list-digits__link">...</div>
|
||||
</li>
|
||||
<?php for($i = $last_pages; $i <= $pages_max; $i++) { ?>
|
||||
<li class="list-digits__item <?= $i == $current_page ? "active" : ""; ?> col-auto">
|
||||
<a href="<?= $b->router_format_get_params(array("page" => $i), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("page" => $i), true, array("b_event")); ?>" class="list-digits__link" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("page" => $i), true)); ?>'><?= $i; ?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<li class="list-digits__item col-auto">
|
||||
<a href="<?= $b->router_format_get_params(array("page" => $next_page), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("page" => $next_page), true, array("b_event")); ?>" class="list-digits__arrow" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("page" => $next_page), true)); ?>'>
|
||||
<svg class="list-digits__image">
|
||||
<use xlink:href="<?= $b->pa_get_assets_dir() ?>main/images/icons/sprite.svg#pag-next"></use>
|
||||
</svg>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
14
playarea/templates/productCategory/product_list.php
Normal file
14
playarea/templates/productCategory/product_list.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php $products = $variables["products"]; ?>
|
||||
<?php $current_page = $variables["current_page"]; ?>
|
||||
<?php $products_per_page = $variables["products_per_page"]; ?>
|
||||
<?php $product_count = $variables["product_count"]; ?>
|
||||
|
||||
<?php log_message("- Формирую товары " .time()); ?>
|
||||
<?php $b->template_load("productCategory/tags.php", array()); ?>
|
||||
<div class="variants__products category-product-list">
|
||||
<?php foreach ($products as $key => $product) {
|
||||
$b->template_load("productCategory/product_row.php", array("product" => $product));
|
||||
} ?>
|
||||
</div>
|
||||
<?php log_message("- Сформировал товары " .time()); ?>
|
||||
<?php $b->template_load("productCategory/pagination.php", array("current_page" => $current_page, "items_per_page" => $products_per_page, "items_count" => $product_count)); ?>
|
||||
17
playarea/templates/productCategory/product_price.php
Normal file
17
playarea/templates/productCategory/product_price.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
$product = $variables["product"];
|
||||
$sale_percent = $product->get_prop("sale_percent");
|
||||
$regular_price = $product->get_prop("price");
|
||||
|
||||
?>
|
||||
<?php if($sale_percent > 0) { ?>
|
||||
<?php $product_sale_price = number_format($regular_price * (1 - ($sale_percent / 100)), 0, ',', ' '); ?>
|
||||
<h3><?= $product_sale_price; ?> ₽ <del class="price_secondary"><?= number_format($regular_price, 0, ',', ' '); ?> ₽</del></h3>
|
||||
<?php } else { ?>
|
||||
<?php if($regular_price > 0) { ?>
|
||||
<h3><?= number_format($regular_price, 0, ',', ' '); ?> ₽</h3>
|
||||
<?php } else { ?>
|
||||
<h3>по запросу</h3>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
85
playarea/templates/productCategory/product_row.php
Normal file
85
playarea/templates/productCategory/product_row.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
$product = $variables["product"];
|
||||
$in_storage = $product->get_prop("product_in_stock");
|
||||
|
||||
$performance = $product->get_prop_render_value("performance");
|
||||
$automation = $product->get_prop_render_value("automation");
|
||||
|
||||
$options = $product->get_prop_render_value("product_technical_features");
|
||||
$row_params = get_product_row_params($options);
|
||||
|
||||
?>
|
||||
<div class="product-list product row align-items-start justify-content-between product-row" data-product-slug="<?= $product->get_item_slug(); ?>">
|
||||
<a class="product__first row align-items-center" href="/product/<?= $product->get_item_slug(); ?>/">
|
||||
<figure class="product__image">
|
||||
<img alt="<?= $product->get_item_name(); ?>" class="lazy" data-src="<?= $product->get_prop_render_value("product_photo") ?>" />
|
||||
</figure>
|
||||
<div class="product__params row">
|
||||
<h2 class="product__title"><?= $product->get_item_name(); ?></h2>
|
||||
<?php if($in_storage) { ?>
|
||||
<p class="product__qty">В наличии</p>
|
||||
<?php } else { ?>
|
||||
<p class="product__qty">В наличии</p>
|
||||
<!-- <p class="product__qty">Нет на складе</p>-->
|
||||
<?php } ?>
|
||||
</div>
|
||||
</a>
|
||||
<div class="product__second product-items">
|
||||
<?php if($row_params["fuel"]) { ?>
|
||||
<div class="product-items__block">
|
||||
<h3>Топливо</h3>
|
||||
<p><?= $row_params["fuel"]; ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if($row_params["power"]) { ?>
|
||||
<div class="product-items__block">
|
||||
<h3>Мощность</h3>
|
||||
<p><?= $row_params["power"]; ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if($row_params["engine"]) { ?>
|
||||
<div class="product-items__block">
|
||||
<h3>Двигатель</h3>
|
||||
<p><?= $row_params["engine"]; ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<form class="product__third product-items">
|
||||
<div class="product-items__block">
|
||||
<?php if($performance) { ?>
|
||||
<?php $performance = sortArrayByName($performance); ?>
|
||||
<h3>Исполнение</h3>
|
||||
<?php foreach ($performance as $key => $variation) { ?>
|
||||
<span>
|
||||
<label>
|
||||
<input type="radio" class="product-variation" name="ispoln_<?= $product->item_id; ?>" value="<?= $variation["product_slug"]; ?>" <?= $variation["product_slug"] == $product->get_item_slug() ? "checked" : ""; ?> />
|
||||
<?= $variation["title"]; ?>
|
||||
</label>
|
||||
</span>
|
||||
<?php }?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="product-items__block">
|
||||
<?php if($automation) { ?>
|
||||
<?php $automation = sortArrayByName($automation); ?>
|
||||
<h3>Степень автоматизации</h3>
|
||||
<?php foreach ($automation as $key => $variation) { ?>
|
||||
<span>
|
||||
<label>
|
||||
<input type="radio" class="product-variation" name="automatiz_<?= $product->item_id; ?>" value="<?= $variation["product_slug"]; ?>" <?= $variation["product_slug"] == $product->get_item_slug() ? "checked" : ""; ?> />
|
||||
<?= $variation["title"]; ?>
|
||||
</label>
|
||||
</span>
|
||||
<?php }?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</form>
|
||||
<div class="product__fourth product-prices">
|
||||
<?php $b->template_load("productCategory/product_price.php", array("product" => $product)); ?>
|
||||
<div class="product-prices__btns row justify-content-between">
|
||||
<button class="product-prices__bye" product_id="<?= $product->item_id; ?>">Купить <span class="flare"></span></button>
|
||||
<button class="product-prices__action" data-popup-open="oneclick-popup" data-product-id="<?= $product->item_id; ?>">Получить скидку</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
18
playarea/templates/productCategory/tags.php
Normal file
18
playarea/templates/productCategory/tags.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php $page = $b->ls_get_key("page"); ?>
|
||||
<?php $tags = $page->get_prop_render_value("tags"); ?>
|
||||
<?php $tags_title = $page->get_prop_render_value("tags_title"); ?>
|
||||
<?php if(!$tags) return; ?>
|
||||
<?php $tags = sortArrayByNumeric($tags); ?>
|
||||
|
||||
<div class="generator-article__box">
|
||||
<?php if($tags_title) { ?>
|
||||
<h3 class="generator-article__heading"><?= $tags_title; ?></h3>
|
||||
<?php } ?>
|
||||
<ul class="generator-article__list row">
|
||||
<?php foreach ($tags as $key => $value) { ?>
|
||||
<li class="generator-article__item">
|
||||
<a href="<?= $value["link"]; ?>"><button><?= $value["title"]; ?></button></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
32
playarea/templates/productCategory/tags_bottom.php
Normal file
32
playarea/templates/productCategory/tags_bottom.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php $page = $b->ls_get_key("page"); ?>
|
||||
<?php $tags_fast_select = $page->get_prop_render_value("tags_fast_select"); ?>
|
||||
<?php $tags_brands = $page->get_prop_render_value("tags_brands"); ?>
|
||||
<?php if(!$tags_fast_select && !$tags_brands) return; ?>
|
||||
<section class="section tags">
|
||||
<div class="container">
|
||||
<?php if($tags_fast_select){ ?>
|
||||
<div class="tags__wrapper">
|
||||
<h2 class="tags__heading">Быстрый подбор по типу</h2>
|
||||
<ul class="tags__list row">
|
||||
<?php foreach ($tags_fast_select as $key => $tag) { ?>
|
||||
<li class="tags__item col-auto">
|
||||
<a href="<?= $tag["link"]; ?>"><?= $tag["title"]; ?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if($tags_brands){ ?>
|
||||
<div class="tags__wrapper">
|
||||
<h2 class="tags__heading">Бренды</h2>
|
||||
<ul class="tags__list row">
|
||||
<?php foreach ($tags_brands as $key => $tag) { ?>
|
||||
<li class="tags__item col-auto">
|
||||
<a href="<?= $tag["link"]; ?>"><?= $tag["title"]; ?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</section>
|
||||
29
playarea/templates/productCategory/termins.php
Normal file
29
playarea/templates/productCategory/termins.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php $page = $b->ls_get_key("page"); ?>
|
||||
<?php $termins = $page->get_prop_render_value("product_termins_field"); ?>
|
||||
<?php if(!$termins) return; ?>
|
||||
<div class="category-wrapper__inner terms">
|
||||
<h2 class="category-wrapper__heading">Термины</h2>
|
||||
<div class="category-wrapper__filters cat-filters category-wrapper__filters_termins">
|
||||
<?php foreach ($termins as $key => $termin) { ?>
|
||||
<article class="section-article">
|
||||
<div class="section-btn">
|
||||
<div class="execphpwidget">
|
||||
<p>
|
||||
<button type="button" class="filters-item__title">
|
||||
<span><?= $termin["title"]; ?></span>
|
||||
<svg>
|
||||
<use
|
||||
xlink:href="<?= $b->pa_get_assets_dir() ?>main/images/icons/sprite.svg#galka_up"
|
||||
></use>
|
||||
</svg>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<div class="widget widget_block section-body post-content">
|
||||
<?= $termin["text"]; ?>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user