Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
<? if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die(); use \Bitrix\Main\Localization\Loc; /** * @global CMain $APPLICATION * @var array $arParams * @var array $arResult * @var CatalogSectionComponent $component * @var CBitrixComponentTemplate $this * @var string $templateName * @var string $componentPath * * _________________________________________________________________________ * | Attention! * | The following comments are for system use * | and are required for the component to work correctly in ajax mode: * | <!-- items-container --> * | <!-- pagination-container --> * | <!-- component-end --> */ $this->setFrameMode(true); if (!empty($arResult['NAV_RESULT'])) { $navParams = array( 'NavPageCount' => $arResult['NAV_RESULT']->NavPageCount, 'NavPageNomer' => $arResult['NAV_RESULT']->NavPageNomer, 'NavNum' => $arResult['NAV_RESULT']->NavNum ); } else { $navParams = array( 'NavPageCount' => 1, 'NavPageNomer' => 1, 'NavNum' => $this->randString() ); } $showTopPager = false; $showBottomPager = false; $showLazyLoad = false; if ($arParams['PAGE_ELEMENT_COUNT'] > 0 && $navParams['NavPageCount'] > 1) { $showTopPager = $arParams['DISPLAY_TOP_PAGER']; $showBottomPager = $arParams['DISPLAY_BOTTOM_PAGER']; $showLazyLoad = $arParams['LAZY_LOAD'] === 'Y' && $navParams['NavPageNomer'] != $navParams['NavPageCount']; } $elementEdit = CIBlock::GetArrayByID($arParams['IBLOCK_ID'], 'ELEMENT_EDIT'); $elementDelete = CIBlock::GetArrayByID($arParams['IBLOCK_ID'], 'ELEMENT_DELETE'); $elementDeleteParams = array('CONFIRM' => GetMessage('CT_BCS_TPL_ELEMENT_DELETE_CONFIRM')); $arParams['~MESS_BTN_BUY'] = $arParams['~MESS_BTN_BUY'] ?: Loc::getMessage('CT_BCS_TPL_MESS_BTN_BUY'); $arParams['~MESS_BTN_DETAIL'] = $arParams['~MESS_BTN_DETAIL'] ?: Loc::getMessage('CT_BCS_TPL_MESS_BTN_DETAIL'); $arParams['~MESS_BTN_COMPARE'] = $arParams['~MESS_BTN_COMPARE'] ?: Loc::getMessage('CT_BCS_TPL_MESS_BTN_COMPARE'); $arParams['~MESS_BTN_SUBSCRIBE'] = $arParams['~MESS_BTN_SUBSCRIBE'] ?: Loc::getMessage('CT_BCS_TPL_MESS_BTN_SUBSCRIBE'); $arParams['~MESS_BTN_ADD_TO_BASKET'] = $arParams['~MESS_BTN_ADD_TO_BASKET'] ?: Loc::getMessage('CT_BCS_TPL_MESS_BTN_ADD_TO_BASKET'); $arParams['~MESS_NOT_AVAILABLE'] = $arParams['~MESS_NOT_AVAILABLE'] ?: Loc::getMessage('CT_BCS_TPL_MESS_PRODUCT_NOT_AVAILABLE'); $arParams['~MESS_SHOW_MAX_QUANTITY'] = $arParams['~MESS_SHOW_MAX_QUANTITY'] ?: Loc::getMessage('CT_BCS_CATALOG_SHOW_MAX_QUANTITY'); $arParams['~MESS_RELATIVE_QUANTITY_MANY'] = $arParams['~MESS_RELATIVE_QUANTITY_MANY'] ?: Loc::getMessage('CT_BCS_CATALOG_RELATIVE_QUANTITY_MANY'); $arParams['~MESS_RELATIVE_QUANTITY_FEW'] = $arParams['~MESS_RELATIVE_QUANTITY_FEW'] ?: Loc::getMessage('CT_BCS_CATALOG_RELATIVE_QUANTITY_FEW'); $arParams['MESS_BTN_LAZY_LOAD'] = $arParams['MESS_BTN_LAZY_LOAD'] ?: Loc::getMessage('CT_BCS_CATALOG_MESS_BTN_LAZY_LOAD'); $generalParams = array( 'PROPERTY_PRICE' => $arParams['PROPERTY_PRICE'] ); $obName = 'ob'.preg_replace('/[^a-zA-Z0-9_]/', 'x', $this->GetEditAreaId($navParams['NavNum'])); $containerName = 'container-'.$navParams['NavNum']; ?> <div class="product-section"> <? //region Pagination if ($showTopPager) { ?> <div class="row mb-4"> <div class="col text-center" data-pagination-num="<?=$navParams['NavNum']?>"> <!-- pagination-container --> <?=$arResult['NAV_STRING']?> <!-- pagination-container --> </div> </div> <? } //endregion //region Description if (($arParams['HIDE_SECTION_DESCRIPTION'] !== 'Y') && !empty($arResult['DESCRIPTION'])) { ?> <div class="row mb-4"> <div class="col catalog-section-description"> <p><?=$arResult['DESCRIPTION']?></p> </div> </div> <? } //endregion ?> <div class="product-list" data-entity="<?=$containerName?>"> <!-- items-container --> <? if (!empty($arResult['ITEMS']) && !empty($arResult['ITEM_ROWS'])) { $areaIds = array(); foreach ($arResult['ITEMS'] as $item) { $uniqueId = $item['ID'].'_'.md5($this->randString().$component->getAction()); $areaIds[$item['ID']] = $this->GetEditAreaId($uniqueId); $this->AddEditAction($uniqueId, $item['EDIT_LINK'], $elementEdit); $this->AddDeleteAction($uniqueId, $item['DELETE_LINK'], $elementDelete, $elementDeleteParams); } ?> <div class="row" data-entity="items-row"> <? foreach ($arResult['ITEM_ROWS'] as $rowData) { $rowItems = array_splice($arResult['ITEMS'], 0, $rowData['COUNT']); /*?> <div class="row <?=$rowData['CLASS']?>" data-entity="items-row"> <?*/ switch ($rowData['VARIANT']) { case 0: ?> <div class="col product-item-big-card"> <? $item = reset($rowItems); $APPLICATION->IncludeComponent( 'bitrix:catalog.item', 'estate', array( 'RESULT' => array( 'ITEM' => $item, 'AREA_ID' => $areaIds[$item['ID']], 'TYPE' => $rowData['TYPE'], 'BIG_LABEL' => 'N', 'BIG_DISCOUNT_PERCENT' => 'N', 'BIG_BUTTONS' => 'N', 'SCALABLE' => 'N' ), 'PARAMS' => $generalParams + array('SKU_PROPS' => $arResult['SKU_PROPS'][$item['IBLOCK_ID']]) ), $component, array('HIDE_ICONS' => 'Y') ); ?> </div> <? break;