Files
2025-12-24 19:19:01 +03:00

75 lines
3.2 KiB
PHP

<?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>