update for sitemap generation for catalog section
This commit is contained in:
parent
a74efbb0fc
commit
522d24869b
@ -6811,6 +6811,7 @@ RewriteRule ^car/hyundai-tucson-lifestyle-plus-plus-smart-sense-2-0d-8at-4wd/$ h
|
||||
RewriteRule ^car/hyundai-tucson-family-plus-2-0d-8at-4wd/$ https://www.evoleasing.ru/car/hyundai-tucson-family-plus-2-0d-8at-4wd-2020/ [R=301,NE,NC,L]
|
||||
RewriteRule ^car/hyundai-tucson-lifestyle-plus-2-0d-8at-4wd/$ https://www.evoleasing.ru/car/hyundai-tucson-lifestyle-plus-2-0d-8at-4wd-2020/ [R=301,NE,NC,L]
|
||||
RewriteRule ^car/hyundai-tucson-lifestyle-plus-plus-navigation-2-0d-8at-4wd/$ https://www.evoleasing.ru/car/hyundai-tucson-lifestyle-plus--plus--navigation-2-0d-8at-4wd-2020/ [R=301,NE,NC,L]
|
||||
RewriteRule ^car/hyundai-tucson-lifestyle-smart-sense-2-0-6at-2wd/$ https://www.evoleasing.ru/car/hyundai-tucson-lifestyle--plus--smart-sense-2-0-6at-2wd-2020/ [R=301,NE,NC,L]
|
||||
RewriteRule ^car/mini-5-door-cooper-classic/$ https://www.evoleasing.ru/car/mini-5-door-cooper-classic-2021/ [R=301,NE,NC,L]
|
||||
RewriteRule ^car/mini-5-door-cooper-jcw/$ https://www.evoleasing.ru/car/mini-5-door-cooper-jcw-2021/ [R=301,NE,NC,L]
|
||||
RewriteRule ^car/mini-5-door-cooper-essential/$ https://www.evoleasing.ru/car/mini-5-door-cooper-essential-2021/ [R=301,NE,NC,L]
|
||||
|
||||
@ -13,7 +13,7 @@ CModule::IncludeModule('iblock');
|
||||
|
||||
$catalog = [];
|
||||
|
||||
$all_brands_search_res = CIBlockElement::GetList( [], [ "IBLOCK_ID" => 8, "ACTIVE" => "Y" ], false, false, [ "CODE", "PROPERTY_UID" ] );
|
||||
$all_brands_search_res = CIBlockElement::GetList( [], [ "IBLOCK_ID" => IBLOCK_ID_BRANDS, ], false, false, [ "CODE", "PROPERTY_UID" ] );
|
||||
while($all_brands_search_ob = $all_brands_search_res->GetNextElement())
|
||||
{
|
||||
$brand = $all_brands_search_ob->GetFields();
|
||||
@ -22,7 +22,7 @@ while($all_brands_search_ob = $all_brands_search_res->GetNextElement())
|
||||
$catalog[$brand['PROPERTY_UID_VALUE']] = $brand;
|
||||
}
|
||||
|
||||
$all_models_search_res = CIBlockElement::GetList( [], [ "IBLOCK_ID" => 9, "ACTIVE" => "Y" ], false, false, [ "CODE", "PROPERTY_BRAND_UID"] );
|
||||
$all_models_search_res = CIBlockElement::GetList( [], [ "IBLOCK_ID" => IBLOCK_ID_MODELS, ], false, false, [ "CODE", "PROPERTY_BRAND_UID"] );
|
||||
while($all_models_search_ob = $all_models_search_res->GetNextElement())
|
||||
{
|
||||
$model = $all_models_search_ob->GetFields();
|
||||
@ -45,31 +45,34 @@ $strBegin = "<?xml version='1.0' encoding='UTF-8'?>\n<urlset xmlns:xsi=\"http://
|
||||
|
||||
foreach($catalog AS $brand)
|
||||
{
|
||||
//print ;
|
||||
//print "\n";
|
||||
//"\t".
|
||||
$strBegin .= "<url><loc>".$url."/".$brand['CODE']."/"."</loc><lastmod>".$lastmod."</lastmod></url>"."\n";
|
||||
|
||||
foreach($brand['MODELS'] AS $model)
|
||||
{
|
||||
//print "\t";
|
||||
//print $url."/".$brand['CODE']."/".$model['CODE']."/";
|
||||
//print "\n";
|
||||
//"\t"."\t".
|
||||
$strBegin .= "<url><loc>".$url."/".$brand['CODE']."/".$model['CODE']."/"."</loc><lastmod>".$lastmod."</lastmod></url>"."\n";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url><loc>https://evo.quickcode.ru/</loc><lastmod>2022-03-29T15:01:44+03:00</lastmod></url>
|
||||
*/
|
||||
$car_search_res = CIBlockElement::GetList( [ "NAME" => "ASC" ], [ "IBLOCK_ID" => IBLOCK_ID_CATALOG_CARS_NEW, ], false, [], [] );
|
||||
while($car_search_ob = $car_search_res->GetNextElement())
|
||||
{
|
||||
$car_existed = $car_search_ob->GetFields();
|
||||
$strBegin .= "<url><loc>https://".SITE_SERVER_NAME.$car_existed['DETAIL_PAGE_URL']."</loc><lastmod>".$lastmod."</lastmod></url>"."\n";
|
||||
}
|
||||
$strBegin .= "</urlset>"."\n";
|
||||
|
||||
file_put_contents("../sitemap-catalog.xml", $strBegin);
|
||||
//print $strBegin;
|
||||
|
||||
$chunk = "<sitemap><loc>https://www.evoleasing.ru/sitemap-catalog.xml</loc><lastmod>".date(DATE_W3C)."</lastmod></sitemap></sitemapindex>";
|
||||
|
||||
$sitemap_index = file_get_contents("../sitemap.xml");
|
||||
$sitemap_index = str_replace(">", ">\n", $sitemap_index);
|
||||
$sitemap_index = str_replace("</sitemapindex>", $chunk, $sitemap_index);
|
||||
$sitemap_index = str_replace("\n", "", $sitemap_index);
|
||||
file_put_contents("../sitemap.xml", $sitemap_index);
|
||||
|
||||
|
||||
die();
|
||||
|
||||
?>
|
||||
Loading…
x
Reference in New Issue
Block a user