Created
January 31, 2025 13:44
-
-
Save EscApp2/afba23973a48c99b76832ffc915ce190 to your computer and use it in GitHub Desktop.
Перенести товары в /product/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1)Скопировать /catalog/ в /product/index.php | |
*)В /product/index.php добавить | |
Сверху | |
<? | |
// если нужно | |
$APPLICATION->AddChainItem("Каталог", "/catalog/"); | |
?> | |
<? | |
$dir = $APPLICATION->GetCurDir(false); | |
if("/product/" == $dir){ | |
LocalRedirect('/catalog/', "301 Moved permanently"); | |
} | |
?> | |
В компоненте "bitrix:catalog" | |
"SEF_FOLDER" => "/product/", сделать | |
и | |
"SEF_URL_TEMPLATES" => array( | |
.... | |
"section"=> //оставить | |
"element" => "#ELEMENT_CODE#/", | |
..... | |
), | |
Также добавить | |
"SECTION_SEF_FOLDER" => "/catalog/", | |
*)В /catalog/index.php добавить | |
В компоненте "bitrix:catalog" | |
"SEF_URL_TEMPLATES" => array( | |
.... | |
"element" => "#ELEMENT_CODE#/", | |
..... | |
), | |
также добавить | |
"PRODUCT_SEF_FOLDER" => "/product/", | |
*) В bitrix:catalog section.php и element.php вверх добавить | |
if($arParams['PRODUCT_SEF_FOLDER']){ | |
$DETAIL_URL = $arParams['PRODUCT_SEF_FOLDER'].$arResult["URL_TEMPLATES"]["element"]; | |
}else{ | |
$DETAIL_URL = $arResult["FOLDER"].$arResult["URL_TEMPLATES"]["element"]; | |
} | |
if($arParams['SECTION_SEF_FOLDER']){ | |
$SECTION_URL = $arParams['SECTION_SEF_FOLDER'].$arResult["URL_TEMPLATES"]["section"]; | |
}else{ | |
$SECTION_URL = $arResult["FOLDER"].$arResult["URL_TEMPLATES"]["section"]; | |
} | |
И заменить ниже и во всех include | |
$arResult["URL_TEMPLATES"]["element"] на $DETAIL_URL | |
И | |
$arResult["URL_TEMPLATES"]["section"] на $SECTION_URL | |
*) В правил обработки адресов | |
добавить правило | |
#^/product/# | |
bitrix:catalog | |
/product/index.php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment