namespace Site\Sale;
use \Bitrix\Main\Loader,
\Bitrix\Main\Localization\Loc;
Loader::includeModule('catalog');
Loader::includeModule('sale');
class CatalogProductProvider extends \CCatalogProductProvider
{
public static function GetProductData($params)
{
//Получение готового массива цен
$result = parent::GetProductData($params);
//Манипуляции с ценами
$result = [
'BASE_PRICE' => $productPrice['PRICE'],
'PRICE' => ($productPrice['DISCOUNT_PRICE']) ? $productPrice['DISCOUNT_PRICE'] : $productPrice['PRICE'],
] + $result;
if ($productPrice['DISCOUNT_VALUE']){
$result = [
'DISCOUNT_PRICE' => $productPrice['PRICE'] - $productPrice['DISCOUNT_PRICE'],
'DISCOUNT_VALUE' => $productPrice['DISCOUNT_VALUE'],
] + $result;
}
//возвращаем готовый массив
return $result;
}
}
3 =>
array (
'CONDITION' => '#^/aktsii/([a-zA-Z0-9\\-_]+)/?.*#',
'RULE' => 'ELEMENT_CODE=$1',
'ID' => '',
'PATH' => '/aktsii/detail.php',
'SORT' => 100,
),
AddEventHandler("search", "BeforeIndex", Array("SearchInSectionIndex", "BeforeIndexHandler"));
class SearchInSectionIndex
{
// создаем обработчик события "BeforeIndex"
function BeforeIndexHandler($arFields)
{
// элемент инфоблока 37 (не раздел)
if($arFields["MODULE_ID"] == "iblock" && $arFields["PARAM2"] == 37 && substr($arFields["ITEM_ID"], 0, 1) != "S")
{
$arFields["PARAMS"]["iblock_section"] = array();
//Получаем разделы привязки элемента (их может быть несколько)
$rsSections = CIBlockElement::GetElementGroups($arFields["ITEM_ID"], true);
while($arSection = $rsSections->Fetch())
{
//Сохраняем в поисковый индекс
$arFields["PARAMS"]["iblock_section"][] = $arSection["ID"];
}
}
//Всегда возвращаем arFields
return $arFields;
}
}
global $arSectionFilter;
$arSectionFilter = array("PARAMS" => array("iblock_section" => $_GET['section_id']));
$arElements = $APPLICATION->IncludeComponent(
"bitrix:search.page",
"",
Array(
"RESTART" => $arParams["RESTART"],
"NO_WORD_LOGIC" => $arParams["NO_WORD_LOGIC"],
"USE_LANGUAGE_GUESS" => $arParams["USE_LANGUAGE_GUESS"],
"CHECK_DATES" => $arParams["CHECK_DATES"],
"arrFILTER" => array("iblock_".$arParams["IBLOCK_TYPE"]),
"arrFILTER_iblock_".$arParams["IBLOCK_TYPE"] => array(
0 => "37",
),
"USE_TITLE_RANK" => "N",
"DEFAULT_SORT" => "rank",
"FILTER_NAME" => $arSectionFilter,
"SHOW_WHERE" => "N",
"arrWHERE" => array(),
"SHOW_WHEN" => "N",
"PAGE_RESULT_COUNT" => 200,
"DISPLAY_TOP_PAGER" => "N",
"DISPLAY_BOTTOM_PAGER" => "N",
"PAGER_TITLE" => "",
"PAGER_SHOW_ALWAYS" => "N",
"PAGER_TEMPLATE" => "N",
),
$component
);