diff --git a/local/ajax/consultation.php b/local/ajax/consultation.php
index 9a1d445..6bee359 100644
--- a/local/ajax/consultation.php
+++ b/local/ajax/consultation.php
@@ -8,6 +8,18 @@ $response = array();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = trim($_POST["name"]);
$phone = trim($_POST["phone"]);
+ $recaptcha_response = trim($_POST["recaptcha_response"]);
+
+ if ($recaptcha_response){
+ $recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify';
+ $recaptcha_secret_key = '6LcSCXArAAAAAEdhWbATecK4jwMK9WvZbUV2szrY';
+
+ $recaptcha = file_get_contents($recaptcha_url . '?secret=' . $recaptcha_secret_key . '&response=' . $recaptcha_response);
+ $recaptcha = json_decode($recaptcha);
+
+ //score от 0.1 до 1.0
+ if ($recaptcha->score <= 0.4) return;
+ }
if (empty($name) || empty($phone)) {
$response = array(
diff --git a/local/ajax/order.php b/local/ajax/order.php
index d2baa2d..a7490f8 100644
--- a/local/ajax/order.php
+++ b/local/ajax/order.php
@@ -18,6 +18,20 @@ try {
$name = trim($_POST["name"]);
$phone = trim($_POST["phone"]);
$email = trim($_POST["email"]);
+
+ $recaptcha_response = trim($_POST["recaptcha_response"]);
+
+ if ($recaptcha_response){
+ $recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify';
+ $recaptcha_secret_key = '6LcSCXArAAAAAEdhWbATecK4jwMK9WvZbUV2szrY';
+
+ $recaptcha = file_get_contents($recaptcha_url . '?secret=' . $recaptcha_secret_key . '&response=' . $recaptcha_response);
+ $recaptcha = json_decode($recaptcha);
+
+ //score от 0.1 до 1.0
+ if ($recaptcha->score <= 0.4) return;
+ }
+
$deliveryMethod = trim($_POST["delivery_method"]);
$pickupAddress = trim($_POST["pickup_address"]);
$address = trim($_POST["address"]);
diff --git a/local/templates/.default/js/custom.js b/local/templates/.default/js/custom.js
index c32da5f..0f4e77a 100644
--- a/local/templates/.default/js/custom.js
+++ b/local/templates/.default/js/custom.js
@@ -131,7 +131,15 @@ function handleConsultationForm(formElement) {
.then(response => response.json())
.then(data => {
if (data.success) {
- window.location.href = '/spasibo_blue/';
+ const isFooterPopup = formElement.querySelector('[name="footer_popup_form"]');
+ const isConsultation = formElement.querySelector('[name="consultation_form"]');
+
+ if (isFooterPopup) {
+ window.location.href = '/spasibo_blue/';
+ } else if (isConsultation) {
+ window.location.href = '/spasibo-footer/';
+ }
+
formElement.reset();
} else {
showCartToast("Ошибка при отправке заявки", 3000, 'error');
diff --git a/local/templates/EraSeptik/footer.php b/local/templates/EraSeptik/footer.php
index f5e9e5c..77e26b7 100644
--- a/local/templates/EraSeptik/footer.php
+++ b/local/templates/EraSeptik/footer.php
@@ -3,43 +3,39 @@
use Bitrix\Main\Page\Asset;
-?>
+?>
-$APPLICATION->IncludeComponent("bitrix:main.include","",Array(
- "AREA_FILE_SHOW" => "sect",
- "AREA_FILE_SUFFIX" => "form_inc",
- "AREA_FILE_RECURSIVE" => "Y",
- "EDIT_TEMPLATE" => ""
+ // GP | Форма "Рассчитать септик за 5 минут!" подключаемая из /{папка_раздела}/sect_form_inc.php ?>
+ $APPLICATION->IncludeComponent(
+ "bitrix:main.include",
+ "",
+ array(
+ "AREA_FILE_SHOW" => "sect",
+ "AREA_FILE_SUFFIX" => "form_inc",
+ "AREA_FILE_RECURSIVE" => "Y",
+ "EDIT_TEMPLATE" => ""
)
-);?>
+); ?>
- Нужна консультация?
-
-Нужна консультация?
+
+