Skip to content

Instantly share code, notes, and snippets.

@SergeyZaigraev
Created October 13, 2017 07:59
Show Gist options
  • Save SergeyZaigraev/54d700134c6013fe6750949e4d8ae632 to your computer and use it in GitHub Desktop.
Save SergeyZaigraev/54d700134c6013fe6750949e4d8ae632 to your computer and use it in GitHub Desktop.
Smart filter. Build smart url
// SMART FILTER LINK //
$arSectionInfo = CIBlockSection::GetByID($arSmartFilter['SECTION_ID'])->GetNext();
$sefSmartUrl = $arSectionInfo['SECTION_PAGE_URL'] . "filter/#SMART_FILTER_PATH#/";
foreach($arResult["ITEMS"] as $PID => $arItem)
{
$code = null;
if ($arItem["CODE"]){
$code = toLower($arItem["CODE"]);
}else{
$code = $arItem["ID"];
}
if($arItem["PROPERTY_TYPE"] != "N" && $arItem["DISPLAY_TYPE"] != "U")
foreach($arItem["VALUES"] as $key => $ar)
{
$arResult["ITEMS"][$PID]['VALUES'][$key]['SMART_URL'] = str_replace("#SMART_FILTER_PATH#", implode("/", $this->__component->encodeSmartParts(array(array($code,$ar["URL_ID"])))), $sefSmartUrl);
}
}
@SergeyZaigraev
Copy link
Author

Создание чпу ссылок для параметров фильтра

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment