Bitrix - ЧПУ и вырезка catalog из url

Первая задача настроить ЧПУ решается просто.

1. В настройках Рабочий стол > Контент > Инфоблоки > Типы инфоблоков > Каталог меняем параметры URL страницы раздела и URL страницы детального просмотра

URL страницы раздела:

#SITE_DIR#/#SECTION_CODE_PATH#/

Вместо:

#SITE_DIR#/catalog/#SECTION_CODE_PATH#/

URL страницы детального просмотра:

#SITE_DIR#/#SECTION_CODE_PATH#/#ELEMENT_CODE#/

Вместо:

#SITE_DIR#/catalog/#SECTION_CODE_PATH#/#ELEMENT_CODE#/

2. Если есть стравнение на сайте то путь

#SITE_DIR#catalog/compare.php

Надо исправить на

#SITE_DIR#compare.php

3. Проверяем urlrewrite.php в корне сайта, должно появится правило

array (
    'CONDITION' => '#^/#',
    'RULE' => '',
    'ID' => 'bitrix:catalog',
    'PATH' => '/catalog/index.php',
    'SORT' => 100,
  )

4. Правим настройки компонента bitrix:catalog

"SEF_MODE" => "Y",
"SEF_FOLDER" => "/",
"SEF_URL_TEMPLATES" => array(
            "sections" => "",
            "section" => "#SECTION_CODE_PATH#/",
            "element" => "#SECTION_CODE_PATH#/#ELEMENT_CODE#/",
            "compare" => "compare.php?action=#ACTION_CODE#",
            "smart_filter" => "#SECTION_CODE_PATH#/filter/#SMART_FILTER_PATH#/apply/",
        ),

На этоп этапе у нас уже все должно работать, с парочкой «Но». «Но» первое: отвалился поиск. «Но» второе: ссылка site.ru/catalog/ не работает. Оно и понятно - catalog расценивается как имя раздела.

5. Как бы это не было плохо правим
bitrix > components > bitrix > catalog > component.php 
После определения перемнной $componentPage
проверяем и исправляем ее

if($APPLICATION->GetCurPage() === "/catalog/" 
&& $componentPage == "section"){
    $componentPage = "sections";
}

6. Поиск чинится так: создаем отдельный раздел например /search/ и помещаем в него компонент bitrix:catalog.search

