Update for USED cars indexation, update for DROM XML - add description text

This commit is contained in:
merelendor 2024-06-28 14:49:38 +03:00
parent 947f29c559
commit cbd1d9a5c2
2 changed files with 10 additions and 5 deletions

View File

@ -508,6 +508,8 @@ class DromXMLGenerator
$offer->addChild($k, $v);
}
$offer->addChild("Additional", "Артикул: ".$entry['CODE']."\n".str_replace(["&nbsp;", "<br>", "<br/>"], [" ", "", ""], strip_tags($entry['DETAIL_TEXT'])));
if(count($entry['PHOTOS_1080']) > 0)
{
$photos = $offer->addChild("Photos");

View File

@ -686,8 +686,6 @@ function OnBeforeIBlockElement($arFields)
{
if($arFields['MODULE_ID'] == "iblock" && $arFields['PARAM2'] == IBLOCK_ID_CATALOG_CARS_USED)
{
file_put_contents($_SERVER['DOCUMENT_ROOT']."/element_index_".$arFields['PARAM2'].".txt", var_export($arFields, true)."\n", FILE_APPEND);
if(array_key_exists("BODY", $arFields))
{
preg_match("/CODE\=(\d+_\d+)/", $arFields['URL'], $matches);
@ -695,14 +693,19 @@ function OnBeforeIBlockElement($arFields)
if(!empty($code))
{
if(strpos($arFields["BODY"], $code) < 0)
preg_match("/\s".$code."/", $arFields["BODY"], $code_matches);
if(count($code_matches) == 0)
{
$arFields["BODY"] .= " ".$code;
file_put_contents($_SERVER['DOCUMENT_ROOT']."/element_index_".$arFields['PARAM2'].".txt", "CODE = ".$code." INDEX\n", FILE_APPEND);
}
else
{
file_put_contents($_SERVER['DOCUMENT_ROOT']."/element_index_".$arFields['PARAM2'].".txt", "CODE = ".$code." EXISTS\n", FILE_APPEND);
file_put_contents($_SERVER['DOCUMENT_ROOT']."/element_index_".$arFields['PARAM2']."_dump.txt", $arFields["BODY"]."\n".str_repeat("-", 150)."\n\n", FILE_APPEND);
}
file_put_contents($_SERVER['DOCUMENT_ROOT']."/element_index_".$arFields['PARAM2'].".txt", "CODE = ".$code."\n", FILE_APPEND);
}
}
file_put_contents($_SERVER['DOCUMENT_ROOT']."/element_index_".$arFields['PARAM2'].".txt", "\n".str_repeat("-", 150)."\n\n", FILE_APPEND);
}
return $arFields;