"ASC" ], [ "IBLOCK_ID" => IBLOCK_ID_CITIES, ], false, false, [ "CODE", ] ); while($sitemap_all_cities_search_ob = $sitemap_all_cities_search_res->GetNextElement()) { $city = $sitemap_all_cities_search_ob->GetFields(); $sitemap_regions[] = $city['CODE']; } $sitemap_all_brands_search_res = CIBlockElement::GetList( [ "NAME" => "ASC" ], [ "IBLOCK_ID" => IBLOCK_ID_BRANDS, ], false, false, [ "CODE", "PROPERTY_UID" ] ); while($sitemap_all_brands_search_ob = $sitemap_all_brands_search_res->GetNextElement()) { $brand = $sitemap_all_brands_search_ob->GetFields(); $brand['MODELS'] = []; $sitemap_brands[$brand['PROPERTY_UID_VALUE']] = $brand; } $sitemap_all_models_search_res = CIBlockElement::GetList( [], [ "IBLOCK_ID" => IBLOCK_ID_MODELS, "PROPERTY_PROMO_VALUE" => "Да" ], false, false, [ "CODE", "PROPERTY_BRAND_UID"] ); while($sitemap_all_models_search_ob = $sitemap_all_models_search_res->GetNextElement()) { $model = $sitemap_all_models_search_ob->GetFields(); $model['PROPERTIES'] = $sitemap_all_models_search_ob->GetProperties(); array_push($sitemap_brands[$model['PROPERTY_BRAND_UID_VALUE']]['MODELS'], $model); } $url = "https://".SITE_SERVER_NAME."/regions"; $lastmod = date(DATE_W3C); $sitemap_regions_string = "\n\n"; $sitemap_regions_string .= "".$url."/"."".$lastmod.""."\n"; foreach($sitemap_regions AS $city) { $sitemap_regions_string .= "".$url."/".$city."/"."".$lastmod.""."\n"; foreach($sitemap_brands AS $brand) { $sitemap_regions_string .= "".$url."/".$city."/".$brand['CODE']."/"."".$lastmod.""."\n"; foreach($brand['MODELS'] AS $model) { $sitemap_regions_string .= "".$url."/".$city."/".$brand['CODE']."/".$model['CODE']."/"."".$lastmod.""."\n"; } } } $sitemap_regions_string .= ""."\n"; file_put_contents("/home/bitrix/www/sitemap-regions.xml", $sitemap_regions_string); $chunk = "https://www.evoleasing.ru/sitemap-regions.xml".date(DATE_W3C).""; $sitemap_index = file_get_contents("/home/bitrix/www/sitemap.xml"); $sitemap_index = str_replace(">", ">\n", $sitemap_index); $sitemap_index = str_replace("", $chunk, $sitemap_index); $sitemap_index = str_replace("\n", "", $sitemap_index); file_put_contents("/home/bitrix/www/sitemap.xml", $sitemap_index); /* sitemap regions file end -------------------------------------------------------------*/ die(); ?>