Skip to content

Instantly share code, notes, and snippets.

@andrei99
Last active June 9, 2021 14:40
Show Gist options
  • Save andrei99/2ec223ac7309b05578e5393e91769201 to your computer and use it in GitHub Desktop.
Save andrei99/2ec223ac7309b05578e5393e91769201 to your computer and use it in GitHub Desktop.
Create catalog Bitrix
JCSmartFilter.prototype.postHandler = function (result, fromCache)
{
var hrefFILTER, url, curProp;
var modef = BX('modef');
var modef_num = BX('modef_num');
if (!!result && !!result.ITEMS)
{
//----------------------------------------------------------------
var furl = BX.util.htmlspecialcharsback(result.FILTER_URL);
$('#set_filter').attr('href', furl);
window.location.href = furl;
//----------------------------------------------------------------
for(var popupId in this.popups)
{
if (this.popups.hasOwnProperty(popupId))
{
this.popups[popupId].destroy();
}
}
<?$APPLICATION->IncludeComponent(
"bitrix:catalog.smart.filter",
"catalog",
array(
"CACHE_GROUPS" => "Y",
"CACHE_TIME" => "36000000",
"CACHE_TYPE" => "A",
"CONVERT_CURRENCY" => "N",
"DISPLAY_ELEMENT_COUNT" => "Y",
"FILTER_NAME" => "arrFilter",
"FILTER_VIEW_MODE" => "vertical",
"HIDE_NOT_AVAILABLE" => "Y",
"IBLOCK_ID" => "4",
"IBLOCK_TYPE" => "1c_catalog",
"PAGER_PARAMS_NAME" => "arrPager",
"POPUP_POSITION" => "right",
"PRICE_CODE" => array(
),
"SAVE_IN_SESSION" => "N",
"SECTION_CODE" => $_REQUEST["CODE"],
"SECTION_CODE_PATH" => "",
"SECTION_DESCRIPTION" => "-",
"SECTION_ID" => "",
"SECTION_TITLE" => "-",
"SEF_MODE" => "Y",
"SEF_RULE" => "/catalog/#SECTION_CODE#/filter/#SMART_FILTER_PATH#/apply/",
"SMART_FILTER_PATH" => $_REQUEST["SMART_FILTER_PATH"],
"TEMPLATE_THEME" => "blue",
"XML_EXPORT" => "N",
"COMPONENT_TEMPLATE" => "catalog"
),
false
);?>
//tamplate filter
<? $this->SetViewTarget('left_area'); ?>
***template filte***
<? $this->EndViewTarget() ?>
//template catalog
<div class="wrap_filter">
<? $APPLICATION->ShowViewContent('left_area') ?>
</div>
<?
$arUrlRewrite = array(
array(
"CONDITION" => "#^/catalog/([^/]+?)/filter/(.+?)/apply/\\??(.*)#",
"RULE" => "SECTION_CODE=\$1&SMART_FILTER_PATH=\$2&\$3",
"ID" => "bitrix:catalog.smart.filter",
"PATH" => "/catalog/index.php",
),
array(
"CONDITION" => "#^/catalog/filter/(.+?)/apply/\\??(.*)#",
"RULE" => "SMART_FILTER_PATH=\$1&\$2",
"ID" => "",
"PATH" => "/catalog/index.php",
),
array(
"CONDITION" => "#^/catalog/([^/]+?)/([^/]+?)/[^/]*\$#",
"RULE" => "SECTION_CODE=\$1&ELEMENT_CODE=\$2",
"ID" => "",
"PATH" => "/catalog/detail.php",
),
array(
"CONDITION" => "#^/catalog/([^/]+?)/[^/]*\$#",
"RULE" => "SECTION_CODE=\$1",
"ID" => "",
"PATH" => "/catalog/index.php",
),
array(
"CONDITION" => "#^/news/([^/]+?)/.*#",
"RULE" => "ELEMENT_CODE=\$1",
"ID" => "",
"PATH" => "/news/detail.php",
),
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment