<? if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die();
/**
* @var CBitrixComponentTemplate $this
* @var CatalogSectionComponent $component
*/
//$component = $this->getComponent();
//$arParams = $component->applyTemplateModifications();
//echo_r($arResult);
if(!CModule::IncludeModule("iblock")) return;
$item = $arResult['ITEM'];
$arImages = array();
if (!empty($item['PREVIEW_PICTURE_SECOND'])) {
$arImages[] = $item['PREVIEW_PICTURE_SECOND'];
}
if (!empty($item['MORE_PHOTO'])) {
foreach ($item['MORE_PHOTO'] as $arImage) {
if (!empty($arImage)) {
$arImages[] = $arImage;
}
}
}
if (!empty($item['PROPERTIES']['MORE_IMAGE_ALT']['VALUE']) && !empty($item['PROPERTIES']['MORE_IMAGE_ALT']['LINK_IBLOCK_ID'])) {
$res = CIBlockElement::GetList(
array(),
array("IBLOCK_ID"=>$item['PROPERTIES']['MORE_IMAGE_ALT']['LINK_IBLOCK_ID'], "ID"=>$item['PROPERTIES']['MORE_IMAGE_ALT']['VALUE']),
false,
false,
array("ID","IBLOCK_ID","NAME","PROPERTY_IMAGES")
);
if ($ob = $res->GetNextElement()) {
$arProps = $ob->GetProperties();
if (!empty($arProps['IMAGES']['VALUE'])) {
foreach ($arProps['IMAGES']['VALUE'] as $key=>$imageID) {
$arImage = CFile::ResizeImageGet($imageID, array('width'=>400, 'height'=>400), BX_RESIZE_IMAGE_PROPORTIONAL_ALT, true);
$arImages[] = array(
'SRC' => $arImage['src'],
'WIDTH' => $arImage['width'],
'HEIGHT' => $arImage['height'],
'DESCRIPTION' => $arProps['IMAGES']['DESCRIPTION'][$key],
);
}
}
}
}
$arResult['ITEM']['MORE_PHOTO'] = $arImages;
unset($item, $arImage, $arImages);
<? if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die();
use \Bitrix\Main;
/**
* @global CMain $APPLICATION
* @var array $arParams
* @var array $arResult
* @var CatalogProductsViewedComponent $component
* @var CBitrixComponentTemplate $this
* @var string $templateName
* @var string $componentPath
* @var string $templateFolder
*/
$this->setFrameMode(true);
if (isset($arResult['ITEM']))
{
$item = $arResult['ITEM'];
$areaId = $arResult['AREA_ID'];
$productTitle = isset($item['IPROPERTY_VALUES']['ELEMENT_PAGE_TITLE']) && $item['IPROPERTY_VALUES']['ELEMENT_PAGE_TITLE'] != ''
? $item['IPROPERTY_VALUES']['ELEMENT_PAGE_TITLE']
: $item['NAME'];
$imgTitle = isset($item['IPROPERTY_VALUES']['ELEMENT_PREVIEW_PICTURE_FILE_TITLE']) && $item['IPROPERTY_VALUES']['ELEMENT_PREVIEW_PICTURE_FILE_TITLE'] != ''
? $item['IPROPERTY_VALUES']['ELEMENT_PREVIEW_PICTURE_FILE_TITLE']
: $item['NAME'];
$showSlider = is_array($item['MORE_PHOTO']) && count($item['MORE_PHOTO']) > 0;
$itemHasDetailUrl = isset($item['DETAIL_PAGE_URL']) && $item['DETAIL_PAGE_URL'] != '';
$productPrice = ( !empty($item['PROPERTIES'][$arParams['PROPERTY_PRICE']]['VALUE']) ? $item['PROPERTIES'][$arParams['PROPERTY_PRICE']]['VALUE'] : false );
//echo_r($item);
?>
<div class="product-item-wrap" id="<?=$areaId?>" data-entity="item">
<div class="product-item">
<a href="<?=$item['DETAIL_PAGE_URL']?>" class="full"></a>
<? if ($showSlider) { ?>
<div class="product-thumb" id="product-thumb-<?=$areaId?>">
<?
foreach ($item['MORE_PHOTO'] as $key => $photo) {
if ($key > 4) continue;
?>
<div><a href="<?=$item['DETAIL_PAGE_URL']?>"><img src="<?=$photo['SRC']?>" alt=""></a></div>
<? } ?>
</div>
<? } ?>
<div class="product-body">
<div class="product-head text-primary">
<h5 class="product-title"><a href="<?=$item['DETAIL_PAGE_URL']?>"><?=$productTitle?></a></h5>
</div>
<div class="product-option">
<? if (!empty($item['DISPLAY_PROPERTIES'])) { ?>
<ul class="list-inline">
<? foreach ($item['DISPLAY_PROPERTIES'] as $code => $displayProperty) { ?>
<li class="list-inline-item">
<span><?=$displayProperty['NAME']?></span>
<strong class="text-primary"><?=(is_array($displayProperty['DISPLAY_VALUE']) ? implode(' / ', $displayProperty['DISPLAY_VALUE']) : $displayProperty['DISPLAY_VALUE'])?></strong>
</li>
<? } ?>
</ul>
<? } ?>
</div>
<div class="product-price text-primary">
<? if ($productPrice) { ?>
<span><? echo number_format($productPrice, 0, '.', ' '); ?> р.</span>
<? } ?>
</div>
<? if ($itemHasDetailUrl): ?>
<a href="<?=$item['DETAIL_PAGE_URL']?>" class="btn btn-outline-primary">Подробнее</a>
<? endif; ?>
</div>
</div>
<script>
$(document).ready(function(){
$('#product-thumb-<?=$areaId?>').slick({
slidesToShow: 1,
slidesToScroll: 1,
dots: true,
arrows:false,
infinite: true,
touchMove: true,
draggable:true,
lazyLoad: 'ondemand',
fade:true
});
});
</script>
</div>
<?
}
case 9:
foreach ($rowItems as $item)
{
?>
<div class="col product-item-line-card">
<? $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'
),
'PARAMS' => $generalParams
+ array('SKU_PROPS' => $arResult['SKU_PROPS'][$item['IBLOCK_ID']])
),
$component,
array('HIDE_ICONS' => 'Y')
);
?>
</div>
<?
}
break;
}
/*?>
</div>
<?*/
}
?>
</div>
<?
unset($generalParams, $rowItems);
}
else
{
// load css for bigData/deferred load
$APPLICATION->IncludeComponent(
'bitrix:catalog.item',
'estate',
array(),
$component,
array('HIDE_ICONS' => 'Y')
);
}
?>
<!-- items-container -->
</div>
<?
//region LazyLoad Button
if ($showLazyLoad)
{
?>
<div class="text-center mb-4" data-entity="lazy-<?=$containerName?>">
<button type="button" class="btn btn-lg btn-outline-danger" style="margin: 15px;" data-use="show-more-<?=$navParams['NavNum']?>"><?=$arParams['MESS_BTN_LAZY_LOAD']?></button>
</div>
<?
}
//endregion
//region Pagination
if ($showBottomPager)
{
?>
<div class="row mb-4">
<div class="col text-center wow fadeInUp" data-wow-duration="1s" data-wow-delay="0" data-wow-offset="50" data-pagination-num="<?=$navParams['NavNum']?>">
<!-- pagination-container -->
<?=$arResult['NAV_STRING']?>
<!-- pagination-container -->
</div>
</div>
<?
}
//endregion
$signer = new \Bitrix\Main\Security\Sign\Signer;
$signedTemplate = $signer->sign($templateName, 'catalog.section');
$signedParams = $signer->sign(base64_encode(serialize($arResult['ORIGINAL_PARAMETERS'])), 'catalog.section');
?>
<script>
BX.message({
BTN_MESSAGE_BASKET_REDIRECT: '<?=GetMessageJS('CT_BCS_CATALOG_BTN_MESSAGE_BASKET_REDIRECT')?>',
BASKET_URL: '<?=$arParams['BASKET_URL']?>',
ADD_TO_BASKET_OK: '<?=GetMessageJS('ADD_TO_BASKET_OK')?>',
TITLE_ERROR: '<?=GetMessageJS('CT_BCS_CATALOG_TITLE_ERROR')?>',
TITLE_BASKET_PROPS: '<?=GetMessageJS('CT_BCS_CATALOG_TITLE_BASKET_PROPS')?>',
TITLE_SUCCESSFUL: '<?=GetMessageJS('ADD_TO_BASKET_OK')?>',
BASKET_UNKNOWN_ERROR: '<?=GetMessageJS('CT_BCS_CATALOG_BASKET_UNKNOWN_ERROR')?>',
BTN_MESSAGE_SEND_PROPS: '<?=GetMessageJS('CT_BCS_CATALOG_BTN_MESSAGE_SEND_PROPS')?>',
BTN_MESSAGE_CLOSE: '<?=GetMessageJS('CT_BCS_CATALOG_BTN_MESSAGE_CLOSE')?>',
BTN_MESSAGE_CLOSE_POPUP: '<?=GetMessageJS('CT_BCS_CATALOG_BTN_MESSAGE_CLOSE_POPUP')?>',
COMPARE_MESSAGE_OK: '<?=GetMessageJS('CT_BCS_CATALOG_MESS_COMPARE_OK')?>',
COMPARE_UNKNOWN_ERROR: '<?=GetMessageJS('CT_BCS_CATALOG_MESS_COMPARE_UNKNOWN_ERROR')?>',
COMPARE_TITLE: '<?=GetMessageJS('CT_BCS_CATALOG_MESS_COMPARE_TITLE')?>',
PRICE_TOTAL_PREFIX: '<?=GetMessageJS('CT_BCS_CATALOG_PRICE_TOTAL_PREFIX')?>',
RELATIVE_QUANTITY_MANY: '<?=CUtil::JSEscape($arParams['MESS_RELATIVE_QUANTITY_MANY'])?>',
RELATIVE_QUANTITY_FEW: '<?=CUtil::JSEscape($arParams['MESS_RELATIVE_QUANTITY_FEW'])?>',
BTN_MESSAGE_COMPARE_REDIRECT: '<?=GetMessageJS('CT_BCS_CATALOG_BTN_MESSAGE_COMPARE_REDIRECT')?>',
BTN_MESSAGE_LAZY_LOAD: '<?=CUtil::JSEscape($arParams['MESS_BTN_LAZY_LOAD'])?>',
BTN_MESSAGE_LAZY_LOAD_WAITER: '<?=GetMessageJS('CT_BCS_CATALOG_BTN_MESSAGE_LAZY_LOAD_WAITER')?>',
SITE_ID: '<?=CUtil::JSEscape($component->getSiteId())?>'
});
var <?=$obName?> = new JCCatalogSectionComponent({
siteId: '<?=CUtil::JSEscape($component->getSiteId())?>',
componentPath: '<?=CUtil::JSEscape($componentPath)?>',
navParams: <?=CUtil::PhpToJSObject($navParams)?>,
deferredLoad: false, // enable it for deferred load
initiallyShowHeader: '<?=!empty($arResult['ITEM_ROWS'])?>',
bigData: <?=CUtil::PhpToJSObject($arResult['BIG_DATA'])?>,
lazyLoad: !!'<?=$showLazyLoad?>',
loadOnScroll: !!'<?=($arParams['LOAD_ON_SCROLL'] === 'Y')?>',
template: '<?=CUtil::JSEscape($signedTemplate)?>',
ajaxId: '<?=CUtil::JSEscape($arParams['AJAX_ID'])?>',
parameters: '<?=CUtil::JSEscape($signedParams)?>',
container: '<?=$containerName?>'
});
</script>
</div> <? //end wrapper?>
<!-- component-end -->
case 5:
$rowItemsCount = count($rowItems);
?>
<div class="col-sm-6 col-12 product-item-small-card">
<div class="row">
<?
for ($i = 0; $i < $rowItemsCount - 1; $i++)
{
?>
<div class="col-6">
<?
$APPLICATION->IncludeComponent(
'bitrix:catalog.item',
'estate',
array(
'RESULT' => array(
'ITEM' => $rowItems[$i],
'AREA_ID' => $areaIds[$rowItems[$i]['ID']],
'TYPE' => $rowData['TYPE'],
'BIG_LABEL' => 'N',
'BIG_DISCOUNT_PERCENT' => 'N',
'BIG_BUTTONS' => 'N',
'SCALABLE' => 'N'
),
'PARAMS' => $generalParams
+ array('SKU_PROPS' => $arResult['SKU_PROPS'][$rowItems[$i]['IBLOCK_ID']])
),
$component,
array('HIDE_ICONS' => 'Y')
);
?>
</div>
<?
}
?>
</div>
</div>
<div class="col-sm-6 product-item-big-card">
<?
$item = end($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' => 'Y',
'SCALABLE' => 'Y'
),
'PARAMS' => $generalParams
+ array('SKU_PROPS' => $arResult['SKU_PROPS'][$item['IBLOCK_ID']])
),
$component,
array('HIDE_ICONS' => 'Y')
);
unset($item);
?>
</div>
<?
break;
case 6:
foreach ($rowItems as $item)
{
?>
<div class="col-6 col-sm-4 col-md-4 col-lg-2 product-item-small-card">
<?
$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;
case 7:
$rowItemsCount = count($rowItems);
?>
<div class="col-sm-6 col-12 product-item-big-card">
<?
$item = array_shift($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' => 'Y',
'SCALABLE' => 'Y'
),
'PARAMS' => $generalParams
+ array('SKU_PROPS' => $arResult['SKU_PROPS'][$item['IBLOCK_ID']])
),
$component,
array('HIDE_ICONS' => 'Y')
);
unset($item);
?>
</div>
<div class="col-sm-6 col-12 product-item-small-card">
<div class="row">
<?
for ($i = 0; $i < $rowItemsCount - 1; $i++)
{
?>
<div class="col-6 col-md-4">
<?
$APPLICATION->IncludeComponent(
'bitrix:catalog.item',
'estate',
array(
'RESULT' => array(
'ITEM' => $rowItems[$i],
'AREA_ID' => $areaIds[$rowItems[$i]['ID']],
'TYPE' => $rowData['TYPE'],
'BIG_LABEL' => 'N',
'BIG_DISCOUNT_PERCENT' => 'N',
'BIG_BUTTONS' => 'N',
'SCALABLE' => 'N'
),
'PARAMS' => $generalParams
+ array('SKU_PROPS' => $arResult['SKU_PROPS'][$rowItems[$i]['IBLOCK_ID']])
),
$component,
array('HIDE_ICONS' => 'Y')
);
?>
</div>
<?
}
?>
</div>
</div>
<?
break;
case 8:
$rowItemsCount = count($rowItems);
?>
<div class="col-sm-6 col-12 product-item-small-card">
<div class="row">
<?
for ($i = 0; $i < $rowItemsCount - 1; $i++)
{
?>
<div class="col-6 col-md-4">
<?
$APPLICATION->IncludeComponent(
'bitrix:catalog.item',
'estate',
array(
'RESULT' => array(
'ITEM' => $rowItems[$i],
'AREA_ID' => $areaIds[$rowItems[$i]['ID']],
'TYPE' => $rowData['TYPE'],
'BIG_LABEL' => 'N',
'BIG_DISCOUNT_PERCENT' => 'N',
'BIG_BUTTONS' => 'N',
'SCALABLE' => 'N'
),
'PARAMS' => $generalParams
+ array('SKU_PROPS' => $arResult['SKU_PROPS'][$rowItems[$i]['IBLOCK_ID']])
),
$component,
array('HIDE_ICONS' => 'Y')
);
?>
</div>
<?
}
?>
</div>
</div>
<div class="col-sm-6 col-12 product-item-big-card">
<?
$item = end($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' => 'Y',
'SCALABLE' => 'Y'
),
'PARAMS' => $generalParams
+ array('SKU_PROPS' => $arResult['SKU_PROPS'][$item['IBLOCK_ID']])
),
$component,
array('HIDE_ICONS' => 'Y')
);
unset($item);
?>
</div>
<?
break;
case 1:
foreach ($rowItems as $item)
{
?>
<div class="col-6 product-item-big-card">
<?
$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;
case 2:
foreach ($rowItems as $item)
{
?>
<div class="col-12 col-md-6 col-lg-4 product-item-small-card">
<?
$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' => 'Y',
'SCALABLE' => 'N'
),
'PARAMS' => $generalParams
+ array('SKU_PROPS' => $arResult['SKU_PROPS'][$item['IBLOCK_ID']])
),
$component,
array('HIDE_ICONS' => 'Y')
);
?>
</div>
<?
}
break;
case 3:
foreach ($rowItems as $item)
{
?>
<div class="col-6 col-md-3 product-item-small-card">
<?
$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;
case 4:
$rowItemsCount = count($rowItems);
?>
<div class="col-sm-6 product-item-big-card">
<?
$item = array_shift($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' => 'Y',
'SCALABLE' => 'Y'
),
'PARAMS' => $generalParams
+ array('SKU_PROPS' => $arResult['SKU_PROPS'][$item['IBLOCK_ID']])
),
$component,
array('HIDE_ICONS' => 'Y')
);
unset($item);
?>
</div>
<div class="col-sm-6 product-item-small-card">
<div class="row">
<?
for ($i = 0; $i < $rowItemsCount - 1; $i++)
{
?>
<div class="col-6">
<?
$APPLICATION->IncludeComponent(
'bitrix:catalog.item',
'estate',
array(
'RESULT' => array(
'ITEM' => $rowItems[$i],
'AREA_ID' => $areaIds[$rowItems[$i]['ID']],
'TYPE' => $rowData['TYPE'],
'BIG_LABEL' => 'N',
'BIG_DISCOUNT_PERCENT' => 'N',
'BIG_BUTTONS' => 'N',
'SCALABLE' => 'N'
),
'PARAMS' => $generalParams
+ array('SKU_PROPS' => $arResult['SKU_PROPS'][$rowItems[$i]['IBLOCK_ID']])
),
$component,
array('HIDE_ICONS' => 'Y')
);
?>
</div>
<?
}
?>
</div>
</div>
<?
break;
Яговорю, не стоит уже тратить на это время) Думаю, если бы имелся сам доступ к сайту, было бы гораздо проще)
Спасибо огромное, на основной вопрос ответ получен)