diff --git a/local/ilsa_update.php b/local/ilsa_update.php
index 7453538..7c4e2bb 100644
--- a/local/ilsa_update.php
+++ b/local/ilsa_update.php
@@ -2507,15 +2507,15 @@ if(!in_array("simulate", $GLOBALS['argv']))
$sitemap_catalog_string .= ""."\n";
- file_put_contents("/home/bitrix/www/sitemap-catalog.xml", $sitemap_catalog_string);
+ file_put_contents($_SERVER['DOCUMENT_ROOT']."/sitemap-catalog.xml", $sitemap_catalog_string);
- $chunk = "https://www.evoleasing.ru/sitemap-catalog.xml".date(DATE_W3C)."";
+ $chunk = "https://www.evoleasing.ru/sitemap-catalog.xml".date( DATE_W3C )."";
- $sitemap_index = file_get_contents("/home/bitrix/www/sitemap.xml");
+ $sitemap_index = file_get_contents($_SERVER['DOCUMENT_ROOT']."/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);
+ file_put_contents($_SERVER['DOCUMENT_ROOT']."/sitemap.xml", $sitemap_index);
/* sitemap catalog file end -------------------------------------------------------------*/
@@ -2583,15 +2583,83 @@ if(!in_array("simulate", $GLOBALS['argv']))
$sitemap_regions_string .= ""."\n";
- file_put_contents("/home/bitrix/www/sitemap-regions.xml", $sitemap_regions_string);
+ file_put_contents($_SERVER['DOCUMENT_ROOT']."/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 = file_get_contents($_SERVER['DOCUMENT_ROOT']."/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);
+ file_put_contents($_SERVER['DOCUMENT_ROOT']."/sitemap.xml", $sitemap_index);
+
+ /* sitemap aggregations programs file start -------------------------------------------------------------*/
+
+ $url = "https://".SITE_SERVER_NAME."/programs";
+ $lastmod = date(DATE_W3C);
+
+ $sitemap_program_aggregations_string = "\n\n";
+ $sitemap_program_aggregations_string .= "".$url."/"."".$lastmod.""."\n";
+
+ $programs = [[
+ "ROOT_ID" => IBLOCK_ID_PROGRAMS_AGGREGATION_SPECIAL,
+ "ROOT_CHUNK" => IBLOCK_ID_PROGRAMS_AGGREGATION_SPECIAL_CHUNK,
+ "BRANDS_ID" => IBLOCK_ID_PROGRAMS_AGGREGATION_BRANDS_SPECIAL,
+ "RULES_ID" => IBLOCK_ID_PROGRAMS_AGGREGATION_RULES_SPECIAL,
+ ], [
+ "ROOT_ID" => IBLOCK_ID_PROGRAMS_AGGREGATION_CARGO,
+ "ROOT_CHUNK" => IBLOCK_ID_PROGRAMS_AGGREGATION_CARGO_CHUNK,
+ "BRANDS_ID" => IBLOCK_ID_PROGRAMS_AGGREGATION_BRANDS_CARGO,
+ "RULES_ID" => IBLOCK_ID_PROGRAMS_AGGREGATION_RULES_CARGO,
+ ]];
+
+ foreach($programs AS $program)
+ {
+ $sitemap_program_aggregations_root = CIBlockSection::GetList([ "NAME" => "ASC" ], [ "IBLOCK_ID" => $program['ROOT_ID'] ], false, [], false);
+ while ($sitemap_program_aggregations_root_section = $sitemap_program_aggregations_root->GetNext())
+ {
+ $sitemap_program_aggregations_string .= "".$url."/".$program['ROOT_CHUNK']."/".$sitemap_program_aggregations_root_section['CODE']."/"."".$lastmod.""."\n";
+
+ $sitemap_program_aggregations_entries = CIBlockElement::GetList([ "NAME" => "ASC" ], [ "IBLOCK_ID" => $program['ROOT_ID'], "SECTION_ID" => intval($sitemap_program_aggregations_root_section['ID']), "ACTIVE" => "Y" ], false, [ "nTopCount" => 1000 ], [], );
+ while($sitemap_program_aggregations_entry_ob = $sitemap_program_aggregations_entries->GetNextElement())
+ {
+ $sitemap_program_aggregations_entry = $sitemap_program_aggregations_entry_ob->GetFields();
+ $sitemap_program_aggregations_string .= "".$url."/".$program['ROOT_CHUNK']."/".$sitemap_program_aggregations_root_section['CODE']."/".$sitemap_program_aggregations_entry['CODE']."/"."".$lastmod.""."\n";
+ }
+ }
+
+ $sitemap_program_aggregations_brands = CIBlockElement::GetList([ "NAME" => "ASC" ], [ "IBLOCK_ID" => $program['BRANDS_ID'], "ACTIVE" => "Y" ], false, [ "nTopCount" => 1000 ], [], );
+ while($sitemap_program_aggregations_brand_ob = $sitemap_program_aggregations_brands->GetNextElement())
+ {
+ $sitemap_program_aggregations_brand = $sitemap_program_aggregations_brand_ob->GetFields();
+ $sitemap_program_aggregations_string .= "".$url."/".$program['ROOT_CHUNK']."/".$sitemap_program_aggregations_brand['CODE']."/"."".$lastmod.""."\n";
+
+ $sitemap_program_aggregations_brand_types = CIBlockElement::GetList([ "NAME" => "ASC" ], [ "IBLOCK_ID" => $program['RULES_ID'], "PROPERTY_VEHICLE_BRAND" => $sitemap_program_aggregations_brand['ID'], "ACTIVE" => "Y" ], false, [ "nTopCount" => 1000 ], [], );
+ while($sitemap_program_aggregations_type_ob = $sitemap_program_aggregations_brand_types->GetNextElement())
+ {
+ $sitemap_program_aggregations_brand_type = $sitemap_program_aggregations_type_ob->GetFields();
+ $sitemap_program_aggregations_brand_type['PROPERTIES'] = $sitemap_program_aggregations_type_ob->GetProperties();
+
+ if(!empty($sitemap_program_aggregations_brand_type['PROPERTIES']['VEHICLE_TYPE']['VALUE']))
+ {
+ $sitemap_program_aggregations_brand_type_related = get_related($program['ROOT_ID'], $sitemap_program_aggregations_brand_type['PROPERTIES']['VEHICLE_TYPE']['VALUE']);
+ $sitemap_program_aggregations_string .= "".$url."/".$program['ROOT_CHUNK']."/".$sitemap_program_aggregations_brand['CODE']."/".$sitemap_program_aggregations_brand_type_related['CODE']."/"."".$lastmod.""."\n";
+ }
+ }
+ }
+ }
+
+ file_put_contents($_SERVER['DOCUMENT_ROOT']."/sitemap-programs.xml", $sitemap_program_aggregations_string);
+
+ $chunk = "https://www.evoleasing.ru/sitemap-programs.xml".date(DATE_W3C)."";
+
+ $sitemap_index = file_get_contents($_SERVER['DOCUMENT_ROOT']."/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($_SERVER['DOCUMENT_ROOT']."/sitemap.xml", $sitemap_index);
+
+ /* sitemap aggregations programs file end -------------------------------------------------------------*/
}
/* sitemap regions file end -------------------------------------------------------------*/
@@ -2607,12 +2675,8 @@ if(!in_array("simulate", $GLOBALS['argv']) && !in_array("debug", $argv))
]);
}
-//print "----------bitrix_enabled_modifications----------\n";
-//print_r($bitrix_enabled_modifications);
-//print "--------------------\n";
-
-print "-----current_representation-----\n\n";
-print_r($current_representation);
+//print "-----current_representation-----\n\n";
+//print_r($current_representation);
foreach($current_representation AS $brand_uid => $brand)
{
@@ -2658,23 +2722,6 @@ foreach($current_representation AS $brand_uid => $brand)
}
}
-//print "-----current_representation-----\n\n";
-//foreach($current_representation AS $k => $v)
-//{
-// print "[ ".$k." ]\n";
-//}
-
-/*
-print "-----bitrix_existed_brands\n\n";
-print_r($bitrix_existed_brands);
-
-print "-----bitrix_enabled_brands\n\n";
-print_r($bitrix_enabled_brands);
-
-print "-----bitrix_hidden_brands\n\n";
-print_r($bitrix_hidden_brands);
-*/
-
die();
?>
\ No newline at end of file