Для правильной обработки адресов в тегах нужно доработать функцию ReinitPath в классе CEnext
Code
Copy code
Code copied!
public static function ReinitPath() { $context = Bitrix\Main\Application::getInstance()->getContext(); $request = $context->getRequest(); if(strpos($request->getRequestUri(), "/bitrix") === false && Bitrix\Main\Config\Option::get("main", "wizard_solution", "", SITE_ID) == "enext" && SITE_TEMPLATE_ID == "enext" && (!$request->isAjaxRequest() || $request->get("bxajaxid"))) { $arBackParametrs = CEnext::GetBackParametrsValues(SITE_ID); if(intval($arBackParametrs["SMART_FILTER_SEO_ID"]) > 0) { $arUrl = CHTTP::ParseURL($request->getRequestUri()); $arFilter = array("ACTIVE" => "Y", "IBLOCK_ID" => $arBackParametrs["SMART_FILTER_SEO_ID"], array("LOGIC" => "OR", array("LOGIC" => "OR", array("PROPERTY_DEFAULT_URL" => $arUrl["path"]), array("PROPERTY_DEFAULT_URL" => $arUrl["path_query"])), array("CODE" => basename($arUrl["path"])))); $isCacheManager = defined("BX_COMP_MANAGED_CACHE") && is_object($GLOBALS["CACHE_MANAGER"]); $obCache = new CPHPCache(); if($obCache->InitCache(1,serialize($arFilter) . LANGUAGE_ID //edit_by_Fantych: 02.08.2023 ,"/iblock/catalog")) { $arResult = $obCache->GetVars(); } elseif(Bitrix\Main\Loader::includeModule("iblock") && $obCache->StartDataCache()) { $arResult = array(); $rsElement = FCIBlockElement::GetList(array(), $arFilter, false, false, array("ID", "CODE", "IBLOCK_ID", "PREVIEW_TEXT", "DETAIL_TEXT", "DETAIL_PAGE_URL", "PROPERTY_DEFAULT_URL", "PROPERTY_FAQ", "PROPERTY_CANONICAL_URL")); if($isCacheManager) $GLOBALS["CACHE_MANAGER"]->StartTagCache("/iblock/catalog"); if($arElement = $rsElement->GetNext()) { if($isCacheManager) $GLOBALS["CACHE_MANAGER"]->RegisterTag("iblock_id_".$arBackParametrs["SMART_FILTER_SEO_ID"]); $arResult["DEFAULT_URL"] = $arElement["PROPERTY_DEFAULT_URL_VALUE"]; if(!empty($arElement["CODE"])) $arResult["NEW_URL"] = $arElement["DETAIL_PAGE_URL"]; $arResult["PREVIEW_TEXT"] = $arElement["PREVIEW_TEXT"]; $arResult["DETAIL_TEXT"] = $arElement["DETAIL_TEXT"]; $arResult["FAQ"] = $arElement["PROPERTY_FAQ_VALUE"]; $ipropValues = new \Modulemarket\Translator\InheritedProperty\ElementValues($arElement["IBLOCK_ID"], $arElement["ID"]); $arResult["IPROPERTY_VALUES"] = $ipropValues->getValues(); $arResult["CANONICAL_URL"] = $arElement["PROPERTY_CANONICAL_URL_VALUE"]; } if($isCacheManager) $GLOBALS["CACHE_MANAGER"]->EndTagCache(); $obCache->EndDataCache($arResult); } else { $arResult = array(); } unset($arFilter); global $seoMeta; $seoMeta["IPROPERTY_VALUES"] = $arResult["IPROPERTY_VALUES"]; $seoMeta["PREVIEW"] = $arResult["PREVIEW_TEXT"]; $seoMeta["DESCRIPTION"] = $arResult["DETAIL_TEXT"]; $seoMeta["FAQ"] = $arResult["FAQ"]; $seoMeta["CANONICAL_URL"] = $arResult["CANONICAL_URL"]; if(!empty($arResult["DEFAULT_URL"]) && !empty($arResult["NEW_URL"]) && $arResult["DEFAULT_URL"] != $arResult["NEW_URL"]) { $seoMeta["SMART_FILTER_LINK"] = true; if($arUrl["path"] == $arResult["DEFAULT_URL"] || $arUrl["path_query"] == $arResult["DEFAULT_URL"]) { LocalRedirect($arResult["NEW_URL"].(!empty($arUrl["query"]) ? "?".$arUrl["query"] : ""), false, "301 Moved Permanently"); } elseif($arUrl["path"] == $arResult["NEW_URL"]) { $server = $context->getServer(); $server_array = $server->toArray(); $arUrlNew = CHTTP::ParseURL($arResult["DEFAULT_URL"]); if(!empty($arUrlNew["query"])) { $getList = explode("&", $arUrlNew["query"]); foreach($getList as $getItem) { $get = explode("=", $getItem); $_GET[$get[0]] = $get[1]; } unset($get, $getItem, $getList); } unset($arUrlNew); $_SERVER["REQUEST_URI"] = $arResult["DEFAULT_URL"]; $server_array["REQUEST_URI"] = $_SERVER["REQUEST_URI"]; $server->set($server_array); $context->initialize(new Bitrix\Main\HttpRequest($server, $_GET, array(), array(), $_COOKIE), $context->getResponse(), $server); $GLOBALS["APPLICATION"]->reinitPath(); $GLOBALS["APPLICATION"]->SetCurPage($arResult["NEW_URL"]); } } } } }
Количество показов: 251
Дата изменения: 22.09.2023 11:01:40