aggregations program separate special offers banners component

This commit is contained in:
merelendor 2024-05-31 05:27:11 +03:00
parent 1cfe60458f
commit 97b7e660cf
6 changed files with 180 additions and 0 deletions

View File

@ -87,6 +87,50 @@ $this->setFrameMode(true);
</div>
</section>
<?
$special_offers_title = "Акции и скидки на ".mb_strtolower($arParams['SHORT_TITLE_ACCUSATIVE'])." в лизинг";
if(isset($arResult['BRAND']))
{
if(isset($arResult['TYPE']))
{
$special_offers_title = "Акции и скидки на ".mb_strtolower($arResult['TYPE_PLURAL'])." ".$arResult['BRAND_NAME']." в лизинг";
}
else
{
$special_offers_title = "Акции и скидки на ".mb_strtolower($arParams['SHORT_TITLE_ACCUSATIVE'])." ".$arResult['BRAND_NAME']." в лизинг";
}
}
elseif(isset($arResult['TYPE']))
{
$special_offers_title = "Акции и скидки на ".mb_strtolower($arResult['TYPE_PLURAL'])." в лизинг";
}
elseif(isset($arResult['GROUP']))
{
$special_offers_title = "Акции и скидки на ".mb_strtolower($arResult['GROUP_ACCUSATIVE'])." в лизинг";
}
?>
<? if(is_array($arResult['PROPERTIES']['OFFERS']['VALUE']) && count($arResult['PROPERTIES']['OFFERS']['VALUE']) > 0): ?>
<section data-page="leasing_special">
<div class="container">
<h2 class="h2"><?= $special_offers_title; ?></h2>
<?
$APPLICATION->IncludeComponent(
"evolution:special.offers.banners",
"",
Array(
"BANNERS" => $arResult['PROPERTIES']['OFFERS']['VALUE'],
"PAGINATION" => "N",
)
);
?>
</div>
</section>
<? endif; ?>
<?
/*
<section data-page="aggregation">
<?
@ -114,6 +158,9 @@ $this->setFrameMode(true);
]
);
?>
</section>
*/
?>
<? if(!empty($arResult['DETAIL_TEXT'])): ?>
<? if(isset($arResult['TYPE']) && isset(($arResult['BRAND']))): ?>

View File

@ -0,0 +1,8 @@
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
$arTemplateDescription = array(
"NAME" => GetMessage("DEFAULT_NAME"),
"DESCRIPTION" => GetMessage("DEFAULT_DESC"),
);
?>

View File

@ -0,0 +1,62 @@
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
/** @var CBitrixComponent $this */
/** @var array $arParams */
/** @var array $arResult */
/** @var string $componentPath */
/** @var string $componentName */
/** @var string $componentTemplate */
/** @global CDatabase $DB */
/** @global CUser $USER */
/** @global CMain $APPLICATION */
use Bitrix\Main\Context,
Bitrix\Main\Type\DateTime,
Bitrix\Main\Loader,
Bitrix\Iblock;
if($this->StartResultCache(60*60*24, md5(var_export($_POST, true))))
{
if(CModule::IncludeModule('iblock'))
{
$arResult = array();
$sort = Array("ID" => $arParams['BANNERS']);
$filter = Array("IBLOCK_ID" => IBLOCK_ID_SPECIALS, "ID" => $arParams['BANNERS']);
if(!isset($_GET['advertise'])) { $filter["ACTIVE"] = "Y"; }
$options = Array("nPageSize" => 1000);
if(isset($arParams["sort"]))
{
$sort = $arParams["sort"];
}
if(isset($arParams["options"]))
{
$options = $arParams["options"];
}
if(isset($arParams["filter"]))
{
$filter = array_merge($filter, $arParams["filter"]);
}
$res = CIBlockElement::GetList($sort, $filter, false, $options);
$arResult = Array();
$arResult['BANNERS'] = Array();
while ($obElement = $res->GetNextElement())
{
$ar_res = $obElement->GetFields();
$ar_res['PROPERTIES'] = $obElement->GetProperties();
if(isset($ar_res['PREVIEW_PICTURE']))
{
$ar_res['PREVIEW_PICTURE'] = CFile::GetPath($ar_res['PREVIEW_PICTURE']);
}
$arResult['BANNERS'][] = $ar_res;
}
$this->IncludeComponentTemplate();
}
}

View File

@ -0,0 +1,4 @@
<?
$MESS ['DEFAULT_NAME'] = "Список баннеров в специальных приложениях";
$MESS ['DEFAULT_DESC'] = "Список баннеров в специальных приложениях";
?>

View File

@ -0,0 +1,59 @@
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
/** @var array $arParams */
/** @var array $arResult */
/** @global CMain $APPLICATION */
/** @global CUser $USER */
/** @global CDatabase $DB */
/** @var CBitrixComponentTemplate $this */
/** @var string $templateName */
/** @var string $templateFile */
/** @var string $templateFolder */
/** @var string $componentPath */
/** @var CBitrixComponent $component */
$this->setFrameMode(true);
?>
<div id="special_slider" <?php /* style="overflow-x: clip;" */ ?>>
<div class="special_list swiped" style="<?= isset($_GET['advertise']) ? "flex-wrap: wrap;" : "" ?>">
<? foreach($arResult['BANNERS'] AS $banner): ?>
<div class="special_item" id="program_special_offers_banner_<?= $banner['ID']; ?>">
<a href="<?= $banner['DETAIL_PAGE_URL']; ?>">
<span class="special_name"><?= $banner['NAME']; ?></span>
<span class="special_desc"><?= $banner['PREVIEW_TEXT']; ?></span>
<span class="special_link">Подробнее</span>
</a>
<img src="<?= $banner['PREVIEW_PICTURE']; ?>" alt="<?= $banner['NAME']; ?>"/>
<? if(!isset($_GET['advertise']) && $banner['PROPERTIES']['ADVERTISING_ERIR']['VALUE']): ?>
<div class="advblock adv_button_news">Реклама
<div class="adv_content">ООО "ЛК Эволюция"</div>
<div class="adv_content">ИНН 9724016636</div>
<div class="adv_content erid"
data-erid="<?= $banner['PROPERTIES']['ADVERTISING_ERIR']['VALUE']; ?>"
data-creative="<?= $banner['PROPERTIES']['ADVERTISING_SAMPLE_ID']['VALUE']; ?>"
>
erid: <?= $banner['PROPERTIES']['ADVERTISING_ERIR']['VALUE']; ?>
</div>
</div>
<? endif; ?>
</div>
<? endforeach; ?>
</div>
<? if(is_array($arResult['BANNERS']) && count($arResult['BANNERS']) > 2): ?>
<div class="special_arrows">
<button class="prev">
<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="https://www.w3.org/2000/svg">
<path d="M7 11L1 6L6.25 1" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
</svg>
</button>
<button class="next">
<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="https://www.w3.org/2000/svg">
<path d="M1 1L7 6L1.75 11" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
</svg>
</button>
</div>
<? endif; ?>
<? if(is_array($arResult['BANNERS']) && count($arResult['BANNERS']) == 0): ?>
<div class="disable_space">
<? endif; ?>
</div>