示例#1
0
 public function onPrepareComponentParams($arParams)
 {
     $arParams["CACHE_TIME"] = isset($arParams["CACHE_TIME"]) ? $arParams["CACHE_TIME"] : 36000000;
     $arParams["IBLOCK_ID"] = (int) $arParams["IBLOCK_ID"];
     $arParams["SECTION_ID"] = (int) $arParams["SECTION_ID"];
     if ($arParams["SECTION_ID"] <= 0 && Loader::includeModule('iblock')) {
         $arParams["SECTION_ID"] = CIBlockFindTools::GetSectionID($arParams["SECTION_ID"], $arParams["SECTION_CODE"], array("GLOBAL_ACTIVE" => "Y", "IBLOCK_ID" => $arParams["IBLOCK_ID"]));
         if (!$arParams["SECTION_ID"] && strlen($arParams["SECTION_CODE_PATH"]) > 0) {
             $arParams["SECTION_ID"] = CIBlockFindTools::GetSectionIDByCodePath($arParams["IBLOCK_ID"], $arParams["SECTION_CODE_PATH"]);
         }
     }
     $arParams["PRICE_CODE"] = is_array($arParams["PRICE_CODE"]) ? $arParams["PRICE_CODE"] : array();
     foreach ($arParams["PRICE_CODE"] as $k => $v) {
         if ($v === null || $v === '' || $v === false) {
             unset($arParams["PRICE_CODE"][$k]);
         }
     }
     $arParams["SAVE_IN_SESSION"] = $arParams["SAVE_IN_SESSION"] == "Y";
     $arParams["CACHE_GROUPS"] = $arParams["CACHE_GROUPS"] !== "N";
     $arParams["INSTANT_RELOAD"] = $arParams["INSTANT_RELOAD"] === "Y";
     $arParams["SECTION_TITLE"] = trim($arParams["SECTION_TITLE"]);
     $arParams["SECTION_DESCRIPTION"] = trim($arParams["SECTION_DESCRIPTION"]);
     $arParams["FILTER_NAME"] = isset($arParams["FILTER_NAME"]) ? (string) $arParams["FILTER_NAME"] : '';
     if ($arParams["FILTER_NAME"] == '' || !preg_match("/^[A-Za-z_][A-Za-z01-9_]*\$/", $arParams["FILTER_NAME"])) {
         $arParams["FILTER_NAME"] = "arrFilter";
     }
     $arParams["CONVERT_CURRENCY"] = $arParams["CONVERT_CURRENCY"] === "Y";
     $arParams["CURRENCY_ID"] = trim($arParams["CURRENCY_ID"]);
     if ($arParams["CURRENCY_ID"] == "") {
         $arParams["CONVERT_CURRENCY"] = false;
     } elseif (!$arParams["CONVERT_CURRENCY"]) {
         $arParams["CURRENCY_ID"] = "";
     }
     return $arParams;
 }
示例#2
0
     $rsSection = CIBlockSection::GetList(array(), $arFilter, false, $arSelect);
     $rsSection->SetUrlTemplates("", $arParams["SECTION_URL"]);
     $arResult = $rsSection->GetNext();
     if ($arResult) {
         $bSectionFound = true;
     }
 } elseif (strlen($arParams["SECTION_CODE"]) > 0) {
     $arFilter["=CODE"] = $arParams["SECTION_CODE"];
     $rsSection = CIBlockSection::GetList(array(), $arFilter, false, $arSelect);
     $rsSection->SetUrlTemplates("", $arParams["SECTION_URL"]);
     $arResult = $rsSection->GetNext();
     if ($arResult) {
         $bSectionFound = true;
     }
 } elseif (strlen($arParams["SECTION_CODE_PATH"]) > 0) {
     $sectionId = CIBlockFindTools::GetSectionIDByCodePath($arParams["IBLOCK_ID"], $arParams["SECTION_CODE_PATH"]);
     if ($sectionId) {
         $arFilter["ID"] = $sectionId;
         $rsSection = CIBlockSection::GetList(array(), $arFilter, false, $arSelect);
         $rsSection->SetUrlTemplates("", $arParams["SECTION_URL"]);
         $arResult = $rsSection->GetNext();
         if ($arResult) {
             $bSectionFound = true;
         }
     }
 } else {
     //Root section (no section filter)
     $arResult = array("ID" => 0, "IBLOCK_ID" => $arParams["IBLOCK_ID"]);
     $bSectionFound = true;
 }
 if (!$bSectionFound) {