From b7fecc8135fedfe0599111ef57e23efd6263b140 Mon Sep 17 00:00:00 2001 From: merelendor Date: Mon, 11 Sep 2023 14:21:59 +0300 Subject: [PATCH] fixes for adv generation --- bitrix/php_interface/init.php | 5 ++ .../templates/.default/template.php | 2 +- .../templates/.default/template.php | 46 +++++++++++-------- local/include/body.php | 2 +- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/bitrix/php_interface/init.php b/bitrix/php_interface/init.php index 575eff8..3c8cfa8 100644 --- a/bitrix/php_interface/init.php +++ b/bitrix/php_interface/init.php @@ -458,6 +458,7 @@ function OnBeforeIBlockElementUpdateHandler(&$arFields) case IBLOCK_ID_NEWS: { + $payload['code'] = $arFields['CODE']; $payload['url'] = "https://".ADVERTISER_DOMAIN."/news/".$arFields['CODE']; } break; @@ -498,6 +499,9 @@ function OnBeforeIBlockElementUpdateHandler(&$arFields) if($response['status'] === "success") { +// file_put_contents($_SERVER['DOCUMENT_ROOT']."/adv_arfields.txt", var_export($arFields, true)); +// file_put_contents($_SERVER['DOCUMENT_ROOT']."/adv_properties.txt", var_export($properties, true)); + $arFields['PROPERTY_VALUES'][$properties['ADVERTISING_ERIR']] = [ "".array_keys($arFields['PROPERTY_VALUES'][$properties['ADVERTISING_ERIR']])[0]."" => [ 'VALUE' => $response['erir'] ] ]; $arFields['PROPERTY_VALUES'][$properties['ADVERTISING_SAMPLE_URL']] = [ "".array_keys($arFields['PROPERTY_VALUES'][$properties['ADVERTISING_SAMPLE_URL']])[0]."" => [ 'VALUE' => $response['sample'] ] ]; $arFields['PROPERTY_VALUES'][$properties['ADVERTISING_SAMPLE_ID']] = [ "".array_keys($arFields['PROPERTY_VALUES'][$properties['ADVERTISING_SAMPLE_ID']])[0]."" => [ 'VALUE' => $response['sample_id'] ] ]; @@ -505,6 +509,7 @@ function OnBeforeIBlockElementUpdateHandler(&$arFields) else { $arFields['PROPERTY_VALUES'][$properties['ADVERTISING']] = ''; + $arFields['PROPERTY_VALUES'][$properties['ADVERTISING_ERIR']] = ''; $arFields['PROPERTY_VALUES'][$properties['ADVERTISING_SAMPLE_URL']] = ''; $arFields['PROPERTY_VALUES'][$properties['ADVERTISING_SAMPLE_ID']] = ''; $arFields['ACTIVE'] = 'N'; diff --git a/local/components/evolution/about.news.article/templates/.default/template.php b/local/components/evolution/about.news.article/templates/.default/template.php index ec8c9e2..605c2c9 100644 --- a/local/components/evolution/about.news.article/templates/.default/template.php +++ b/local/components/evolution/about.news.article/templates/.default/template.php @@ -34,7 +34,7 @@ $APPLICATION->AddHeadString('