From daea509f1eac2f6f2e843dd9767dc47eeeb6c5ad Mon Sep 17 00:00:00 2001 From: merelendor Date: Tue, 11 Jun 2024 16:24:07 +0300 Subject: [PATCH 1/2] add ILSA update debug flag to prevent mailing --- local/ilsa_update.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/local/ilsa_update.php b/local/ilsa_update.php index f69a52a..0af7761 100644 --- a/local/ilsa_update.php +++ b/local/ilsa_update.php @@ -2039,7 +2039,10 @@ while($sitemap_all_models_search_ob = $sitemap_all_models_search_res->GetNextEle $model = $sitemap_all_models_search_ob->GetFields(); $model['PROPERTIES'] = $sitemap_all_models_search_ob->GetProperties(); - array_push($sitemap_brands[$model['PROPERTY_BRAND_UID_VALUE']]['MODELS'], $model); + if($model['PROPERTIES']['REGIONS']['VALUE'] == "Да") + { + array_push($sitemap_brands[$model['PROPERTY_BRAND_UID_VALUE']]['MODELS'], $model); + } } $url = "https://".SITE_SERVER_NAME."/regions"; @@ -2087,13 +2090,16 @@ file_put_contents("/home/bitrix/www/sitemap.xml", $sitemap_index); /* sitemap regions file end -------------------------------------------------------------*/ -\Bitrix\Main\Mail\Event::send([ - "EVENT_NAME" => "ILSA_UPDATE", - "LID" => "s1", - "C_FIELDS" => Array( - "MESSAGE" => $traceback_message, - ) -]); +if(!in_array("debug", $argv)) +{ + \Bitrix\Main\Mail\Event::send([ + "EVENT_NAME" => "ILSA_UPDATE", + "LID" => "s1", + "C_FIELDS" => Array( + "MESSAGE" => $traceback_message, + ) + ]); +} die(); From 1000e07cc1a48bbde8c0333e52465b0766050d2c Mon Sep 17 00:00:00 2001 From: merelendor Date: Tue, 16 Jul 2024 17:09:23 +0300 Subject: [PATCH 2/2] hotfix for Yandex.Metrika client ID --- api/index.php | 7 +++++-- .../form.leasing.nomail/templates/.default/script.js | 4 +++- .../form.leasing.used/templates/.default/script.js | 4 +++- .../evolution/form.leasing/templates/.default/script.js | 4 +++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/api/index.php b/api/index.php index ea253c9..bc8d9dc 100644 --- a/api/index.php +++ b/api/index.php @@ -2339,7 +2339,10 @@ switch($PARAM_1) if(checkRecaptchaRequest($_REQUEST['recaptcha_token'], $ipAddress)) { - $_REQUEST['FORM_FIELD_REGION'] = $result->getGeoData()->regionName.", ".$result->getGeoData()->cityName; + if($result !== null) + { + $_REQUEST['FORM_FIELD_REGION'] = $result->getGeoData()->regionName.", ".$result->getGeoData()->cityName; + } $error = ""; $form_errors = Array(); @@ -2502,7 +2505,7 @@ switch($PARAM_1) "page_name" => $REQ['FORM_FIELD_PAGE_NAME'], "sale_type" => $REQ['FORM_FIELD_SALE_TYPE'], "inn" => $REQ['FORM_FIELD_INN'], - "clientID" => $REQ['FORM_FIELD_INN'], + "clientID" => $REQ['FORM_FIELD_YM_CLIENT_ID'], ]; if(!empty($REQ['FORM_FIELD_IS_IZT'])) { diff --git a/local/components/evolution/form.leasing.nomail/templates/.default/script.js b/local/components/evolution/form.leasing.nomail/templates/.default/script.js index 67ae1aa..df256f8 100644 --- a/local/components/evolution/form.leasing.nomail/templates/.default/script.js +++ b/local/components/evolution/form.leasing.nomail/templates/.default/script.js @@ -58,7 +58,9 @@ function form_leasing_request_submit() try { - formData.append("FORM_FIELD_YM_CLIENT_ID", Ya._metrika.getCounters()[0].id); + ym(Ya._metrika.getCounters()[0].id, 'getClientID', function(client_id) { + formData.append("FORM_FIELD_YM_CLIENT_ID", client_id); + }); } catch(e) {} diff --git a/local/components/evolution/form.leasing.used/templates/.default/script.js b/local/components/evolution/form.leasing.used/templates/.default/script.js index 3b45c62..0c8241f 100644 --- a/local/components/evolution/form.leasing.used/templates/.default/script.js +++ b/local/components/evolution/form.leasing.used/templates/.default/script.js @@ -60,7 +60,9 @@ function form_leasing_request_submit() try { - formData.append("FORM_FIELD_YM_CLIENT_ID", Ya._metrika.getCounters()[0].id); + ym(Ya._metrika.getCounters()[0].id, 'getClientID', function(client_id) { + formData.append("FORM_FIELD_YM_CLIENT_ID", client_id); + }); } catch(e) {} diff --git a/local/components/evolution/form.leasing/templates/.default/script.js b/local/components/evolution/form.leasing/templates/.default/script.js index 67ae1aa..df256f8 100644 --- a/local/components/evolution/form.leasing/templates/.default/script.js +++ b/local/components/evolution/form.leasing/templates/.default/script.js @@ -58,7 +58,9 @@ function form_leasing_request_submit() try { - formData.append("FORM_FIELD_YM_CLIENT_ID", Ya._metrika.getCounters()[0].id); + ym(Ya._metrika.getCounters()[0].id, 'getClientID', function(client_id) { + formData.append("FORM_FIELD_YM_CLIENT_ID", client_id); + }); } catch(e) {}