Merge branch 'master' of https://github.com/merelendor/evoleasing-site
This commit is contained in:
commit
dda7efd8c7
3
.gitignore
vendored
3
.gitignore
vendored
@ -9,4 +9,5 @@ sitemap*
|
||||
cron/yasprav.log
|
||||
vizitka/tmp/
|
||||
vkteamssetup.exe
|
||||
local/*.json
|
||||
local/*.json
|
||||
local/*.txt
|
||||
|
||||
@ -36,7 +36,6 @@ $APPLICATION->SetTitle("Новые автомобили в лизинг");
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<?
|
||||
$APPLICATION->IncludeComponent(
|
||||
"evolution:form.leasing",
|
||||
|
||||
@ -21,7 +21,7 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true))))
|
||||
{
|
||||
$arResult = [];
|
||||
$sort = Array("SORT" => "ASC", "NAME" => "ASC");
|
||||
$filter = Array("ACTIVE" => "Y", "IBLOCK_ID" => 1, "CODE" => $arParams['OFFER']);
|
||||
$filter = Array("IBLOCK_ID" => 1, "CODE" => $arParams['OFFER']);
|
||||
$options = Array("nPageSize" => 1);
|
||||
|
||||
$res = CIBlockElement::GetList($sort, $filter, false, $options);
|
||||
|
||||
51
local/generate_redirects.php
Normal file
51
local/generate_redirects.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?
|
||||
define('STOP_STATISTICS', true);
|
||||
define('NO_KEEP_STATISTIC', 'Y');
|
||||
define('NO_AGENT_STATISTIC', 'Y');
|
||||
define('DisableEventsCheck', true);
|
||||
define('BX_SECURITY_SHOW_MESSAGE', true);
|
||||
define('NOT_CHECK_PERMISSIONS', true);
|
||||
|
||||
$_SERVER['DOCUMENT_ROOT'] = dirname(__DIR__, 1);
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_before.php');
|
||||
CModule::IncludeModule('iblock');
|
||||
|
||||
$old_uids_json = file_get_contents("./uids_codes.json");
|
||||
$old_uids = json_decode($old_uids_json, true);
|
||||
|
||||
$old = 0;
|
||||
$new = 0;
|
||||
$total = 0;
|
||||
|
||||
$car_search_res = CIBlockElement::GetList( [ "ID" => "ASC" ], [ "IBLOCK_ID" => IBLOCK_ID_CATALOG_CARS_NEW, ], false, [], [] );
|
||||
|
||||
$redirects = "";
|
||||
|
||||
while($car_search_ob = $car_search_res->GetNextElement())
|
||||
{
|
||||
$car_existed = $car_search_ob->GetFields();
|
||||
$car_existed['PROPERTIES'] = $car_search_ob->GetProperties();
|
||||
$uid = $car_existed['PROPERTIES']['UID']['VALUE'];
|
||||
|
||||
if(isset($old_uids[ $uid ]))
|
||||
{
|
||||
$old++;
|
||||
$redirects .= "RewriteRule ^car/". $old_uids[ $uid ] ."/$ https://www.evoleasing.ru/car/". $car_existed['CODE'] ."/ [R=301,NE,NC,L]\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$new++;
|
||||
}
|
||||
|
||||
$total++;
|
||||
}
|
||||
|
||||
print "old "+$old."\n";
|
||||
print "new "+$new."\n";
|
||||
print "total "+$total."\n";
|
||||
|
||||
file_put_contents("./car_redirects.txt", $redirects);
|
||||
|
||||
die();
|
||||
|
||||
?>
|
||||
32
local/save_uid_localcode.php
Normal file
32
local/save_uid_localcode.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?
|
||||
//$_SERVER["DOCUMENT_ROOT"] = __DIR__;
|
||||
define('STOP_STATISTICS', true);
|
||||
define('NO_KEEP_STATISTIC', 'Y');
|
||||
define('NO_AGENT_STATISTIC', 'Y');
|
||||
define('DisableEventsCheck', true);
|
||||
define('BX_SECURITY_SHOW_MESSAGE', true);
|
||||
define('NOT_CHECK_PERMISSIONS', true);
|
||||
|
||||
$_SERVER['DOCUMENT_ROOT'] = dirname(__DIR__, 1);
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_before.php');
|
||||
CModule::IncludeModule('iblock');
|
||||
|
||||
$car_search_res = CIBlockElement::GetList( [ "ID" => "ASC" ], [ "IBLOCK_ID" => IBLOCK_ID_CATALOG_CARS_NEW, ], false, [], [] );
|
||||
|
||||
$c = 0;
|
||||
$uids = [];
|
||||
while($car_search_ob = $car_search_res->GetNextElement())
|
||||
{
|
||||
$car_existed = $car_search_ob->GetFields();
|
||||
$car_existed['PROPERTIES'] = $car_search_ob->GetProperties();
|
||||
|
||||
$uids[$car_existed['PROPERTIES']['UID']['VALUE']] = $car_existed['CODE'];
|
||||
}
|
||||
|
||||
print count($uids);
|
||||
|
||||
file_put_contents("./uids_codes_2022_11_30.json", json_encode($uids));
|
||||
|
||||
die();
|
||||
|
||||
?>
|
||||
Loading…
x
Reference in New Issue
Block a user