case "F":
echo \Bitrix\Main\UI\FileInput::createInstance(array(
'name' => intval($propertyID) > 0 ? 'PROPERTY_FILE_'.$propertyID.'['.($inputNum == 1 ? '0' : '#IND#').']' : 'PROPERTY_FILE_'.$propertyID.'_0',
'description' => true,
'upload' => true,
'allowUpload' => 'F',
'medialib' => true,
'fileDialog' => true,
'cloud' => true,
'delete' => true,
'maxCount' => $inputNum == 1 ? 1 : 0
))->show();
break;
// for file properties
$keyProperty = 'PROPERTY_FILE_'.$propertyID;
$arUpdatePropertyValues[$propertyID] = array();
if(isset($_REQUEST[$keyProperty]) && $_REQUEST[$keyProperty]) {
if(is_array($_REQUEST[$keyProperty])) {
foreach($_REQUEST[$keyProperty] as $key => $arProperty) {
$arFile = CIBlock::makeFileArray(
$arProperty,
$_REQUEST[$keyProperty.'_del'][$key] === 'Y',
$_REQUEST[$keyProperty.'_descr'][$key]
);
$arUpdatePropertyValues[$propertyID][$key] = $arFile;
if(($arParams["MAX_FILE_SIZE"] > 0) && ($arFile["size"] > $arParams["MAX_FILE_SIZE"]))
$arResult["ERRORS"][] = GetMessage("IBLOCK_ERROR_FILE_TOO_LARGE");
}
}
}
else {
foreach ($arPropertyValue as $key => $value)
{
$arFile = $_FILES["PROPERTY_FILE_".$propertyID."_".$key];
$arFile["del"] = $_REQUEST["DELETE_FILE"][$propertyID][$key] == "Y" ? "Y" : "";
$arUpdatePropertyValues[$propertyID][$key] = $arFile;
if(($arParams["MAX_FILE_SIZE"] > 0) && ($arFile["size"] > $arParams["MAX_FILE_SIZE"]))
$arResult["ERRORS"][] = GetMessage("IBLOCK_ERROR_FILE_TOO_LARGE");
}
}
if (empty($arUpdatePropertyValues[$propertyID]))
unset($arUpdatePropertyValues[$propertyID]);
$arFile = ($_FILES["PROPERTY_FILE_".$propertyID."_0"] ? $_FILES["PROPERTY_FILE_".$propertyID."_0"] : CIBlock::makeFileArray($_REQUEST["PROPERTY_FILE_".$propertyID."_0"], $_REQUEST["PROPERTY_FILE_".$propertyID."_0_del"] === "Y", $_REQUEST["PROPERTY_FILE_".$propertyID."_0_descr"]));
<? 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'] != '';
function formatPrice($m) {
return $m[1].number_format($m[2], 0, '.', ' ').' р.'.$m[3];
}
$arProductPrice = array();
if(isset($arParams['PROPERTY_PRICE']) && $arParams['PROPERTY_PRICE']) {
foreach((array) $arParams['PROPERTY_PRICE'] as $priceCode) {
if(isset($item['PROPERTIES'][$priceCode]) && $item['PROPERTIES'][$priceCode]['VALUE']) {
$arProductPrice[$priceCode] = preg_replace_callback('/^(\D*)(\d*)(\D*)$/', 'formatPrice', $item['PROPERTIES'][$priceCode]['VALUE']);
}
}
}
//$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>
<? }*/ ?>
<?if($arProductPrice):?>
<?foreach($arProductPrice as $priceCode => $productPrice):?>
<div class="price_<?=strtolower($priceCode);?>"><?=$productPrice;?></div>
<?endforeach;?>
<?endif;?>
</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>
<?
}