$APPLICATION->IncludeComponent(
    "bitrix:catalog.search", 
    "main", 
    array(
        "IBLOCK_TYPE" => "my_catalog",
        "IBLOCK_ID" => "2",
        "SORT_BUTTONS" => array(
            0 => "POPULARITY",
            1 => "NAME",
            2 => "PRICE",
        ),
        "SORT_PRICES" => "MINIMUM_PRICE",
        "ELEMENT_SORT_FIELD" => "shows",
        "ELEMENT_SORT_ORDER" => "asc",
        "PAGE_ELEMENT_COUNT" => "20",
        "LINE_ELEMENT_COUNT" => "4",
        "PROPERTY_CODE" => array(
            0 => "",
            1 => "",
        ),
        "OFFERS_CART_PROPERTIES" => "",
        "OFFERS_LIMIT" => "10",
        "SHOW_ARTICLE_SKU" => "N",
        "SHOW_MEASURE_WITH_RATIO" => "N",
        "DEFAULT_LIST_TEMPLATE" => "block",
        "OFFERS_FIELD_CODE" => array(
            0 => "NAME",
            1 => "CML2_LINK",
            2 => "DETAIL_PAGE_URL",
            3 => "",
        ),
        "OFFERS_PROPERTY_CODE" => array(
            0 => "ARTICLE",
            1 => "VOLUME",
            2 => "SIZES",
            3 => "COLOR_REF",
            4 => "",
        ),
        "OFFERS_SORT_FIELD" => "shows",
        "OFFERS_SORT_ORDER" => "asc",
        "OFFERS_SORT_FIELD2" => "shows",
        "OFFERS_SORT_ORDER2" => "asc",
        "OFFER_TREE_PROPS" => array(
            0 => "SIZES",
            1 => "COLOR_REF",
        ),
        "SECTION_URL" => "#SITE_DIR#/#SECTION_CODE_PATH#/",
        "DETAIL_URL" => "#SITE_DIR#/#SECTION_CODE_PATH#/#ELEMENT_CODE#/",
        "BASKET_URL" => "/basket/",
        "ACTION_VARIABLE" => "action",
        "PRODUCT_ID_VARIABLE" => "id",
        "PRODUCT_QUANTITY_VARIABLE" => "quantity",
        "PRODUCT_PROPS_VARIABLE" => "prop",
        "SECTION_ID_VARIABLE" => "SECTION_CODE",
        "CACHE_TYPE" => "N",
        "CACHE_TIME" => "3600000",
        "USE_COMPARE" => "Y",
        "PRICE_CODE" => array(
            0 => "Розничная",
        ),
        "USE_PRICE_COUNT" => "Y",
        "SHOW_PRICE_COUNT" => "1",
        "PRICE_VAT_INCLUDE" => "Y",
        "PRODUCT_PROPERTIES" => array(
        ),
        "USE_PRODUCT_QUANTITY" => "Y",
        "CONVERT_CURRENCY" => "Y",
        "CURRENCY_ID" => "RUB",
        "DISPLAY_TOP_PAGER" => "N",
        "DISPLAY_BOTTOM_PAGER" => "Y",
        "PAGER_TITLE" => "Товары",
        "PAGER_SHOW_ALWAYS" => "N",
        "HIDE_NOT_AVAILABLE" => "N",
        "PAGER_TEMPLATE" => "main",
        "PAGER_DESC_NUMBERING" => "N",
        "PAGER_DESC_NUMBERING_CACHE_TIME" => "36000",
        "PAGER_SHOW_ALL" => "N",
        "FILTER_NAME" => "NEXT_SMART_FILTER",
        "SECTION_ID" => "",
        "SECTION_CODE" => "",
        "SECTION_USER_FIELDS" => "",
        "INCLUDE_SUBSECTIONS" => "Y",
        "SHOW_ALL_WO_SECTION" => "Y",
        "META_KEYWORDS" => "",
        "META_DESCRIPTION" => "",
        "BROWSER_TITLE" => "",
        "ADD_SECTIONS_CHAIN" => "N",
        "SET_TITLE" => "N",
        "SET_STATUS_404" => "N",
        "CACHE_FILTER" => "Y",
        "CACHE_GROUPS" => "N",
        "RESTART" => "Y",
        "NO_WORD_LOGIC" => "Y",
        "USE_LANGUAGE_GUESS" => "Y",
        "CHECK_DATES" => "Y",
        "DISPLAY_WISH_BUTTONS" => "Y",
        "DISPLAY_COMPARE" => "N",
        "DEFAULT_COUNT" => "1",
        "SHOW_HINTS" => "Y",
        "SHOW_DISCOUNT_PERCENT" => "Y",
        "SHOW_OLD_PRICE" => "Y",
        "SALE_STIKER" => "SALE_TEXT",
        "SHOW_RATING" => "Y",
        "SHOW_DISCOUNT_TIME" => "Y",
        "ADD_PROPERTIES_TO_BASKET" => "Y",
        "PARTIAL_PRODUCT_PROPERTIES" => "Y",
        "USE_MAIN_ELEMENT_SECTION" => "Y",
        "OFFER_HIDE_NAME_PROPS" => "N",
        "SHOW_MEASURE" => "Y",
        "SHOW_COUNTER_LIST" => "Y",
        "HIDE_NOT_AVAILABLE_OFFERS" => "N",
        "COMPONENT_TEMPLATE" => "main",
        "ELEMENT_SORT_FIELD2" => "id",
        "ELEMENT_SORT_ORDER2" => "desc",
        "AJAX_MODE" => "N",
        "AJAX_OPTION_JUMP" => "N",
        "AJAX_OPTION_STYLE" => "Y",
        "AJAX_OPTION_HISTORY" => "N",
        "AJAX_OPTION_ADDITIONAL" => "",
        "COMPOSITE_FRAME_MODE" => "A",
        "COMPOSITE_FRAME_TYPE" => "AUTO"
    ),
    $component
);

7. А также правим в bitrix:search.title

"PAGE" => "/search/",
Вместо
"PAGE" => "/catalog/",

Конец.