<?$APPLICATION->IncludeComponent(
"bitrix:news.list",
"sale-slider",
Array(
...
"IBLOCK_ID" => "17",
"IBLOCK_TYPE" => "news",
"NEWS_COUNT" => "1",
...
"PROPERTY_CODE" => array("","PRODUCTS",""),
...
"SORT_BY1" => "ACTIVE_FROM",
"SORT_BY2" => "SORT",
"SORT_ORDER1" => "DESC",
"SORT_ORDER2" => "ASC",
)
);?>
Кастомизируем компонент
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
$arResult['PRODUCTS']=[];
foreach($arResult["ITEMS"] as $item){
if(!empty($item["PROPERTIES"]["PRODUCTS"]["VALUE"])){
$arResult['PRODUCTS'] = array_merge($arResult['PRODUCTS'],$item['PROPERTIES']['PRODUCTS']['VALUE']);
}
}
if(!empty($arResult['PRODUCTS'])){
$arResult['PRODUCTS'] = array_unique($arResult['PRODUCTS']);
$this->getComponent()->setResultCacheKeys(['PRODUCTS']);
}
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
if (!empty($arResult['PRODUCTS']) || !empty($arResult['SECTION']))
{
$GLOBALS['arrProductFilter']=[];
if(!empty($arResult['PRODUCTS']))
$GLOBALS['arrProductFilter']['=ID']=$arResult['PRODUCTS'];
elseif(!empty($arResult['SECTION']))
$GLOBALS['arrProductFilter']['=SECTION_ID']=$arResult['SECTION'];
$arCatalogSectionParams = array(
'IBLOCK_ID' => "12",//IBLOCK_ID каталога товаров
'IBLOCK_TYPE' => "catalog",
"CACHE_FILTER" => "Y",
"CACHE_GROUPS" => "Y",
"CACHE_TIME" => "3600",
"CACHE_TYPE" => "A",
'FILTER_NAME' => 'arrProductFilter',
'PRICE_CODE' => array(
0 => "BASE",
),
'SHOW_ALL_WO_SECTION' => 'Y',
"SHOW_DISCOUNT_PERCENT" => "Y",
);
$APPLICATION->IncludeComponent(
'bitrix:catalog.section',
'slider-sale',
$arCatalogSectionParams,
false,
array('HIDE_ICONS'=>true)
);
}
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
$arResult['PRODUCTS']=[];
$arResult['SECTION']=[];
$discounts=[];
\Bitrix\Main\Loader::includeModule("sale");
//подключаем файл
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/sale/handlers/discountpreset/simpleproduct.php");
foreach($arResult["ITEMS"] as $item){
if(!empty($item["PROPERTIES"]["DISCOUNT"]["VALUE"])){
$discounts[] = $item["PROPERTIES"]["DISCOUNT"]["VALUE"];
}
}
if(!empty($discounts)){
$dbProductDiscounts = \Bitrix\Sale\Internals\DiscountTable::getList([
'filter' => [
'ID' => $discounts,
],
'select' => [
"*"
]
]);
$discountObj = new Sale\Handlers\DiscountPreset\SimpleProduct();
while ($arProductDiscounts = $dbProductDiscounts->Fetch())
{
$discount = $discountObj->generateState($arProductDiscounts);
. if(!empty($discount['discount_product'])){
$arResult['PRODUCTS'] = array_merge($arResult['PRODUCTS'],$discount['discount_product']);
}
, unset($discount);
}
}
if(!empty($arResult['PRODUCTS']))
$this->getComponent()->setResultCacheKeys(['PRODUCTS']);