diff --git a/.about.menu_ext.php b/.about.menu_ext.php index 4eb7273..cb0554a 100644 --- a/.about.menu_ext.php +++ b/.about.menu_ext.php @@ -1,5 +1,12 @@ \ No newline at end of file diff --git a/about/career/index.php b/about/career/index.php index d231a92..4e7878e 100644 --- a/about/career/index.php +++ b/about/career/index.php @@ -1,6 +1,16 @@ SetTitle("Эволюция автолизинга: Карьера"); +$APPLICATION->AddHeadString(''); +?> +IncludeComponent("bitrix:breadcrumb", "evolution", Array( + "PATH" => "", // Путь, для которого будет построена навигационная цепочка (по умолчанию, текущий путь) + "SITE_ID" => "s1", // Cайт (устанавливается в случае многосайтовой версии, когда DOCUMENT_ROOT у сайтов разный) + "START_FROM" => "0", // Номер пункта, начиная с которого будет построена навигационная цепочка + ), + false + ); ?> IncludeComponent( diff --git a/about/contacts/index.php b/about/contacts/index.php index 8bd8587..6a3eeba 100644 --- a/about/contacts/index.php +++ b/about/contacts/index.php @@ -2,6 +2,15 @@ require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php"); $APPLICATION->SetTitle("Эволюция автолизинга: Контакты"); ?> +IncludeComponent("bitrix:breadcrumb", "evolution", Array( + "PATH" => "", // Путь, для которого будет построена навигационная цепочка (по умолчанию, текущий путь) + "SITE_ID" => "s1", // Cайт (устанавливается в случае многосайтовой версии, когда DOCUMENT_ROOT у сайтов разный) + "START_FROM" => "0", // Номер пункта, начиная с которого будет построена навигационная цепочка + ), + false + ); +?> IncludeComponent( "evolution:about.contacts.list", diff --git a/about/index.php b/about/index.php index cf86532..8b02ec1 100644 --- a/about/index.php +++ b/about/index.php @@ -1,6 +1,16 @@ SetTitle("О Компании"); +$APPLICATION->AddHeadString(''); +?> +IncludeComponent("bitrix:breadcrumb", "evolution", Array( + "PATH" => "", // Путь, для которого будет построена навигационная цепочка (по умолчанию, текущий путь) + "SITE_ID" => "s1", // Cайт (устанавливается в случае многосайтовой версии, когда DOCUMENT_ROOT у сайтов разный) + "START_FROM" => "0", // Номер пункта, начиная с которого будет построена навигационная цепочка + ), + false + ); ?>
diff --git a/about/news/index.php b/about/news/index.php index 74c5b79..8cd3b5a 100644 --- a/about/news/index.php +++ b/about/news/index.php @@ -1,6 +1,16 @@ SetTitle("Эволюция автолизинга: Новости"); +$APPLICATION->AddHeadString(''); +?> +IncludeComponent("bitrix:breadcrumb", "evolution", Array( + "PATH" => "", // Путь, для которого будет построена навигационная цепочка (по умолчанию, текущий путь) + "SITE_ID" => "s1", // Cайт (устанавливается в случае многосайтовой версии, когда DOCUMENT_ROOT у сайтов разный) + "START_FROM" => "0", // Номер пункта, начиная с которого будет построена навигационная цепочка + ), + false + ); ?> IncludeComponent( diff --git a/about/requisites/index.php b/about/requisites/index.php index 631e4e2..f6eb6ea 100644 --- a/about/requisites/index.php +++ b/about/requisites/index.php @@ -1,7 +1,17 @@ SetTitle("Эволюция автолизинга: Реквизиты"); -?>
+?> +IncludeComponent("bitrix:breadcrumb", "evolution", Array( + "PATH" => "", // Путь, для которого будет построена навигационная цепочка (по умолчанию, текущий путь) + "SITE_ID" => "s1", // Cайт (устанавливается в случае многосайтовой версии, когда DOCUMENT_ROOT у сайтов разный) + "START_FROM" => "0", // Номер пункта, начиная с которого будет построена навигационная цепочка + ), + false + ); +?> +

Реквизиты

diff --git a/about/revocation/index.php b/about/revocation/index.php index 5b4388c..8942539 100644 --- a/about/revocation/index.php +++ b/about/revocation/index.php @@ -2,6 +2,15 @@ require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php"); $APPLICATION->SetTitle("Эволюция автолизинга: Отзыв доверенностей"); ?> +IncludeComponent("bitrix:breadcrumb", "evolution", Array( + "PATH" => "", // Путь, для которого будет построена навигационная цепочка (по умолчанию, текущий путь) + "SITE_ID" => "s1", // Cайт (устанавливается в случае многосайтовой версии, когда DOCUMENT_ROOT у сайтов разный) + "START_FROM" => "0", // Номер пункта, начиная с которого будет построена навигационная цепочка + ), + false + ); +?>

Отзыв доверенностей

diff --git a/about/rules/index.php b/about/rules/index.php index a949927..f91ff2d 100644 --- a/about/rules/index.php +++ b/about/rules/index.php @@ -2,6 +2,15 @@ require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php"); $APPLICATION->SetTitle("Эволюция автолизинга: Общие условия договора лизинга"); ?> +IncludeComponent("bitrix:breadcrumb", "evolution", Array( + "PATH" => "/about/rules/", // Путь, для которого будет построена навигационная цепочка (по умолчанию, текущий путь) + "SITE_ID" => "s1", // Cайт (устанавливается в случае многосайтовой версии, когда DOCUMENT_ROOT у сайтов разный) + "START_FROM" => "0", // Номер пункта, начиная с которого будет построена навигационная цепочка + ), + false + ); +?> IncludeComponent( "evolution:about.rules", diff --git a/api/index.php b/api/index.php index 8024601..38689c8 100644 --- a/api/index.php +++ b/api/index.php @@ -1,5 +1,4 @@ [ "verify_peer" => false, @@ -68,12 +59,7 @@ $arrContextOptions = [ $secret = "YnFN1EcbB4osQyKx53OoMs0seHcIcoUVv2mCQOleHdn9o07bIniM5TreQNvQtgsQo6zWxsxLNFbSBrywjmerU5VnKZVQD1EGVcO"; $secret_crm = "lk_evolution_the_best_leasing_company_of_the_world_sSOvumhogyAtZydpaITb"; -//$token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImNybSJ9.WxzNiB4W5kwqZoy6-kenc1X6Q7XDCVjGraux9rU9zro"; -//print \Bitrix\Main\Web\JWT::encode(["username" => "crm"], $secret, 'HS256', $keyId = null, $head = null); -//die(); - $auth = []; -//$token = ""; use Bitrix\Main\Context, Bitrix\Main\Type\DateTime, @@ -119,11 +105,17 @@ function checkRecaptchaRequest($token, $ipAddress) return $response_decoded['success']; } -function getCompaniesForUser($user_id) +function getCompaniesForUser($user_id, $except_company_id = null) { if(CModule::IncludeModule('iblock')) { - $existed_client_as_user_res = CIBlockElement::GetList([ 'id' => 'desc' ], [ 'IBLOCK_ID' => IBLOCK_ID_CLIENTS, 'PROPERTY_USERS' => $user_id ], false, []); + $filter = [ 'IBLOCK_ID' => IBLOCK_ID_CLIENTS, 'PROPERTY_USERS' => $user_id ]; + if($except_company_id !== null) + { + $filter['!ID'] = $except_company_id; + } + + $existed_client_as_user_res = CIBlockElement::GetList([ 'id' => 'desc' ], $filter, false, []); $companies = []; @@ -172,9 +164,6 @@ function getUsersForCompany($code) $company_record['PROPERTIES'] = $company_element->GetProperties(); $user = []; - //print_r($company_record); - //die(); - foreach($company_record['PROPERTIES']['USERS']['VALUE'] AS $user_id) { $user_res = \CUser::GetList(["ID" => "ASC"], false, [ "ID" => $user_id ], []); @@ -188,21 +177,6 @@ function getUsersForCompany($code) "companies" => $companies, "is_admin" => in_array($user_element['ID'], $company_record['PROPERTIES']['ADMINS']['VALUE']), ]; - ///print_r($user_element); - //$rs_user = \CUser::GetByLogin($user_element['LOGIN']); - //$ar_user = $rs_user->Fetch(); - - //array_push($existed_accounts, $existed_user['XML_ID']); - - /* - foreach($company_record['PROPERTIES']['ADMINS']['VALUE'] AS $k => $v) - { - if($v == $user_id) - { - $company['is_admin'] = true; - } - } - */ array_push($users, $user); } @@ -215,6 +189,80 @@ function getUsersForCompany($code) return []; } +function setCompanyForUser($ID, $REQ, $replace = false) +{ + $user_properties = [ + 'COMPANY' => (string)$REQ['org_title'], + 'INN' => (string)$REQ['inn'], + 'KPP' => (string)$REQ['kpp'], + 'OGRN' => (string)$REQ['ogrn'], + 'ADMINS' => [ $ID ], + 'USERS' => [ $ID ], + ]; + + $ar_new_client = [ + 'IBLOCK_ID' => IBLOCK_ID_CLIENTS, + 'NAME' => $REQ['org_title'], + 'CODE' => $REQ['crm_id'], + 'PROPERTY_VALUES' => $user_properties, + 'ACTIVE' => 'Y', // активен + ]; + + $admins_to_remove = []; + + $new_client = new CIBlockElement; + if($new_client_id = $new_client->Add($ar_new_client)) + { + } + else + { + $existed_client_res = CIBlockElement::GetList([ 'id' => 'desc' ], [ 'IBLOCK_ID' => IBLOCK_ID_CLIENTS, 'CODE' => $REQ['crm_id'] ], false, []); + while ($existed_client_element = $existed_client_res->GetNextElement()) + { + $existed_client_record = $existed_client_element->GetFields(); + $existed_client_record['PROPERTIES'] = $existed_client_element->GetProperties(); + + if($replace) + { + $admins = []; + $users = []; + + $admins_to_remove = $existed_client_record['PROPERTIES']['ADMINS']['VALUE']; + } + else + { + $admins = $existed_client_record['PROPERTIES']['ADMINS']['VALUE']; + $users = $existed_client_record['PROPERTIES']['USERS']['VALUE']; + } + + array_push($admins, $ID); + array_push($users, $ID); + + $admins = array_unique($admins); + $users = array_unique($users); + + $updated_fields = [ + 'PROPERTY_VALUES' => [ + 'ADMINS' => $admins, + 'USERS' => $users, + ] + ]; + + CIBlockElement::SetPropertyValuesEx($existed_client_record['ID'], IBLOCK_ID_CLIENTS, [ 'ADMINS' => $admins, 'USERS' => $users, ]); + + foreach($admins_to_remove AS $admin_to_remove_id) + { + $another_user_companies = getCompaniesForUser($admin_to_remove_id, $existed_client_record['ID']); + + if(count($another_user_companies) === 0) + { + \CUser::Delete($admin_to_remove_id); + } + } + } + } +} + if($_SERVER['REMOTE_USER'] && strpos($_SERVER['REMOTE_USER'], "Bearer") > -1) { $token = str_replace("Bearer ", "", $_SERVER['REMOTE_USER']); @@ -222,11 +270,6 @@ if($_SERVER['REMOTE_USER'] && strpos($_SERVER['REMOTE_USER'], "Bearer") > -1) try { $auth = (array) \Bitrix\Main\Web\JWT::decode($token, $secret, ["HS256"]); - //print json_encode([ - // "status" => "success", - // "token" => $auth['username'], - //]); - //die(); } catch(\Exception $e) { @@ -292,52 +335,54 @@ switch($PARAM_1) { if($auth['username'] !== 'crm') { header('HTTP/1.0 401 Unauthorized'); print json_encode(["status" => "error", "error" => "unauthorized", "message" => "Unauthorized"]); die(); } - $user_registered = false; + $profile = [ + "XML_ID" => $REQ['crm_id'], + "LOGIN" => $REQ['email'], + "NAME" => $REQ['firstname'], + "SECOND_NAME" => $REQ['secondname'], + "LAST_NAME" => $REQ['lastname'], + "EMAIL" => $REQ['email'], + "UF_ORG_TITLE" => (string)$REQ['org_title'], + "UF_INN" => (string)$REQ['inn'], + "UF_KPP" => (string)$REQ['kpp'], + "UF_OGRN" => (string)$REQ['ogrn'], + "UF_PHONE_NUMBER" => (int)$REQ['phone'], + ]; - $existed_users_res = \CUser::GetList(["ID" => "ASC"], false, [ "XML_ID" => $REQ['crm_id'] ], []); + $user_registered_id = null; + $company_registered_id = null; + + $existed_users_res = \CUser::GetList(["ID" => "ASC"], false, [ "LOGIN" => $REQ['email'] ], []); while($existed_user = $existed_users_res->Fetch()) { - $user_registered = true; + $user_registered_id = $existed_user["ID"]; } - if($user_registered) + $existed_client_as_admin_res = CIBlockElement::GetList([ 'ID' => 'ASC' ], [ 'IBLOCK_ID' => IBLOCK_ID_CLIENTS, 'CODE' => $REQ['crm_id'] ], false, []); + while ($existed_client_as_admin_element = $existed_client_as_admin_res->GetNextElement()) { - print json_encode([ - "status" => "error", - "error" => "user_already_registered", - "message" => "User already registered", - ]); + $existed_client_as_admin_record = $existed_client_as_admin_element->GetFields(); + $company_registered_id = $existed_client_as_admin_record['ID']; } - else - { - $user = new \CUser; - $profile = [ - "XML_ID" => $REQ['crm_id'], - "LOGIN" => $REQ['email'], - "NAME" => $REQ['firstname'], - "SECOND_NAME" => $REQ['secondname'], - "LAST_NAME" => $REQ['lastname'], - "PASSWORD" => $REQ['password'], - "CONFIRM_PASSWORD" => $REQ['password'], - "EMAIL" => $REQ['email'], - "UF_ORG_TITLE" => (string)$REQ['org_title'], - "UF_INN" => (string)$REQ['inn'], - "UF_KPP" => (string)$REQ['kpp'], - "UF_OGRN" => (string)$REQ['ogrn'], - "UF_PHONE_NUMBER" => (int)$REQ['phone'], - ]; - $ID = $user->Add($profile); - if (intval($ID) > 0) + if($user_registered_id !== null) + { + //user exists + + if($company_registered_id === null) { + //new company for user + setCompanyForUser($user_registered_id, $REQ); + + $company_message = "Вам предоставлен доступ к Личному кабинету следующей организации:

\n\n"; + $company_message .= $REQ['org_title'].", ИНН: ".$REQ['inn']."
\n"; + \Bitrix\Main\Mail\Event::send([ - "EVENT_NAME" => "USER_INFO", + "EVENT_NAME" => "CLIENT_USER_INVITE", "LID" => "s1", "C_FIELDS" => Array( "EMAIL" => $REQ['email'], - "ORG_NAME" => $REQ['org_title'], - "LOGIN" => $REQ['email'], - "PASS" => $REQ['password'], + "COMPANIES" => $company_message, ) ]); @@ -393,18 +438,76 @@ switch($PARAM_1) print json_encode([ "status" => "success" ]); + + die(); } else { - $error = $user->LAST_ERROR; - //echo "
".print_r($arFields, true)."
"; - //echo $error; - print json_encode([ "status" => "error", - "error" => "wrong_payload", - "message" => $error, + "error" => "company_already_registered", + "message" => "Company already registered", ]); + + die(); + } + } + else + { + if($company_registered_id === null) + { + $user = new \CUser; + + $profile["PASSWORD"] = $REQ['password']; + $profile["CONFIRM_PASSWORD"] = $REQ['password']; + + $ID = $user->Add($profile); + if (intval($ID) > 0) + { + \Bitrix\Main\Mail\Event::send([ + "EVENT_NAME" => "USER_INFO", + "LID" => "s1", + "C_FIELDS" => Array( + "EMAIL" => $REQ['email'], + "ORG_NAME" => $REQ['org_title'], + "LOGIN" => $REQ['email'], + "PASS" => $REQ['password'], + ) + ]); + + //new user & new company + setCompanyForUser($ID, $REQ); + + print json_encode([ + "status" => "success" + ]); + + die(); + } + else + { + $error = $user->LAST_ERROR; + //echo "
".print_r($arFields, true)."
"; + //echo $error; + + print json_encode([ + "status" => "error", + "error" => "wrong_payload", + "message" => $error, + ]); + + die(); + } + } + else + { + print json_encode([ + "status" => "error", + "error" => "company_already_registered", + "message" => "Company already registered", + ]); + + die(); } } @@ -416,42 +519,51 @@ switch($PARAM_1) { if($auth['username'] !== 'crm') { header('HTTP/1.0 401 Unauthorized'); print json_encode(["status" => "error", "error" => "unauthorized", "message" => "Unauthorized"]); die(); } - $user_registered = false; + $profile = [ + "XML_ID" => $REQ['crm_id'], + "LOGIN" => $REQ['email'], + "NAME" => $REQ['firstname'], + "SECOND_NAME" => $REQ['secondname'], + "LAST_NAME" => $REQ['lastname'], + "EMAIL" => $REQ['email'], + "UF_ORG_TITLE" => (string)$REQ['org_title'], + "UF_INN" => (string)$REQ['inn'], + "UF_KPP" => (string)$REQ['kpp'], + "UF_OGRN" => (string)$REQ['ogrn'], + "UF_PHONE_NUMBER" => (int)$REQ['phone'], + ]; - $existed_users_res = \CUser::GetList(["ID" => "ASC"], false, [ "XML_ID" => $REQ['crm_id'] ], []); + $user_registered = null; + $company_registered_id = null; + $company_registered = null; + + $existed_users_res = \CUser::GetList(["ID" => "ASC"], false, [ "LOGIN" => $REQ['email'] ], []); while($existed_user = $existed_users_res->Fetch()) { - $user_registered = true; + $user_registered = $existed_user['ID']; + } - $user = new \CUser; - $profile = [ - "XML_ID" => $REQ['crm_id'], - "LOGIN" => $REQ['email'], - "NAME" => $REQ['firstname'], - "SECOND_NAME" => $REQ['secondname'], - "LAST_NAME" => $REQ['lastname'], - "PASSWORD" => $REQ['password'], - "CONFIRM_PASSWORD" => $REQ['password'], - "EMAIL" => $REQ['email'], - "UF_ORG_TITLE" => (string)$REQ['org_title'], - "UF_INN" => (string)$REQ['inn'], - "UF_KPP" => (string)$REQ['kpp'], - "UF_OGRN" => (string)$REQ['ogrn'], - "UF_PHONE_NUMBER" => (int)$REQ['phone'], - ]; + $existed_client_as_admin_res = CIBlockElement::GetList([ 'ID' => 'ASC' ], [ 'IBLOCK_ID' => IBLOCK_ID_CLIENTS, 'CODE' => $REQ['crm_id'] ], false, []); + while ($existed_client_as_admin_element = $existed_client_as_admin_res->GetNextElement()) + { + $existed_client_as_admin_record = $existed_client_as_admin_element->GetFields(); + $company_registered_id = $existed_client_as_admin_record['ID']; + } - $user->Update($existed_user['ID'], $profile); + if($user_registered !== null) + { + // user exists - if($user->LAST_ERROR) - { - print json_encode([ - "status" => "error", - "error" => "wrong_payload", - "message" => $user->LAST_ERROR, - ]); - } - else + if($company_registered_id !== null) { + //existed company + + $profile["PASSWORD"] = $REQ['password']; + $profile["CONFIRM_PASSWORD"] = $REQ['password']; + + $user = new \CUser; + $user->Update($user_registered, $profile); + \Bitrix\Main\Mail\Event::send([ "EVENT_NAME" => "USER_INFO", "LID" => "s1", @@ -466,19 +578,187 @@ switch($PARAM_1) print json_encode([ "status" => "success" ]); + + die(); + } + else + { + //new company + + print json_encode([ + "status" => "error", + "error" => "no_company_for_update", + "message" => "No company for update", + ]); + + die(); } } - - if(!$user_registered) + else { - print json_encode([ - "status" => "error", - "error" => "unknown_user", - "message" => "Unknown user", - ]); - } + // new user - die(); + if($company_registered_id !== null) + { + //existed company + + $profile["PASSWORD"] = $REQ['password']; + $profile["CONFIRM_PASSWORD"] = $REQ['password']; + + $user = new \CUser; + $ID = $user->Add($profile); + + if (intval($ID) > 0) + { + //new user & new company + setCompanyForUser($ID, $REQ, true); + + \Bitrix\Main\Mail\Event::send([ + "EVENT_NAME" => "USER_INFO", + "LID" => "s1", + "C_FIELDS" => Array( + "EMAIL" => $REQ['email'], + "ORG_NAME" => $REQ['org_title'], + "LOGIN" => $REQ['email'], + "PASS" => $REQ['password'], + ) + ]); + + print json_encode([ + "status" => "success" + ]); + + die(); + } + else + { + print json_encode([ + "status" => "error", + "error" => "wrong_payload", + "message" => $user->LAST_ERROR, + ]); + + die(); + } + } + else + { + //no company + + print json_encode([ + "status" => "error", + "error" => "no_company_for_update", + "message" => "No company for update", + ]); + + die(); + } + } + } + break; + + case "check": + { + if(CModule::IncludeModule('iblock')) + { + if(checkRequestIsLocal()) + { + try + { + $user_registered = false; + $ar_user; + + $existed_accounts = []; + $auth = (array) \Bitrix\Main\Web\JWT::decode($REQ['token'], $secret_crm, ["HS256"]); + + $default_admin_id; + + $existed_client_as_admin_res = CIBlockElement::GetList([ 'ID' => 'ASC' ], [ 'IBLOCK_ID' => IBLOCK_ID_CLIENTS, 'CODE' => $auth['acc_number'] ], false, []); + while ($existed_client_as_admin_element = $existed_client_as_admin_res->GetNextElement()) + { + $existed_client_as_admin_record = $existed_client_as_admin_element->GetFields(); + $existed_client_as_admin_record['PROPERTIES'] = $existed_client_as_admin_element->GetProperties(); + $default_admin_id = $existed_client_as_admin_record['PROPERTIES']['ADMINS']['VALUE'][0]; + $user_registered = true; + } + + $existed_users_res = \CUser::GetList(["ID" => "ASC"], false, [ "ID" => $default_admin_id ], []); + while($existed_user = $existed_users_res->Fetch()) + { + $rs_user = \CUser::GetByLogin($existed_user['LOGIN']); + $ar_user = $rs_user->Fetch(); + + array_push($existed_accounts, $existed_user['XML_ID']); + } + + if(isset($REQ['filter'])) + { + if(!in_array($auth['acc_number'], $existed_accounts)) + { + print json_encode([ + "status" => "error", + "error" => "access_denied", + ]); + die(); + } + } + + if($user_registered) + { + $companies = getCompaniesForUser($ar_user['ID']); + $company_data = [ + "inn" => $companies[0]['inn'], + "kpp" => $companies[0]['kpp'], + "ogrn" => $companies[0]['ogrn'], + "title" => $companies[0]['title'], + ]; + + $user_data = [ + "email" => $ar_user['LOGIN'], + "name" => $ar_user['NAME'], + "secondname" => $ar_user['SECOND_NAME'], + "lastname" => $ar_user['LAST_NAME'], + "phone" => $ar_user['UF_PHONE_NUMBER'], + "phone_verified" => $ar_user['UF_PHONE_VERIFIED'], + "is_admin" => $companies[0]['is_admin'], + ]; + + print json_encode([ + "status" => "success", + "user" => $user_data, + "company" => $company_data, + "companies" => $companies, + "token" => \Bitrix\Main\Web\JWT::encode([ "acc_number" => $auth['acc_number'], "is_admin" => $companies[0]['is_admin'], "login" => $ar_user['LOGIN'], "companies" => $companies ], $secret, 'HS256', null, null), + ]); + } + else + { + print json_encode([ + "status" => "error", + "error" => "unknown account", + ]); + } + die(); + } + catch(\Exception $e) + { + print json_encode([ + "status" => "error", + "error" => "wrong_jwt", + "message" => $e->getMessage(), + ]); + die(); + } + } + else + { + print json_encode([ + "status" => "error", + "error" => "wrong_source", + "error" => "Wrong source", + ]); + } + } } break; @@ -820,8 +1100,7 @@ switch($PARAM_1) if(count($user_companies) === 0) { - $user = new CUser; - $user->Update($removed_user_id, [ "BLOCKED" => "Y" ]); + \CUser::Delete($removed_user_id); } } @@ -899,28 +1178,58 @@ switch($PARAM_1) $drive = []; $body = []; $fuel = []; + $volume = []; - $iterator = CIBlockElement::GetPropertyValues( 1, $filter, true, [ 'ID' => [ 7, 8, 9, 12 ] ] ); + $filter_props_ids = []; + + if(empty($REQ['GEAR'])) { array_push($filter_props_ids, 7); } + if(empty($REQ['DRIVE'])) { array_push($filter_props_ids, 8); } + if(empty($REQ['BODY'])) { array_push($filter_props_ids, 9); } + if(empty($REQ['ENGINE_FUEL'])) { array_push($filter_props_ids, 12); } + if(empty($REQ['ENGINE_VOLUME_FROM']) && empty($REQ['ENGINE_VOLUME_TO'])) { array_push($filter_props_ids, 11); } + + $iterator = CIBlockElement::GetPropertyValues( 1, $filter, true, [ 'ID' => [ 7, 8, 9, 11, 12 ] ] ); while ($row = $iterator->Fetch()) { - //print_r($row); - array_push($gear, $row[7]); - array_push($drive, $row[8]); - array_push($body, $row[9]); - array_push($fuel, $row[12]); + if(empty($REQ['GEAR'])) { array_push($gear, $row[7]); } + if(empty($REQ['DRIVE'])) { array_push($drive, $row[8]); } + if(empty($REQ['BODY'])) { array_push($body, $row[9]); } + if(empty($REQ['ENGINE_FUEL'])) { array_push($fuel, $row[12]); } + if(empty($REQ['ENGINE_VOLUME_FROM']) && empty($REQ['ENGINE_VOLUME_TO'])) { array_push($volume, $row[11]); } } - $gear = array_unique($gear); - $drive = array_unique($drive); - $body = array_unique($body); - $fuel = array_unique($fuel); - print json_encode([ + $gear = array_values(array_unique($gear)); + $drive = array_values(array_unique($drive)); + $body = array_values(array_unique($body)); + $fuel = array_values(array_unique($fuel)); + $volume = array_values(array_unique($volume)); + sort($volume); + + $volumes = []; + $min = floor($volume[0] / 100) * 100; + $max = (floor($volume[count($volume)-1] / 100) + 1) * 100; + + while($min <= $max) + { + if($min > 0) + { + array_push($volumes, $min); + } + + $min = $min + 100; + } + + $result = [ "total" => $total, - "gear" => $gear, - "drive" => $drive, - "body" => $body, - "fuel" => $fuel, - ]); + ]; + + if(empty($REQ['GEAR'])) { $result["gears"] = $gear; } + if(empty($REQ['DRIVE'])) { $result["drives"] = $drive; } + if(empty($REQ['BODY'])) { $result["bodies"] = $body; } + if(empty($REQ['ENGINE_FUEL'])) { $result["engine_fuels"] = $fuel; } + if(empty($REQ['ENGINE_VOLUME_FROM']) && empty($REQ['ENGINE_VOLUME_TO'])) { $result["engine_volumes"] = $volumes; } + + print json_encode($result); } } break; @@ -1002,6 +1311,261 @@ switch($PARAM_1) break; case "parameters": + { + if(CModule::IncludeModule('iblock')) + { + $filter = [ "ACTIVE" => "Y", ]; + + if(!empty($REQ['PROGRAM'])) { $filter['PROPERTY_LEASING_PROGRAMS'] = $REQ['PROGRAM']; } + + if(!empty($REQ['BRAND_ID'])) { $filter["PROPERTY_BRAND"] = $REQ['BRAND_ID']; } + if(!empty($REQ['MODEL_ID'])) { $filter["PROPERTY_MODEL"] = $REQ['MODEL_ID']; } + if(!empty($REQ['MODIFICATION'])) { $filter["PROPERTY_MODIFICATION"] = $REQ['MODIFICATION']; } + + if(!empty($REQ['GEAR'])) { $filter["PROPERTY_GEAR"] = $REQ['GEAR']; } + if(!empty($REQ['DRIVE'])) { $filter["PROPERTY_DRIVE"] = $REQ['DRIVE']; } + if(!empty($REQ['BODY'])) { $filter["PROPERTY_BODY"] = $REQ['BODY']; } + if(!empty($REQ['ENGINE_FUEL'])) { $filter["PROPERTY_ENGINE_FUEL"] = $REQ['ENGINE_FUEL']; } + + if(!empty($REQ['ENGINE_VOLUME_FROM']) || !empty($REQ['ENGINE_VOLUME_TO'])) + { + $filter['> "ASC", "NAME" => "ASC" ], array_merge([ "IBLOCK_ID" => IBLOCK_ID_CATALOG_CARS_NEW ], $filter), [], []); + $result = [ + "total" => $total, + "possible_volumes" => [], + ]; + + $brands = []; + $models = []; + $modifications = []; + + $gears = []; + $drives = []; + $bodies = []; + $engine_fuels = []; + $engine_volumes = []; + + $filter_props_ids = []; + + array_push($filter_props_ids, 3); + if(!empty($REQ['BRAND_ID'])) { array_push($filter_props_ids, 4); } + array_push($filter_props_ids, 7); + array_push($filter_props_ids, 8); + array_push($filter_props_ids, 9); + array_push($filter_props_ids, 12); + //if(empty($REQ['ENGINE_VOLUME_FROM']) || empty($REQ['ENGINE_VOLUME_TO'])) { array_push($filter_props_ids, 11); } + + $result['filter'] = $filter; + + //filter for brands + $filter_brands = $filter; + unset($filter_brands['PROPERTY_BRAND']); + + $brands_ids = []; + $iterator = CIBlockElement::GetPropertyValues( IBLOCK_ID_CATALOG_CARS_NEW, $filter_brands, true, [ 'ID' => [ 3 ] ] ); + while ($row = $iterator->Fetch()) + { + array_push($brands_ids, $row[ 3 ]); + } + + $brands_ids = array_values(array_unique($brands_ids)); + + $brands_res = CIBlockElement::GetList(["NAME" => "ASC"], array_merge([ "IBLOCK_ID" => IBLOCK_ID_BRANDS ], [ "ID" => $brands_ids ]), false, []); + while ($brands_ob_element = $brands_res->GetNextElement()) + { + $brands_ar_res = $brands_ob_element->GetFields(); + $brands_ar_res['PROPERTIES'] = $brands_ob_element->GetProperties(); + + array_push($brands, [ + "id" => $brands_ar_res['ID'], + "value" => $brands_ar_res['CODE'], + "text" => $brands_ar_res['NAME'], + "uid" => $brands_ar_res['PROPERTIES']['UID']['VALUE'], + ]); + } + + //filter for models + if(!empty($REQ['BRAND_ID'])) + { + $filter_models = $filter; + unset($filter_models['PROPERTY_MODEL']); + + $models_ids = []; + $iterator = CIBlockElement::GetPropertyValues( IBLOCK_ID_CATALOG_CARS_NEW, $filter_models, true, [ 'ID' => [ 4 ] ] ); + while ($row = $iterator->Fetch()) + { + array_push($models_ids, $row[ 4 ]); + } + + $models_ids = array_values(array_unique($models_ids)); + + $models_res = CIBlockElement::GetList(["NAME" => "ASC"], array_merge([ "IBLOCK_ID" => IBLOCK_ID_MODELS ], [ "ID" => $models_ids ]), false, []); + while ($models_ob_element = $models_res->GetNextElement()) + { + $models_ar_res = $models_ob_element->GetFields(); + $models_ar_res['PROPERTIES'] = $models_ob_element->GetProperties(); + + array_push($models, [ + "id" => $models_ar_res['ID'], + "value" => $models_ar_res['CODE'], + "text" => $models_ar_res['NAME'], + "uid" => $models_ar_res['PROPERTIES']['UID']['VALUE'], + ]); + } + } + + //filter for modifications + if(!empty($REQ['MODEL_ID'])) + { + $filter_modifications = $filter; + unset($filter_modifications['PROPERTY_MODIFICATION']); + + $modifications_ids = []; + + $iterator = CIBlockElement::GetPropertyValues( IBLOCK_ID_CATALOG_CARS_NEW, $filter_modifications, true, [ 'ID' => [ 5 ] ] ); + while ($row = $iterator->Fetch()) + { + array_push($modifications_ids, $row[ 5 ]); + } + + $modifications_ids = array_values(array_unique($modifications_ids)); + + $modifications_res = CIBlockElement::GetList(["NAME" => "ASC"], array_merge([ "IBLOCK_ID" => IBLOCK_ID_MODIFICATIONS ], [ "ID" => $modifications_ids ]), false, []); + while ($modifications_ob_element = $modifications_res->GetNextElement()) + { + $modifications_ar_res = $modifications_ob_element->GetFields(); + + array_push($modifications, [ + "id" => $modifications_ar_res['ID'], + "text" => $modifications_ar_res['NAME'], + ]); + } + } + + //filter for bodies + $filter_bodies = $filter; + unset($filter_bodies['PROPERTY_BODY']); + + $iterator = CIBlockElement::GetPropertyValues( IBLOCK_ID_CATALOG_CARS_NEW, $filter_bodies, true, [ 'ID' => [ 9 ] ] ); + while ($row = $iterator->Fetch()) + { + array_push($bodies, $row[ 9 ]); + } + + //filter for gears + $filter_gears = $filter; + unset($filter_gears['PROPERTY_GEAR']); + + $iterator = CIBlockElement::GetPropertyValues( IBLOCK_ID_CATALOG_CARS_NEW, $filter_gears, true, [ 'ID' => [ 7 ] ] ); + while ($row = $iterator->Fetch()) + { + array_push($gears, $row[ 7 ]); + } + + //filter for drives + $filter_drives = $filter; + unset($filter_drives['PROPERTY_DRIVE']); + + $iterator = CIBlockElement::GetPropertyValues( IBLOCK_ID_CATALOG_CARS_NEW, $filter_drives, true, [ 'ID' => [ 8 ] ] ); + while ($row = $iterator->Fetch()) + { + array_push($drives, $row[ 8 ]); + } + + //filter for engine fuels + $filter_engine_fuels = $filter; + unset($filter_engine_fuels['PROPERTY_ENGINE_FUEL']); + + $iterator = CIBlockElement::GetPropertyValues( IBLOCK_ID_CATALOG_CARS_NEW, $filter_engine_fuels, true, [ 'ID' => [ 12 ] ] ); + while ($row = $iterator->Fetch()) + { + array_push($engine_fuels, $row[ 12 ]); + } + + //filter for engine fuels + $filter_engine_volumes = $filter; + unset($filter_engine_volumes['> [ 11 ] ] ); + while ($row = $iterator->Fetch()) + { + if($row[ 11 ] != 0) + { + array_push($engine_volumes, $row[ 11 ]); + array_push($result["possible_volumes"], $row[ 11 ]); + } + } + /* + $iterator = CIBlockElement::GetPropertyValues( IBLOCK_ID_CATALOG_CARS_NEW, $filter, true, [ 'ID' => $filter_props_ids ] ); + while ($row = $iterator->Fetch()) + { + if(!empty($REQ['BRAND_ID'])) { array_push($models, $row[4]); } + + array_push($gear, $row[7]); + array_push($drive, $row[8]); + array_push($fuel, $row[12]); + } + */ + + /* + $result['filter2'] = array_merge($filter, [ "> [ 0, 10000 ]]); + + $iterator_volume = CIBlockElement::GetPropertyValues( 1, array_merge($filter, [ "> [ 0, 10000 ]]), true, [ 'ID' => [ 11 ] ] ); + while ($row = $iterator_volume->Fetch()) + { + if($row[11] != 0) + { + array_push($volume, $row[11]); + array_push($result["vvv"], $row[11]); + } + } + */ + + //$models = array_values(array_unique($models)); + + $gears = array_values(array_unique($gears)); + $drives = array_values(array_unique($drives)); + $bodies = array_values(array_unique($bodies)); + $engine_fuels = array_values(array_unique($engine_fuels)); + $engine_volumes = array_values(array_unique($engine_volumes)); + sort($engine_volumes); + + $volumes = []; + $min = floor($engine_volumes[0] / 100) * 100; + $max = (floor($engine_volumes[count($engine_volumes)-1] / 100) + 1) * 100; + + while($min <= $max) + { + if($min > 0) + { + array_push($volumes, $min); + } + + $min = $min + 100; + } + + $result["brands"] = $brands; + $result["models"] = $models; + $result["modifications"] = $modifications; + + $result["gears"] = $gears; + $result["drives"] = $drives; + $result["bodies"] = $bodies; + $result["engine_fuels"] = $engine_fuels; + //if(empty($REQ['ENGINE_VOLUME_FROM']) || empty($REQ['ENGINE_VOLUME_TO'])) { + $result["engine_volumes"] = $volumes; + //} + + print json_encode($result); + } + } + break; + + /* + case "-arameters": { if(CModule::IncludeModule('iblock')) { @@ -1012,7 +1576,7 @@ switch($PARAM_1) $ENGINE_VOLUME = []; $ENGINE_FUEL = []; - $iterator = CIBlockElement::GetPropertyValues(1, ['ACTIVE' => 'Y', ], false, ['ID' => [ 7, 8, 9, 10, 11, 12, ] ]); + $iterator = CIBlockElement::GetPropertyValues(1, ['ACTIVE' => 'Y', ], false, ['ID' => [ 7, 8, 9, 10, 11, 12, ] ]); while ($row = $iterator->Fetch()) { if(!in_array($row[7], $GEAR)) { array_push($GEAR, $row[7]); } @@ -1038,6 +1602,7 @@ switch($PARAM_1) } } break; + */ case "reset": { @@ -1108,7 +1673,7 @@ switch($PARAM_1) if(CModule::IncludeModule('iblock')) { $announcements = []; - $announcements_res = CIBlockElement::GetList(["SORT" => "ASC"], ["ACTIVE" => "Y", "IBLOCK_ID" => 24], false, []); + $announcements_res = CIBlockElement::GetList(["SORT" => "ASC"], ["ACTIVE" => "Y", "IBLOCK_ID" => IBLOCK_ID_ACCOUNT_ANNOUNCEMENTS], false, []); while ($announcements_ob_element = $announcements_res->GetNextElement()) { $announcements_ar_res = $announcements_ob_element->GetFields(); @@ -1453,19 +2018,6 @@ switch($PARAM_1) } else { - /* - \Bitrix\Main\Mail\Event::send([ - "EVENT_NAME" => "USER_INFO", - "LID" => "s1", - "C_FIELDS" => Array( - "EMAIL" => $REQ['email'], - "ORG_NAME" => $ar_user['UF_ORG_TITLE'], - "LOGIN" => $REQ['email'], - "PASS" => $REQ['password'], - ) - ]); - */ - print json_encode([ "status" => "success", ]); @@ -1504,7 +2056,7 @@ switch($PARAM_1) { $user = new \CUser; $login_result = $user->Login($REQ['email'], $REQ['password'], "N"); - + if($login_result == 1) { $existed_user_res = \CUser::GetByLogin($REQ['email']); @@ -1654,6 +2206,14 @@ switch($PARAM_1) $rs_user = \CUser::GetByLogin($REQ['email']); $ar_user = $rs_user->Fetch(); + $companies = getCompaniesForUser($ar_user['ID']); + $company_data = [ + "inn" => $companies[0]['inn'], + "kpp" => $companies[0]['kpp'], + "ogrn" => $companies[0]['ogrn'], + "title" => $companies[0]['title'], + ]; + $user_data = [ "email" => $ar_user['LOGIN'], "name" => $ar_user['NAME'], @@ -1661,14 +2221,7 @@ switch($PARAM_1) "lastname" => $ar_user['LAST_NAME'], "phone" => $ar_user['UF_PHONE_NUMBER'], "phone_verified" => $ar_user['UF_PHONE_VERIFIED'], - ]; - - $companies = getCompaniesForUser($ar_user['ID']); - $company_data = [ - "inn" => $companies[0]['inn'], - "kpp" => $companies[0]['kpp'], - "ogrn" => $companies[0]['ogrn'], - "title" => $companies[0]['title'], + "is_admin" => $companies[0]['is_admin'], ]; print json_encode([ @@ -1721,6 +2274,7 @@ switch($PARAM_1) "lastname" => $ar_user['LAST_NAME'], "phone_number" => $ar_user['UF_PHONE_NUMBER'], "phone_verified" => $ar_user['UF_PHONE_VERIFIED'], + "is_admin" => $companies[0]['is_admin'], ], "company" => [ "inn" => $companies[0]['inn'], @@ -1778,12 +2332,6 @@ switch($PARAM_1) { $auth = (array) \Bitrix\Main\Web\JWT::decode($token, $secret, ["HS256"]); print_r($auth); - - //print json_encode([ - // "status" => "success", - // "token" => $auth['username'], - //]); - //die(); } catch(\Exception $e) { @@ -1802,7 +2350,7 @@ switch($PARAM_1) if(CModule::IncludeModule('iblock')) { $sort = ["ACTIVE_FROM" => "DESC", "SORT" => "DESC"]; - $filter = ["ACTIVE" => "Y", "IBLOCK_ID" => 18]; + $filter = ["ACTIVE" => "Y", "IBLOCK_ID" => IBLOCK_ID_ACCOUNT_RULES]; $options = []; if(!empty($REQ['date'])) @@ -1841,7 +2389,7 @@ switch($PARAM_1) if(CModule::IncludeModule('iblock')) { $sort = ["ACTIVE_FROM" => "DESC", "SORT" => "DESC"]; - $filter = ["ACTIVE" => "Y", "IBLOCK_ID" => 21]; + $filter = ["ACTIVE" => "Y", "IBLOCK_ID" => IBLOCK_ID_ACCOUNT_MATERIALS]; $options = []; $materials = []; @@ -1877,25 +2425,16 @@ switch($PARAM_1) if(CModule::IncludeModule('iblock')) { $sort = ["ACTIVE_FROM" => "DESC", "SORT" => "DESC"]; - $filter = ["ACTIVE" => "Y", "IBLOCK_ID" => 25]; + $filter = ["ACTIVE" => "Y", "IBLOCK_ID" => IBLOCK_ID_ACCOUNT_SUPPORT]; $options = []; - /* - if(!empty($REQ['query'])) - { - $filter[' "ASC" ], [ 'IBLOCK_ID' => 25, 'GLOBAL_ACTIVE' => 'Y', ], false, ); + $themes_res = CIBlockSection::GetList( [ "SORT" => "ASC" ], [ 'IBLOCK_ID' => IBLOCK_ID_ACCOUNT_SUPPORT, 'GLOBAL_ACTIVE' => 'Y', ], false, ); while($theme_result = $themes_res->GetNext()) { $theme = ["id" => md5($theme_result['NAME']), "name" => $theme_result['NAME']]; - $question_filter = [ 'IBLOCK_ID' => 25, 'SECTION_ID' => $theme_result['ID'], 'ACTIVE' => 'Y', ]; + $question_filter = [ 'IBLOCK_ID' => IBLOCK_ID_ACCOUNT_SUPPORT, 'SECTION_ID' => $theme_result['ID'], 'ACTIVE' => 'Y', ]; if(isset($REQ['query']) && !empty($REQ['query'])) { @@ -1940,39 +2479,12 @@ switch($PARAM_1) ]; $questions[] = $question; - //$questions[] = $questions_ar_res; - /*[ - "name" => $questions_ar_res['NAME'], - "filename" => $f->Fetch()['ORIGINAL_NAME'], - "url" => CFile::GetPath($rules_ar_res['PROPERTIES']['FILE']['VALUE']), - ]; - */ } $theme['questions'] = $questions; array_push($themes, $theme); - //print_r($theme_result); - //print "\n\n"; } - /* - $rules_res = CIBlockElement::GetList($sort, $filter, false, $options); - while ($rules_ob_element = $rules_res->GetNextElement()) - { - $rules_ar_res = $rules_ob_element->GetFields(); - $rules_ar_res['PROPERTIES'] = $rules_ob_element->GetProperties(); - - $f = CFile::GetByID($rules_ar_res['PROPERTIES']['FILE']['VALUE']); - - $rules[] = [ - "name" => $rules_ar_res['NAME'], - "active_from" => $rules_ar_res['ACTIVE_FROM'], - "filename" => $f->Fetch()['ORIGINAL_NAME'], - "url" => CFile::GetPath($rules_ar_res['PROPERTIES']['FILE']['VALUE']), - ]; - } - */ - print json_encode([ "themes" => $themes, ]); @@ -2027,6 +2539,26 @@ switch($PARAM_1) } break; + case "vizitka": + { + $c = curl_init(); + curl_setopt($c, CURLOPT_URL, API_HOST."/site/GetUserBusinessCard/?guid=".$_REQUEST['guid']); + curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 30); + curl_setopt($c, CURLOPT_TIMEOUT, 30); + curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($c, CURLOPT_SSL_VERIFYPEER, 0); + curl_setopt($c, CURLOPT_SSL_VERIFYHOST, 0); + curl_setopt($c, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); + + $response = curl_exec($c) or die(curl_error($c)); + + curl_close($c); + print $response; + + die(); + } + break; + default: { print json_encode([]); diff --git a/catalog/index.php b/catalog/index.php index 1ec3d07..1b127a5 100644 --- a/catalog/index.php +++ b/catalog/index.php @@ -1,13 +1,24 @@ SetTitle("Каталог"); +$APPLICATION->SetTitle("Новые автомобили в лизинг"); +//$APPLICATION->AddHeadString(''); +?> +IncludeComponent("bitrix:breadcrumb", "evolution", Array( + "PATH" => "", // Путь, для которого будет построена навигационная цепочка (по умолчанию, текущий путь) + "SITE_ID" => "s1", // Cайт (устанавливается в случае многосайтовой версии, когда DOCUMENT_ROOT у сайтов разный) + "START_FROM" => "0", // Номер пункта, начиная с которого будет построена навигационная цепочка + ), + false + ); ?> IncludeComponent( "evolution:catalog", - "", + isset($_REQUEST['ajax']) ? "ajax" : "", array( "PAGINATION" => "Y", + "COUNT_PER_PAGE" => 12, "BRAND" => $_REQUEST['BRAND'], "MODEL" => $_REQUEST['MODEL'], "MODIFICATION" => $_REQUEST['MODIFICATION'], diff --git a/corp/index.php b/corp/index.php index bada762..e9209a4 100644 --- a/corp/index.php +++ b/corp/index.php @@ -5,9 +5,9 @@ $APPLICATION->SetTitle("Эволюция автолизинга: Вместе с

Вместе с МКБ

-

mkblogo500v2.png
+

mkb500.png

-

2% - субсидия на авансовый платёж для клиентов МКБ

+

Специальные условия по лизингу для клиентов МКБ

Лучшие условия финансирования среди лизинговых компаний за счет собственного фондирования

  • Рассмотрение заявки по 2-м документам (анкета и паспорт).
  • diff --git a/cron/yasprav.log b/cron/yasprav.log deleted file mode 100644 index fde1937..0000000 --- a/cron/yasprav.log +++ /dev/null @@ -1 +0,0 @@ -
    1 => MO1
    2 => SP1
    3 => BN1
    4 => BG1
    5 => VL1
    6 => VR1
    7 => EK1
    8 => IR1
    9 => KZ1
    10 => KG1
    11 => KL1
    12 => KM1
    13 => KR1
    14 => KS2
    15 => KS1
    16 => LP1
    17 => NC1
    18 => NN1
    19 => NV1
    20 => NR1
    21 => NS1
    22 => OM1
    23 => OR1
    24 => PR1
    25 => RD1
    26 => RZ1
    27 => SM1
    28 => SR1
    29 => SC1
    30 => SK1
    31 => ST1
    32 => SG1
    33 => TL1
    34 => TM1
    35 => UF1
    36 => CB1
    37 => CL1
    38 => YR1
    Ok! Сохранено по ссылке! 24.06.2022
    \ No newline at end of file
    diff --git a/images/icons/icon-header-phone.svg b/images/icons/icon-header-phone.svg
    index 444cea6..c95733e 100644
    --- a/images/icons/icon-header-phone.svg
    +++ b/images/icons/icon-header-phone.svg
    @@ -1,6 +1,13 @@
     
    -
    +
    +
    +
     
     
    -
    +
    +
    +
    +
    +
    +
     
    diff --git a/images/icons/icon-header-recall.svg b/images/icons/icon-header-recall.svg
    new file mode 100644
    index 0000000..e34954b
    --- /dev/null
    +++ b/images/icons/icon-header-recall.svg
    @@ -0,0 +1,5 @@
    +
    +
    +
    +
    +
    diff --git a/images/manager.png b/images/manager.png
    new file mode 100644
    index 0000000..5137edd
    Binary files /dev/null and b/images/manager.png differ
    diff --git a/images/no_car_photo_380.png b/images/no_car_photo_380.png
    new file mode 100644
    index 0000000..266444d
    Binary files /dev/null and b/images/no_car_photo_380.png differ
    diff --git a/images/programs_faq.png b/images/programs_faq.png
    new file mode 100644
    index 0000000..d5ef4b2
    Binary files /dev/null and b/images/programs_faq.png differ
    diff --git a/index.php b/index.php
    index 447f6c6..c799440 100644
    --- a/index.php
    +++ b/index.php
    @@ -1,13 +1,14 @@
     SetTitle("Эволюция автолизинга. Лизинг автомобилей");
    +$APPLICATION->SetTitle("Лизинг для юридических лиц и ИП в Москве и других городах России | Лизинговая компания Эволюция");
    +$APPLICATION->SetPageProperty("description", "Лизинговая компания Эволюция предлагает быстрое оформление авто в лизинг для юридических лиц и ИП в Москве и других городах России. Выгодные цены, спецпредложения, простое оформление, консультирование и сопровождение.");
    +$APPLICATION->AddHeadString('');
     ?>
     IncludeComponent(
     	"evolution:slider.main",
     	"",
     	Array()
     ); ?>
    -
     
    IncludeComponent( @@ -22,7 +23,7 @@ $APPLICATION->SetTitle("Эволюция автолизинга. Лизинг а ); ?>
    - +[] IncludeComponent( "evolution:calculator", "", diff --git a/local/catalog_sitemap_generation.php b/local/catalog_sitemap_generation.php new file mode 100644 index 0000000..0b9c543 --- /dev/null +++ b/local/catalog_sitemap_generation.php @@ -0,0 +1,75 @@ + 8, "ACTIVE" => "Y" ], false, false, [ "CODE", "PROPERTY_UID" ] ); +while($all_brands_search_ob = $all_brands_search_res->GetNextElement()) +{ + $brand = $all_brands_search_ob->GetFields(); + $brand['MODELS'] = []; + + $catalog[$brand['PROPERTY_UID_VALUE']] = $brand; +} + +$all_models_search_res = CIBlockElement::GetList( [], [ "IBLOCK_ID" => 9, "ACTIVE" => "Y" ], false, false, [ "CODE", "PROPERTY_BRAND_UID"] ); +while($all_models_search_ob = $all_models_search_res->GetNextElement()) +{ + $model = $all_models_search_ob->GetFields(); + $model['PROPERTIES'] = $all_models_search_ob->GetProperties(); + + array_push($catalog[$model['PROPERTY_BRAND_UID_VALUE']]['MODELS'], $model); + + //print_r($model); + //array_push( $bitrix_existed_models, $model_search['PROPERTIES']['UID']['VALUE'] ); +} + +//print_r($catalog); + +//7f7534ad-5382-469c-8e40-f77267fb5644 + +$url = "https://".SITE_SERVER_NAME."/catalog"; +$lastmod = date(DATE_W3C); + +$strBegin = "\n\n"; + +foreach($catalog AS $brand) +{ + //print ; + //print "\n"; + //"\t". + $strBegin .= "".$url."/".$brand['CODE']."/"."".$lastmod.""."\n"; + + foreach($brand['MODELS'] AS $model) + { + //print "\t"; + //print $url."/".$brand['CODE']."/".$model['CODE']."/"; + //print "\n"; + //"\t"."\t". + $strBegin .= "".$url."/".$brand['CODE']."/".$model['CODE']."/"."".$lastmod.""."\n"; + } + + /* + + + https://evo.quickcode.ru/2022-03-29T15:01:44+03:00 + */ +} +$strBegin .= ""."\n"; + +file_put_contents("../sitemap-catalog.xml", $strBegin); +//print $strBegin; + +die(); + +?> \ No newline at end of file diff --git a/local/components/evolution/footer/component.php b/local/components/evolution/__footer/component.php similarity index 100% rename from local/components/evolution/footer/component.php rename to local/components/evolution/__footer/component.php diff --git a/local/components/evolution/footer/templates/.default/style.css b/local/components/evolution/__footer/templates/.default/style.css similarity index 100% rename from local/components/evolution/footer/templates/.default/style.css rename to local/components/evolution/__footer/templates/.default/style.css diff --git a/local/components/evolution/footer/templates/.default/template.php b/local/components/evolution/__footer/templates/.default/template.php similarity index 100% rename from local/components/evolution/footer/templates/.default/template.php rename to local/components/evolution/__footer/templates/.default/template.php diff --git a/local/components/evolution/top/component.php b/local/components/evolution/__top/component.php similarity index 100% rename from local/components/evolution/top/component.php rename to local/components/evolution/__top/component.php diff --git a/local/components/evolution/top/templates/.default/style.css b/local/components/evolution/__top/templates/.default/style.css similarity index 100% rename from local/components/evolution/top/templates/.default/style.css rename to local/components/evolution/__top/templates/.default/style.css diff --git a/local/components/evolution/top/templates/.default/template.php b/local/components/evolution/__top/templates/.default/template.php similarity index 100% rename from local/components/evolution/top/templates/.default/template.php rename to local/components/evolution/__top/templates/.default/template.php diff --git a/local/components/evolution/about.career.vacancy/component.php b/local/components/evolution/about.career.vacancy/component.php index 3f85473..18da80f 100644 --- a/local/components/evolution/about.career.vacancy/component.php +++ b/local/components/evolution/about.career.vacancy/component.php @@ -52,6 +52,8 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true)))) $APPLICATION->SetPageProperty("title", $meta['ELEMENT_META_TITLE']); $APPLICATION->SetPageProperty("keywords", $meta['ELEMENT_META_KEYWORDS']); $APPLICATION->SetPageProperty("description", $meta['ELEMENT_META_DESCRIPTION']); + + $APPLICATION->AddHeadString(''); } $this->IncludeComponentTemplate(); diff --git a/local/components/evolution/about.contacts.list/templates/.default/script.js b/local/components/evolution/about.contacts.list/templates/.default/script.js index cc28db8..9a5b1d8 100644 --- a/local/components/evolution/about.contacts.list/templates/.default/script.js +++ b/local/components/evolution/about.contacts.list/templates/.default/script.js @@ -1,5 +1,44 @@ $(function() { + var hash = document.location.hash.replace("#", ""); + + if(hash !== "") + { + var agency = null; + var region = null; + + $(".agency_item").each(function() + { + if($(this).data('agency') == hash) + { + agency = $(this).data('agency'); + region = $(this).data('region'); + + console.log("agency", $(this).data('agency'), "region", $(this).data('region')); + + /* + faq_section_index = $(this).data('section'); + faq_item_index = $(this).data('index'); + + $(".faq_section_button").removeClass("active"); + $(".faq_section_button_"+faq_section_index).addClass("active"); + $(".faq_items_list").css("display", "none"); + $(".faq_items_list_"+faq_section_index).css("display", "block"); + + $(".faq_item").removeClass("open"); + $(".faq_item_"+faq_item_index).addClass("open"); + */ + + + $(".tab").last().click(); + $(".regions_select").val(region); + onRegionChange(region); + + return false; + } + }); + } + $(".regions_select").on("change", function() { if($(this).val() === "") @@ -30,35 +69,7 @@ $(function() }, 200); } - $(".region_selected").remove(); - $(".region_block").css("display", "none"); - - var text_blocks = $(".column_desktop").find(".region_"+parseInt($(this).val(), 10)); - - text_blocks.map(function(index, item) - { - var n = $(item).clone(); - $(n).addClass("open").addClass("region_selected").css("display", "block"); - - if(index % 2 == 0) - { - $(".column_left").append(n); - } - else - { - $(".column_right").append(n); - } - }); - - var text_blocks = $(".column_mobile").find(".region_"+parseInt($(this).val(), 10)); - - text_blocks.map(function(index, item) - { - var n = $(item).clone(); - $(n).addClass("open").addClass("region_selected").css("display", "block"); - - $(".column_all").append(n); - }); + onRegionChange($(this).val()); } }); @@ -73,4 +84,39 @@ $(function() scrollTop: $("#contacts_top").offset().top - 100 }, 100); }); -}); \ No newline at end of file +}); + +function onRegionChange(region) +{ + console.log("region", region); + + $(".region_selected").remove(); + $(".region_block").css("display", "none"); + + var text_blocks = $(".column_desktop").find(".region_"+parseInt(region, 10)); + + text_blocks.map(function(index, item) + { + var n = $(item).clone(); + $(n).addClass("open").addClass("region_selected").css("display", "block"); + + if(index % 2 == 0) + { + $(".column_left").append(n); + } + else + { + $(".column_right").append(n); + } + }); + + var text_blocks = $(".column_mobile").find(".region_"+parseInt(region, 10)); + + text_blocks.map(function(index, item) + { + var n = $(item).clone(); + $(n).addClass("open").addClass("region_selected").css("display", "block"); + + $(".column_all").append(n); + }); +} \ No newline at end of file diff --git a/local/components/evolution/about.contacts.list/templates/.default/template.php b/local/components/evolution/about.contacts.list/templates/.default/template.php index 4274671..257da59 100644 --- a/local/components/evolution/about.contacts.list/templates/.default/template.php +++ b/local/components/evolution/about.contacts.list/templates/.default/template.php @@ -12,6 +12,71 @@ /** @var CBitrixComponent $component */ $this->setFrameMode(true); ?> + "https://schema.org", + "@type" => "FinancialService", + "image" => [ + "https://avatars.mds.yandex.net/get-altay/2389272/2a000001749629d635959647ec27834f22be/XXXL", + ], + "name" => "Эволюция Автолизинга", + "address" => [ + "@type" => "PostalAddress", + "streetAddress" => "Котляковская ул., 8", + "addressLocality" => "Москва", + "addressRegion" => "Москва", + "postalCode" => "115201", + "addressCountry" => "Россия", + ], + //"review" => [ + // "@type" => "Review", + // "reviewRating" => [ + // "@type" => "Rating", + // "ratingValue" => "4", + // "bestRating" => "5" + // ], + // "author" => [ + // "@type" => "Person", + // "name" => "Lillian Ruiz", + // ] + //], + "geo" => [ + "@type" => "GeoCoordinates", + "latitude" => 55.643978, + "longitude" => 37.640452, + ], + "url" => "https://".SITE_SERVER_NAME."/about/contacts/", + "telephone" => "+74951466767", + "openingHoursSpecification" => [ + [ + "@type" => "OpeningHoursSpecification", + "dayOfWeek" => [ + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + ], + "opens" => "09:00", + "closes" => "18:00", + ], + [ + "@type" => "OpeningHoursSpecification", + "dayOfWeek" => "Saturday", + "opens" => "00:00", + "closes" => "00:00", + ], + [ + "@type" => "OpeningHoursSpecification", + "dayOfWeek" => "Sunday", + "opens" => "00:00", + "closes" => "00:00", + ], + ], +]; + +$APPLICATION->AddHeadString('', false, "AFTER_JS"); +?> setFrameMode(true);
    -
-
+
-

Оформите автомбиль Audi A3 в лизинг на выгодных условиях

+

Оформите автомобиль в лизинг на выгодных условиях

- Цена - 2 300 250₽ + Стоимость авто (от) + ">

- - - + +
@@ -70,13 +67,13 @@ $this->setFrameMode(true); @@ -85,7 +82,7 @@ $this->setFrameMode(true);
-
Комплектация
+

Комплектация

Основная информация

    @@ -120,7 +117,7 @@ $this->setFrameMode(true);
-
Характеристики
+

Характеристики

Технические характеристики

    @@ -145,7 +142,7 @@ $this->setFrameMode(true);
-
Обслуживание
+

Обслуживание

IncludeComponent( "evolution:catalog.position.info", "", @@ -166,7 +163,6 @@ $this->setFrameMode(true);

Банкротство лизингодателя
Банкротство лизинговой компании не является поводом для изъятия у лизингополучателя объекта лизинга, при условии, что последний не нарушил условия договора лизинга.

-

Внутренний лизинг
Лизинг, при котором всё стороны договора лизинга являются резиденты Республики Беларусь.

@@ -222,131 +218,150 @@ $this->setFrameMode(true);
-
-

Калькулятор расчета лизинга

-
-
-

Стоимость авто

-

- - ₽ - - -

- -
- -
-

млн

-

млн

+
+

Калькулятор расчета лизинга

+
+
+

Стоимость авто

+

+ + ₽ + + +

+ -
-

Первоначальный взнос

-

%

-
- -
-

%

-

%

-
-
-

Срок договора

-

мес.

-
- -
-

мес.

-

мес.

-
-
-

Выкупной платеж

-

%

-
- -
-

%

-

%

+
+
+

млн

+

млн

-
-
-

Ежемесячный платеж

-

+
+

Первоначальный взнос

+

%

+
+
-
-

Экономия по налогу на прибыль (до)

-

-
-
-

НДС к возмещению из бюджета (до)

-

+

%

+

%

+
+
+

Срок договора

+

мес.

+
+
- +
+

Выкупной платеж

+

%

+
+
+

%

+

%

+
+
+
+
+

Ежемесячный платеж

+

+
+
+

Экономия по налогу на прибыль (до)

+

+
+
+

НДС к возмещению из бюджета (до)

+

+
+
- - -
-
-

Другие модели Audi A3 Sedan

- Показать все +
+ IncludeComponent( + "evolution:catalog.other.positions", + "", + Array( + "EXCEPT" => $arResult['ID'], + "BRAND_ID" => $arResult['PROPERTIES']['BRAND']['RELATED']['ID'], + "BRAND_CODE" => $arResult['PROPERTIES']['BRAND']['RELATED']['CODE'], + "BRAND_NAME" => $arResult['PROPERTIES']['BRAND']['RELATED']['NAME'], + "MODEL_ID" => $arResult['PROPERTIES']['MODEL']['RELATED']['ID'], + "MODEL_CODE" => $arResult['PROPERTIES']['MODEL']['RELATED']['CODE'], + "MODEL_NAME" => $arResult['PROPERTIES']['MODEL']['RELATED']['NAME'], + ) + ); ?> + +
+

Другие модели Audi A3 Sedan

+ Показать все +
+ + +
-
- - Haval - - + */?> + IncludeComponent( + "evolution:catalog.recommended.models", + "", + Array( + "EXCEPT" => $arResult['PROPERTIES']['MODEL']['RELATED']['ID'], + "BRAND_UID" => $arResult['PROPERTIES']['BRAND']['RELATED']['PROPERTIES']['UID']['VALUE'], + "BRAND_CODE" => $arResult['PROPERTIES']['BRAND']['RELATED']['CODE'], + "BRAND_NAME" => $arResult['PROPERTIES']['BRAND']['RELATED']['NAME'], + ) + ); ?> + +
+

Рекомендуемые модели Audi для вас

+ Показать все +
+ + +
- - - - -
- -
-
-

Рекомендуемые модели Audi для вас

- Показать все -
- - - - - - -
-
+ */?> +
\ No newline at end of file diff --git a/local/components/evolution/catalog.promo.brand/.description.php b/local/components/evolution/catalog.promo.brand/.description.php new file mode 100644 index 0000000..a20bdf3 --- /dev/null +++ b/local/components/evolution/catalog.promo.brand/.description.php @@ -0,0 +1,8 @@ + GetMessage("DEFAULT_NAME"), + "DESCRIPTION" => GetMessage("DEFAULT_DESC"), +); +?> \ No newline at end of file diff --git a/local/components/evolution/catalog.promo.brand/component.php b/local/components/evolution/catalog.promo.brand/component.php new file mode 100644 index 0000000..c882488 --- /dev/null +++ b/local/components/evolution/catalog.promo.brand/component.php @@ -0,0 +1,58 @@ +StartResultCache(60*60*24, md5(var_export($_POST, true)))) +{ + if(CModule::IncludeModule('iblock')) + { + $arResult = [ + 'BRANDS' => [], + ]; + + $brands_res = CIBlockElement::GetList([ "SORT" => "ASC" ], [ "ACTIVE" => "Y", "IBLOCK_ID" => IBLOCK_ID_BRANDS, "PROPERTY_PROMO_VALUE" => "Да" ], false, []); + while ($brands_element = $brands_res->GetNextElement()) + { + $brands_ar_res = $brands_element->GetFields(); + $brands_ar_res['ITEMS'] = []; + + $position_res = CIBlockElement::GetList([ "NAME" => "ASC" ], [ "ACTIVE" => "Y", "IBLOCK_ID" => 1, "PROPERTY_BRAND" => $brands_ar_res['ID'], ], false, [ "nPageSize" => 3 ]); + + while ($position_element = $position_res->GetNextElement()) + { + $ar_res = $position_element->GetFields(); + $ar_res['PROPERTIES'] = $position_element->GetProperties(); + $ar_res['PROPERTIES']['BRAND']['RELATED'] = get_related(8, $ar_res['PROPERTIES']['BRAND']['VALUE']); + $ar_res['PROPERTIES']['MODEL']['RELATED'] = get_related(9, $ar_res['PROPERTIES']['MODEL']['VALUE']); + $ar_res['PROPERTIES']['MODIFICATION']['RELATED'] = get_related(10, $ar_res['PROPERTIES']['MODIFICATION']['VALUE']); + + $ar_res['CALCULATION'] = []; + $ar_res['CALCULATION']['MONTHLY'] = number_format((($ar_res['PROPERTIES']['PRICE']['VALUE'] / 100) * 10), 0, ".", " "); + $ar_res['CALCULATION']['SAVINGS_TAX'] = number_format((($ar_res['PROPERTIES']['PRICE']['VALUE'] / 100) * 4), 0, ".", " "); + $ar_res['CALCULATION']['SAVINGS_VAT'] = number_format((($ar_res['PROPERTIES']['PRICE']['VALUE'] / 100) * 4), 0, ".", " "); + + $brands_ar_res['ITEMS'][] = $ar_res; + } + + $arResult['BRANDS'][] = $brands_ar_res; + } + + $this->IncludeComponentTemplate(); + } +} \ No newline at end of file diff --git a/local/components/evolution/catalog.promo.brand/ru/.description.php b/local/components/evolution/catalog.promo.brand/ru/.description.php new file mode 100644 index 0000000..3c24bdd --- /dev/null +++ b/local/components/evolution/catalog.promo.brand/ru/.description.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/local/components/evolution/catalog.promo.brand/templates/.default/script.js b/local/components/evolution/catalog.promo.brand/templates/.default/script.js new file mode 100644 index 0000000..e69de29 diff --git a/local/components/evolution/catalog.promo.brand/templates/.default/style.css b/local/components/evolution/catalog.promo.brand/templates/.default/style.css new file mode 100644 index 0000000..e69de29 diff --git a/local/components/evolution/catalog.promo.brand/templates/.default/template.php b/local/components/evolution/catalog.promo.brand/templates/.default/template.php new file mode 100644 index 0000000..6175100 --- /dev/null +++ b/local/components/evolution/catalog.promo.brand/templates/.default/template.php @@ -0,0 +1,57 @@ +setFrameMode(true); +?> + 0): ?> + +

+
+ +
+ + <?= $arItem['PROPERTIES']['BRAND']['RELATED']['NAME']; ?> <?= $arItem['PROPERTIES']['MODEL']['RELATED']['NAME']; ?> <?= $arItem['PROPERTIES']['BODY']['VALUE']; ?> +

+

+ + , , л.с. +

+
    +
  • +

    Ежемесячный платёж (от)

    +

    р.

    +
  • +
  • +

    Стоимость автомобиля (от)

    +

    р.

    +
  • +
  • +

    Экономия по налогу на прибыль (до)

    +

    р.

    +
  • +
  • +

    НДС к возмещению из бюджета (до)

    +

    р.

    +
  • +
+ +

+
+ +
+ + Показать еще + + + \ No newline at end of file diff --git a/local/components/evolution/catalog.promo.model/.description.php b/local/components/evolution/catalog.promo.model/.description.php new file mode 100644 index 0000000..a20bdf3 --- /dev/null +++ b/local/components/evolution/catalog.promo.model/.description.php @@ -0,0 +1,8 @@ + GetMessage("DEFAULT_NAME"), + "DESCRIPTION" => GetMessage("DEFAULT_DESC"), +); +?> \ No newline at end of file diff --git a/local/components/evolution/catalog.promo.model/component.php b/local/components/evolution/catalog.promo.model/component.php new file mode 100644 index 0000000..6074ea6 --- /dev/null +++ b/local/components/evolution/catalog.promo.model/component.php @@ -0,0 +1,58 @@ +StartResultCache(60*60*24, md5(var_export($_POST, true)))) +{ + if(CModule::IncludeModule('iblock')) + { + $arResult = [ + 'MODELS' => [], + ]; + + $models_res = CIBlockElement::GetList([ "SORT" => "ASC" ], [ "ACTIVE" => "Y", "IBLOCK_ID" => IBLOCK_ID_MODELS, "PROPERTY_BRAND_UID" => $arParams['BRAND_UID'], "PROPERTY_PROMO_VALUE" => "Да" ], false, []); + while ($models_element = $models_res->GetNextElement()) + { + $models_ar_res = $models_element->GetFields(); + $models_ar_res['ITEMS'] = []; + + $position_res = CIBlockElement::GetList([ "NAME" => "ASC" ], [ "ACTIVE" => "Y", "IBLOCK_ID" => 1, "PROPERTY_MODEL" => $models_ar_res['ID'], ], false, [ "nPageSize" => 3 ]); + + while ($position_element = $position_res->GetNextElement()) + { + $ar_res = $position_element->GetFields(); + $ar_res['PROPERTIES'] = $position_element->GetProperties(); + $ar_res['PROPERTIES']['BRAND']['RELATED'] = get_related(8, $ar_res['PROPERTIES']['BRAND']['VALUE']); + $ar_res['PROPERTIES']['MODEL']['RELATED'] = get_related(9, $ar_res['PROPERTIES']['MODEL']['VALUE']); + $ar_res['PROPERTIES']['MODIFICATION']['RELATED'] = get_related(10, $ar_res['PROPERTIES']['MODIFICATION']['VALUE']); + + $ar_res['CALCULATION'] = []; + $ar_res['CALCULATION']['MONTHLY'] = number_format((($ar_res['PROPERTIES']['PRICE']['VALUE'] / 100) * 10), 0, ".", " "); + $ar_res['CALCULATION']['SAVINGS_TAX'] = number_format((($ar_res['PROPERTIES']['PRICE']['VALUE'] / 100) * 4), 0, ".", " "); + $ar_res['CALCULATION']['SAVINGS_VAT'] = number_format((($ar_res['PROPERTIES']['PRICE']['VALUE'] / 100) * 4), 0, ".", " "); + + $models_ar_res['ITEMS'][] = $ar_res; + } + + $arResult['MODELS'][] = $models_ar_res; + } + + $this->IncludeComponentTemplate(); + } +} \ No newline at end of file diff --git a/local/components/evolution/catalog.promo.model/ru/.description.php b/local/components/evolution/catalog.promo.model/ru/.description.php new file mode 100644 index 0000000..f07de75 --- /dev/null +++ b/local/components/evolution/catalog.promo.model/ru/.description.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/local/components/evolution/catalog.promo.model/templates/.default/script.js b/local/components/evolution/catalog.promo.model/templates/.default/script.js new file mode 100644 index 0000000..e69de29 diff --git a/local/components/evolution/catalog.promo.model/templates/.default/style.css b/local/components/evolution/catalog.promo.model/templates/.default/style.css new file mode 100644 index 0000000..e69de29 diff --git a/local/components/evolution/catalog.promo.model/templates/.default/template.php b/local/components/evolution/catalog.promo.model/templates/.default/template.php new file mode 100644 index 0000000..9e80cee --- /dev/null +++ b/local/components/evolution/catalog.promo.model/templates/.default/template.php @@ -0,0 +1,57 @@ +setFrameMode(true); +?> + 0): ?> + +

+
+ +
+ + <?= $arItem['PROPERTIES']['BRAND']['RELATED']['NAME']; ?> <?= $arItem['PROPERTIES']['MODEL']['RELATED']['NAME']; ?> <?= $arItem['PROPERTIES']['BODY']['VALUE']; ?> +

+

+ + , , л.с. +

+
    +
  • +

    Ежемесячный платёж (от)

    +

    р.

    +
  • +
  • +

    Стоимость автомобиля (от)

    +

    р.

    +
  • +
  • +

    Экономия по налогу на прибыль (до)

    +

    р.

    +
  • +
  • +

    НДС к возмещению из бюджета (до)

    +

    р.

    +
  • +
+ +

+
+ +
+ + Показать еще + + + \ No newline at end of file diff --git a/local/components/evolution/catalog.recommended.models/.description.php b/local/components/evolution/catalog.recommended.models/.description.php new file mode 100644 index 0000000..a20bdf3 --- /dev/null +++ b/local/components/evolution/catalog.recommended.models/.description.php @@ -0,0 +1,8 @@ + GetMessage("DEFAULT_NAME"), + "DESCRIPTION" => GetMessage("DEFAULT_DESC"), +); +?> \ No newline at end of file diff --git a/local/components/evolution/catalog.recommended.models/component.php b/local/components/evolution/catalog.recommended.models/component.php new file mode 100644 index 0000000..e74efb2 --- /dev/null +++ b/local/components/evolution/catalog.recommended.models/component.php @@ -0,0 +1,58 @@ + [], + ]; + $options = Array( "nPageSize" => 6 ); + + $models_res = CIBlockElement::GetList([ "RAND" => "ASC" ], [ "ACTIVE" => "Y", "IBLOCK_ID" => IBLOCK_ID_MODELS, "PROPERTY_BRAND_UID" => $arParams['BRAND_UID'], "!ID" => $arParams['EXCEPT'] ], false, $options); + while ($models_ob_element = $models_res->GetNextElement()) + { + $models_ar_res = $models_ob_element->GetFields(); + $models_ar_res['PROPERTIES'] = $models_ob_element->GetProperties(); + + if(!empty($models_ar_res['PREVIEW_PICTURE'])) + { + $models_ar_res['IMAGE_PREPARED'] = true; + $models_ar_res['PREVIEW_PICTURE'] = CFile::GetPath($models_ar_res['PREVIEW_PICTURE']); + } + else + { + $cars_res = CIBlockElement::GetList([ "NAME" => "ASC" ], [ "ACTIVE" => "Y", "IBLOCK_ID" => IBLOCK_ID_CATALOG_CARS_NEW, "PROPERTY_MODEL" => $models_ar_res['ID'] ], false, [ "nPageSize" => 1 ]); + while ($cars_ob_element = $cars_res->GetNextElement()) + { + $cars_ar_res = $cars_ob_element->GetFields(); + $cars_ar_res['PROPERTIES'] = $cars_ob_element->GetProperties(); + + $models_ar_res['IMAGE_PREPARED'] = false; + $models_ar_res['PREVIEW_PICTURE'] = $cars_ar_res['PROPERTIES']['IMAGE_URL']['VALUE']; + } + } + + $models_ar_res['URL'] = "/catalog/".$arParams['BRAND_CODE']."/".$models_ar_res['CODE']."/"; + + $arResult['MODELS'][] = $models_ar_res; + } + + $this->IncludeComponentTemplate(); +} \ No newline at end of file diff --git a/local/components/evolution/catalog.recommended.models/ru/.description.php b/local/components/evolution/catalog.recommended.models/ru/.description.php new file mode 100644 index 0000000..5248df0 --- /dev/null +++ b/local/components/evolution/catalog.recommended.models/ru/.description.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/local/components/evolution/catalog.recommended.models/templates/.default/script.js b/local/components/evolution/catalog.recommended.models/templates/.default/script.js new file mode 100644 index 0000000..e69de29 diff --git a/local/components/evolution/catalog.recommended.models/templates/.default/style.css b/local/components/evolution/catalog.recommended.models/templates/.default/style.css new file mode 100644 index 0000000..e69de29 diff --git a/local/components/evolution/catalog.recommended.models/templates/.default/template.php b/local/components/evolution/catalog.recommended.models/templates/.default/template.php new file mode 100644 index 0000000..1317dbe --- /dev/null +++ b/local/components/evolution/catalog.recommended.models/templates/.default/template.php @@ -0,0 +1,33 @@ +setFrameMode(true); +?> + 0): ?> +
+
+

Рекомендуемые модели для Вас

+ /" class="button button-transparent">Показать все*/?> +
+ + + + + Показать все + +
+ \ No newline at end of file diff --git a/local/components/evolution/catalog.special.offers/.description.php b/local/components/evolution/catalog.special.offers/.description.php new file mode 100644 index 0000000..a20bdf3 --- /dev/null +++ b/local/components/evolution/catalog.special.offers/.description.php @@ -0,0 +1,8 @@ + GetMessage("DEFAULT_NAME"), + "DESCRIPTION" => GetMessage("DEFAULT_DESC"), +); +?> \ No newline at end of file diff --git a/local/components/evolution/catalog.special.offers/component.php b/local/components/evolution/catalog.special.offers/component.php new file mode 100644 index 0000000..c0ac8e1 --- /dev/null +++ b/local/components/evolution/catalog.special.offers/component.php @@ -0,0 +1,63 @@ +StartResultCache(60*60*24, md5(var_export($_POST, true)))) +{ + if(CModule::IncludeModule('iblock')) + { + $arResult = [ + 'ITEMS' => [] + ]; + + $query = null; + $query_arr = []; + + $sort = [ "RAND" => "ASC" ]; + $filter = Array("ACTIVE" => "Y", "IBLOCK_ID" => 1); + $options = Array("nPageSize" => $arParams['COUNT']); + + $filter['PROPERTY_SPECIAL_OFFER_VALUE'] = "Да"; + + if(!empty($arParams['BRAND_ID'])) + { + $filter['PROPERTY_BRAND'] = $arParams['BRAND_ID']; + } + + $res = CIBlockElement::GetList($sort, $filter, false, $options); + + while ($obElement = $res->GetNextElement()) + { + $ar_res = $obElement->GetFields(); + $ar_res['PROPERTIES'] = $obElement->GetProperties(); + $ar_res['PROPERTIES']['BRAND']['RELATED'] = get_related(8, $ar_res['PROPERTIES']['BRAND']['VALUE']); + $ar_res['PROPERTIES']['MODEL']['RELATED'] = get_related(9, $ar_res['PROPERTIES']['MODEL']['VALUE']); + $ar_res['PROPERTIES']['MODIFICATION']['RELATED'] = get_related(10, $ar_res['PROPERTIES']['MODIFICATION']['VALUE']); + + $ar_res['CALCULATION'] = []; + $ar_res['CALCULATION']['MONTHLY'] = number_format((($ar_res['PROPERTIES']['PRICE']['VALUE'] / 100) * 10), 0, ".", " "); + $ar_res['CALCULATION']['SAVINGS_TAX'] = number_format((($ar_res['PROPERTIES']['PRICE']['VALUE'] / 100) * 4), 0, ".", " "); + $ar_res['CALCULATION']['SAVINGS_VAT'] = number_format((($ar_res['PROPERTIES']['PRICE']['VALUE'] / 100) * 4), 0, ".", " "); + + $arResult['ITEMS'][] = $ar_res; + } + + $this->IncludeComponentTemplate(); + } +} \ No newline at end of file diff --git a/local/components/evolution/catalog.special.offers/ru/.description.php b/local/components/evolution/catalog.special.offers/ru/.description.php new file mode 100644 index 0000000..bea98aa --- /dev/null +++ b/local/components/evolution/catalog.special.offers/ru/.description.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/local/components/evolution/catalog.special.offers/ru/.parameters.php b/local/components/evolution/catalog.special.offers/ru/.parameters.php new file mode 100644 index 0000000..e99d130 --- /dev/null +++ b/local/components/evolution/catalog.special.offers/ru/.parameters.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/local/components/evolution/catalog.special.offers/templates/.default/script.js b/local/components/evolution/catalog.special.offers/templates/.default/script.js new file mode 100644 index 0000000..e69de29 diff --git a/local/components/evolution/catalog.special.offers/templates/.default/style.css b/local/components/evolution/catalog.special.offers/templates/.default/style.css new file mode 100644 index 0000000..e69de29 diff --git a/local/components/evolution/catalog.special.offers/templates/.default/template.php b/local/components/evolution/catalog.special.offers/templates/.default/template.php new file mode 100644 index 0000000..fea5f53 --- /dev/null +++ b/local/components/evolution/catalog.special.offers/templates/.default/template.php @@ -0,0 +1,52 @@ +setFrameMode(true); +?> + 0): ?> +

" id="catalog_special_h2">Спецпредложения

+
+ +
+ + <?= $arItem['PROPERTIES']['BRAND']['RELATED']['NAME']; ?> <?= $arItem['PROPERTIES']['MODEL']['RELATED']['NAME']; ?> <?= $arItem['PROPERTIES']['BODY']['VALUE']; ?> +

+

+ + , , л.с. +

+
    +
  • +

    Ежемесячный платёж (от)

    +

    р.

    +
  • +
  • +

    Стоимость автомобиля (от)

    +

    р.

    +
  • +
  • +

    Экономия по налогу на прибыль (до)

    +

    р.

    +
  • +
  • +

    НДС к возмещению из бюджета (до)

    +

    р.

    +
  • +
+ +

+
+ +
+ \ No newline at end of file diff --git a/local/components/evolution/catalog/.parameters.php b/local/components/evolution/catalog/.parameters.php new file mode 100644 index 0000000..0597273 --- /dev/null +++ b/local/components/evolution/catalog/.parameters.php @@ -0,0 +1,14 @@ + array( + 'MAP_WIDTH' => array( + 'NAME' => GetMessage('COUNT_PER_PAGE'), + 'TYPE' => 'STRING', + 'DEFAULT' => '3', + 'PARENT' => 'BASE', + ), + ), +); +?> \ No newline at end of file diff --git a/local/components/evolution/catalog/component.php b/local/components/evolution/catalog/component.php index 8b3d623..5162b25 100644 --- a/local/components/evolution/catalog/component.php +++ b/local/components/evolution/catalog/component.php @@ -24,6 +24,7 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true)))) { $arResult = [ 'SELECTED' => [], + 'TITLES' => [], 'ITEMS' => [] ]; @@ -54,11 +55,12 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true)))) $arResult['SELECTED']['SORT'] = $arParams['SORT']; } $filter = Array("ACTIVE" => "Y", "IBLOCK_ID" => 1); - $options = Array("nPageSize" => 6); + $options = Array("nPageSize" => !empty($arParams['COUNT_PER_PAGE']) ? $arParams['COUNT_PER_PAGE'] : 15); $pages_url = $arParams['PATH']; $arResult['EXTENDED'] = false; + $arResult['BY_OPTIONS'] = false; $arResult['FILTER_SMALL'] = $arParams['FILTER_SMALL'] ? true : false; if(!empty($arParams['BRAND'])) @@ -67,14 +69,27 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true)))) while ($brands_ob_element = $brands_res->GetNextElement()) { $brands_ar_res = $brands_ob_element->GetFields(); + $brands_ar_res['PROPERTIES'] = $brands_ob_element->GetProperties(); + $filter['PROPERTY_BRAND'] = $brands_ar_res['ID']; $pages_url = $pages_url.$brands_ar_res['CODE']."/"; $arResult['SELECTED']['BRAND'] = $brands_ar_res['CODE']; + $arResult['SELECTED']['BRAND_ID'] = $brands_ar_res['ID']; + $arResult['SELECTED']['BRAND_UID'] = $brands_ar_res['PROPERTIES']['UID']['VALUE']; + $arResult['TITLES']['BRAND'] = $brands_ar_res['NAME']; + $arResult['TITLES']['TRANSCRIPTION'] = $brands_ar_res['PROPERTIES']['TRANSCRIPTION']['VALUE']; + + $APPLICATION->AddChainItem($brands_ar_res['NAME'], "https://".SITE_SERVER_NAME."/catalog/".$arResult['SELECTED']['BRAND']."/"); } $arResult['EXTENDED'] = true; $arResult['FILTER_SMALL'] = false; $arResult['SCROLL'] = true; + + if(empty($arResult['SELECTED']['BRAND'])) + { + define('ERROR_404', 'Y'); + } } if(!empty($arParams['MODEL'])) @@ -86,66 +101,114 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true)))) $filter['PROPERTY_MODEL'] = $models_ar_res['ID']; $pages_url = $pages_url.$models_ar_res['CODE']."/"; $arResult['SELECTED']['MODEL'] = $models_ar_res['CODE']; + $arResult['TITLES']['MODEL'] = $models_ar_res['NAME']; + + $APPLICATION->AddChainItem($models_ar_res['NAME'], "https://".SITE_SERVER_NAME."/catalog/".$arResult['SELECTED']['BRAND']."/".$arResult['SELECTED']['MODEL']."/"); } $arResult['EXTENDED'] = true; $arResult['SCROLL'] = true; + + if(empty($arResult['SELECTED']['MODEL'])) + { + define('ERROR_404', 'Y'); + } } - if(!empty($arParams['MODIFICATION'])) + if(!isset($arParams['PROGRAM'])) { - $arResult['EXTENDED'] = true; - $arResult['SELECTED']['MODIFICATION'] = $arParams['MODIFICATION']; + if(isset($arResult['SELECTED']['BRAND'])) + { + if(isset($arResult['SELECTED']['MODEL'])) + { + $APPLICATION->AddHeadString(''); + } + else + { + $APPLICATION->AddHeadString(''); + } + } + else + { + $APPLICATION->AddHeadString(''); + } + } - $filter['PROPERTY_MODIFICATION'] = $arParams['MODIFICATION']; - $query_arr['MODIFICATION'] = $arParams['MODIFICATION']; - $arResult['SCROLL'] = true; + //$APPLICATION->AddHeadString(''); + + if(isset($arParams['MODIFICATION'])) + { + if(!empty($arParams['MODIFICATION'])) + { + $arResult['EXTENDED'] = true; + $arResult['SELECTED']['MODIFICATION'] = $arParams['MODIFICATION']; + $arResult['SCROLL'] = true; + + $filter['PROPERTY_MODIFICATION'] = $arParams['MODIFICATION']; + $query_arr['MODIFICATION'] = $arParams['MODIFICATION']; + } + else + { + LocalRedirect("https://".SITE_SERVER_NAME."/catalog/".$arResult['SELECTED']['BRAND']."/".$arResult['SELECTED']['MODEL']."/", true, "301 Moved permanently"); + } } if(!empty($arParams['DRIVE'])) { $arResult['EXTENDED'] = true; + $arResult['BY_OPTIONS'] = true; + $arResult['SCROLL'] = true; + $arResult['SELECTED']['DRIVE'] = $arParams['DRIVE']; $filter['=PROPERTY_DRIVE'] = $arParams['DRIVE']; $query_arr['DRIVE'] = $arParams['DRIVE']; - $arResult['SCROLL'] = true; } if(!empty($arParams['BODY'])) { $arResult['EXTENDED'] = true; + $arResult['BY_OPTIONS'] = true; + $arResult['SCROLL'] = true; + $arResult['SELECTED']['BODY'] = $arParams['BODY']; $filter['=PROPERTY_BODY'] = $arParams['BODY']; $query_arr['BODY'] = $arParams['BODY']; - $arResult['SCROLL'] = true; } if(!empty($arParams['GEAR'])) { $arResult['EXTENDED'] = true; + $arResult['BY_OPTIONS'] = true; + $arResult['SCROLL'] = true; + $arResult['SELECTED']['GEAR'] = $arParams['GEAR']; $filter['=PROPERTY_GEAR'] = $arParams['GEAR']; $query_arr['GEAR'] = $arParams['GEAR']; - $arResult['SCROLL'] = true; } if(!empty($arParams['ENGINE_FUEL'])) { - $filter['=PROPERTY_ENGINE_FUEL'] = $arParams['ENGINE_FUEL']; $arResult['EXTENDED'] = true; + $arResult['BY_OPTIONS'] = true; + $arResult['SCROLL'] = true; + $arResult['SELECTED']['ENGINE_FUEL'] = $arParams['ENGINE_FUEL']; + $filter['=PROPERTY_ENGINE_FUEL'] = $arParams['ENGINE_FUEL']; $query_arr['ENGINE_FUEL'] = $arParams['ENGINE_FUEL']; - $arResult['SCROLL'] = true; } if(!empty($arParams['ENGINE_POWER_FROM']) || !empty($arParams['ENGINE_POWER_TO'])) { - $filter['>StartResultCache(60*60*24, md5(var_export($_POST, true)))) $arResult['SELECTED']['ENGINE_POWER_TO'] = $arParams['ENGINE_POWER_TO']; $query_arr['ENGINE_POWER_TO'] = $arParams['ENGINE_POWER_TO']; } - $arResult['SCROLL'] = true; } if(!empty($arParams['ENGINE_VOLUME_FROM']) || !empty($arParams['ENGINE_VOLUME_TO'])) { - $filter['>StartResultCache(60*60*24, md5(var_export($_POST, true)))) $arResult['SELECTED']['ENGINE_VOLUME_TO'] = $arParams['ENGINE_VOLUME_TO']; $query_arr['ENGINE_VOLUME_TO'] = $arParams['ENGINE_VOLUME_TO']; } - $arResult['SCROLL'] = true; } //$pages_url = $pages_url."/"; @@ -229,49 +294,72 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true)))) $filter['PROPERTY_LEASING_PROGRAMS'] = $arParams["leasing_program"]; } - $res = CIBlockElement::GetList($sort, $filter, false, $options); - - while ($obElement = $res->GetNextElement()) + if(empty($arParams['PROGRAM'])) { - $ar_res = $obElement->GetFields(); - $ar_res['PROPERTIES'] = $obElement->GetProperties(); - $ar_res['PROPERTIES']['BRAND']['RELATED'] = get_related(8, $ar_res['PROPERTIES']['BRAND']['VALUE']); - $ar_res['PROPERTIES']['MODEL']['RELATED'] = get_related(9, $ar_res['PROPERTIES']['MODEL']['VALUE']); - $ar_res['PROPERTIES']['MODIFICATION']['RELATED'] = get_related(10, $ar_res['PROPERTIES']['MODIFICATION']['VALUE']); + $arResult['SHOW_SPECIAL_OFFERS'] = true; + $arResult['SHOW_PROMO_BRANDS'] = true; + } - $ar_res['CALCULATION'] = []; - $ar_res['CALCULATION']['MONTHLY'] = number_format((($ar_res['PROPERTIES']['PRICE']['VALUE'] / 100) * 10), 0, ".", " "); - $ar_res['CALCULATION']['SAVINGS_TAX'] = number_format((($ar_res['PROPERTIES']['PRICE']['VALUE'] / 100) * 4), 0, ".", " "); - $ar_res['CALCULATION']['SAVINGS_VAT'] = number_format((($ar_res['PROPERTIES']['PRICE']['VALUE'] / 100) * 4), 0, ".", " "); + if(!empty($arParams['BRAND'])) + { + $arResult['SHOW_PROMO_BRANDS'] = false; + } - //print "\n"; - //print "\n\n\n"; + if(!empty($arParams['BRAND']) && empty($arParams['MODEL'])) + { + $arResult['SHOW_PROMO_MODELS'] = true; + } - /* - if(isset($ar_res['PREVIEW_PICTURE'])) + if(!empty($arParams['MODEL']) || !empty($arParams['PROGRAM']) || $arResult['BY_OPTIONS']) + { + $arResult['SHOW_SPECIAL_OFFERS'] = false; + $arResult['SHOW_PROMO_BRANDS'] = false; + $arResult['SHOW_PROMO_MODELS'] = false; + + $res = CIBlockElement::GetList($sort, $filter, false, $options); + + while ($obElement = $res->GetNextElement()) { - $ar_res['PREVIEW_PICTURE_SRC'] = get_image_path($ar_res['PREVIEW_PICTURE']); - } + $ar_res = $obElement->GetFields(); + $ar_res['PROPERTIES'] = $obElement->GetProperties(); + $ar_res['PROPERTIES']['BRAND']['RELATED'] = get_related(8, $ar_res['PROPERTIES']['BRAND']['VALUE']); + $ar_res['PROPERTIES']['MODEL']['RELATED'] = get_related(9, $ar_res['PROPERTIES']['MODEL']['VALUE']); + $ar_res['PROPERTIES']['MODIFICATION']['RELATED'] = get_related(10, $ar_res['PROPERTIES']['MODIFICATION']['VALUE']); - if(!empty($ar_res['PROPERTIES']['PHOTO_ICON']['VALUE'])) - { - $ar_res['PROPERTIES']['PHOTO_ICON']['SRC'] = get_image_path($ar_res['PROPERTIES']['PHOTO_ICON']['VALUE']); - } + $ar_res['CALCULATION'] = []; + $ar_res['CALCULATION']['MONTHLY'] = number_format((($ar_res['PROPERTIES']['PRICE']['VALUE'] / 100) * 10), 0, ".", " "); + $ar_res['CALCULATION']['SAVINGS_TAX'] = number_format((($ar_res['PROPERTIES']['PRICE']['VALUE'] / 100) * 4), 0, ".", " "); + $ar_res['CALCULATION']['SAVINGS_VAT'] = number_format((($ar_res['PROPERTIES']['PRICE']['VALUE'] / 100) * 4), 0, ".", " "); - if(!empty($ar_res['PROPERTIES']['CITY']['VALUE'])) - { - $ar_res['PROPERTIES']['CITY']['RELATED'] = get_related_array(10, $ar_res['PROPERTIES']['CITY']['VALUE']); - } + //print "\n"; + //print "\n\n\n"; - if(!empty($ar_res['PROPERTIES']['SUBWAY']['VALUE'])) - { - $ar_res['PROPERTIES']['SUBWAY']['RELATED'] = get_related_array(12, $ar_res['PROPERTIES']['SUBWAY']['VALUE']); - } - */ + /* + if(isset($ar_res['PREVIEW_PICTURE'])) + { + $ar_res['PREVIEW_PICTURE_SRC'] = get_image_path($ar_res['PREVIEW_PICTURE']); + } - $arResult['ITEMS'][] = $ar_res; + if(!empty($ar_res['PROPERTIES']['PHOTO_ICON']['VALUE'])) + { + $ar_res['PROPERTIES']['PHOTO_ICON']['SRC'] = get_image_path($ar_res['PROPERTIES']['PHOTO_ICON']['VALUE']); + } + + if(!empty($ar_res['PROPERTIES']['CITY']['VALUE'])) + { + $ar_res['PROPERTIES']['CITY']['RELATED'] = get_related_array(10, $ar_res['PROPERTIES']['CITY']['VALUE']); + } + + if(!empty($ar_res['PROPERTIES']['SUBWAY']['VALUE'])) + { + $ar_res['PROPERTIES']['SUBWAY']['RELATED'] = get_related_array(12, $ar_res['PROPERTIES']['SUBWAY']['VALUE']); + } + */ + + $arResult['ITEMS'][] = $ar_res; + } } if($_REQUEST['PAGEN_1'] > 1) @@ -279,7 +367,24 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true)))) $arResult['SCROLL'] = true; } - if($arParams["PAGINATION"] == "Y") + if(!empty($arResult['TITLES']['BRAND'])) + { + if(!empty($arResult['TITLES']['MODEL'])) + { + $APPLICATION->SetPageProperty("title", $arResult['TITLES']['BRAND']." ".$arResult['TITLES']['MODEL']." в лизинг для юридических лиц и ИП в Москве - купить новый автомобиль ".$arResult['TITLES']['TRANSCRIPTION']." ".$arResult['TITLES']['MODEL']." в лизинг | Эволюция"); + $APPLICATION->SetPageProperty("description", "Новые автомобили ".$arResult['TITLES']['BRAND']." ".$arResult['TITLES']['MODEL']." в лизинг для юридических лиц и ИП в Москве и в других регионах России. Вы можете купить ".$arResult['TITLES']['BRAND']." ".$arResult['TITLES']['MODEL']." в лизинг от официальных дилеров, автосалонов на выгодных условиях со скидкой. Телефон горячей линии ".CENTRAL_PHONE_FORMATTED." - звонок по России бесплатный."); + } + else + { + $APPLICATION->SetPageProperty("title", $arResult['TITLES']['BRAND']." в лизинг для юридических лиц и ИП в Москве - купить новый автомобиль ".$arResult['TITLES']['TRANSCRIPTION']." в лизинг | Эволюция"); + $APPLICATION->SetPageProperty("description", "Новые автомобили ".$arResult['TITLES']['BRAND']." в лизинг для юридических лиц и ИП в Москве и в других регионах России. Вы можете купить ".$arResult['TITLES']['BRAND']." в лизинг от официальных дилеров, автосалонов на выгодных условиях со скидкой. Телефон горячей линии ".CENTRAL_PHONE_FORMATTED." - звонок по России бесплатный."); + } + } + + $arResult['SECTION_CODE'] = !empty($arParams['section_code']) ? $arParams['section_code'] : $pages_url; + $arResult['QUERY'] = $query; + + if(count($arResult['ITEMS']) > 0 && $arParams["PAGINATION"] == "Y") { $arResult["NAV_STRING"] = $res->GetPageNavStringEx( $navComponentObject, @@ -288,12 +393,57 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true)))) "N", null, [ - "section_code" => !empty($arParams['section_code']) ? $arParams['section_code'] : $pages_url, - "query" => $query, + "section_code" => $arResult['SECTION_CODE'], + "query" => $arResult['QUERY'], ] ); } - $this->IncludeComponentTemplate(); + $arResult['PAGE_CURRENT'] = $res->NavPageNomer; + $arResult['PAGE_COUNT'] = $res->NavPageCount; + + if(isset($_REQUEST['ajax'])) + { + $GLOBALS['APPLICATION']->RestartBuffer(); + /*header('Content-Type: application/json; charset=utf-8'); + $response = [ + 'PAGE_CURRENT' => $arResult['PAGE_CURRENT'], + 'PAGE_COUNT' => $arResult['PAGE_COUNT'], + 'PAGINATION' => $arResult['NAV_STRING'], + 'ITEMS' => [], + ]; + + foreach($arResult['ITEMS'] AS $item) + { + $position = [ + $item + ]; + + array_push($response['ITEMS'], $position); + } + print json_encode($arResult); + */ + + $this->IncludeComponentTemplate(); + $items = ob_get_contents(); + ob_end_clean(); + + header('Content-Type: application/json; charset=utf-8'); + + $response = [ + 'ITEMS' => json_encode(str_replace(["\t","\r","\n"], ["","",""], $items), JSON_UNESCAPED_SLASHES), + 'PAGE_CURRENT' => $arResult['PAGE_CURRENT'], + 'PAGE_COUNT' => $arResult['PAGE_COUNT'], + 'PAGINATION' => json_encode(str_replace(["\t","\r","\n"], ["","",""], $arResult['NAV_STRING']), JSON_UNESCAPED_SLASHES), + ]; + + print json_encode($response, JSON_UNESCAPED_SLASHES); + + die(); + } + else + { + $this->IncludeComponentTemplate(); + } } } \ No newline at end of file diff --git a/local/components/evolution/catalog/lang/ru/.parameters.php b/local/components/evolution/catalog/lang/ru/.parameters.php new file mode 100644 index 0000000..f1b414e --- /dev/null +++ b/local/components/evolution/catalog/lang/ru/.parameters.php @@ -0,0 +1,2 @@ +Любая"); - $("#filter_models").append(""); - } - else - { - if(selected['MODEL'] !== undefined) + page++; + $(".pagination").replaceWith(JSON.parse(response['PAGINATION'])); + $("#catalog_positions_list").append(JSON.parse(response['ITEMS'])); + + if(parseInt(response['PAGE_COUNT'], 10) === parseInt(response['PAGE_CURRENT'], 10)) { - $("#small_filter_models").append(""); - $("#filter_models").append(""); + $("#catalog_get_more").empty(); } - else - { - $("#small_filter_models").append(""); - $("#filter_models").append(""); - } - } - $("#small_filter_models")[0].selectedIndex = 0; - $("#filter_models")[0].selectedIndex = 0; - - for(let i in response.models) - { - $("#small_filter_models").append(""); - $("#filter_models").append(""); - } - - if(selected['MODEL'] !== undefined) - { - $("#small_filter_models").val(selected['MODEL']); - $("#filter_models").val(selected['MODEL']); - - let id = $("#filter_models").find(':selected').data('id'); - selected['MODEL_ID'] = id; - - updateCounter(selected); - } - else - { - updateCounter(selected); - } - }, "json"); -} - -$(function() -{ - $.get("/api/catalog/brands/", - { - params: {}, - }, function(response) - { - console.log("selected", selected); - //$("#small_filter_brands").empty(); - //$("#small_filter_brands").find("option").first().text("Любая").attr("disabled", false); - //$("#filter_brands").find("option").first().text("Любая").attr("disabled", false); - - for(let i in response.brands) - { - $("#small_filter_brands").append(""); - $("#filter_brands").append(""); - } - - if(selected['BRAND'] !== undefined) - { - $("#small_filter_brands").find("option").first().text("Любая").attr("disabled", false).val(''); - $("#filter_brands").find("option").first().text("Любая").attr("disabled", false).val(''); - - $("#small_filter_brands").val(selected['BRAND']); - $("#filter_brands").val(selected['BRAND']); - - let uid = $("#filter_brands").find(':selected').data('uid'); - let id = $("#filter_brands").find(':selected').data('id'); - selected['BRAND_ID'] = id; - - loadModels(uid); - } - else - { - updateCounter(selected); - } - }, "json"); - - $("#small_filter_brands").on("change", function(event) - { - $("#filter_brands").val(event.target.value); - selected['MODEL'] = undefined; - selected['MODEL_ID'] = undefined; - - if($(this).val() === "") - { - $("#small_filter_brands").find("option").first().text("Марка").attr("disabled", "disabled"); - $("#small_filter_models").empty(); - $("#small_filter_models").append(""); - $("#filter_brands").find("option").first().text("Марка").attr("disabled", "disabled"); - $("#filter_models").empty(); - $("#filter_models").append(""); - } - else - { - let uid = $(this).find(':selected').data('uid'); - let id = $(this).find(':selected').data('id'); - selected['BRAND_ID'] = id; - - $("#small_filter_brands").find("option").first().text("Любая").attr("disabled", false); - $("#filter_brands").find("option").first().text("Любая").attr("disabled", false); - - loadModels(uid); - } + }); }); - - $("#small_filter_models").on("change", function(event) - { - if($(this).val() === "") - { - $("#filter_models").val(); - - selected['MODEL'] = undefined; - selected['MODEL_ID'] = undefined; - - $("#small_filter_models").find("option").first().text("Модель").attr("disabled", "disabled"); - $("#filter_models").find("option").first().text("Модель").attr("disabled", "disabled"); - } - else - { - let id = $(this).find(':selected').data('id'); - $("#filter_models").val(event.target.value); - - selected['MODEL'] = id; - selected['MODEL_ID'] = id; - - $("#small_filter_models").find("option").first().text("Любая").attr("disabled", false); - $("#filter_models").find("option").first().text("Любая").attr("disabled", false); - } - }); - - $("#filter_brands").on("change", function(event) - { - console.log("BBBBB", $(this).val()); - if($(this).val() === '') - { - selected['BRAND'] = undefined; - selected['BRAND_ID'] = undefined; - selected['MODEL'] = undefined; - selected['MODEL_ID'] = undefined; - - $("#small_filter_brands").find("option").first().text("Марка").attr("disabled", "disabled"); - $("#small_filter_models").empty(); - $("#small_filter_models").append(""); - $("#filter_brands").find("option").first().text("Марка").attr("disabled", "disabled"); - $("#filter_models").empty(); - $("#filter_models").append(""); - - updateCounter(selected); - } - else - { - let id = $(this).find(':selected').data('id'); - let uid = $(this).find(':selected').data('uid'); - selected['BRAND'] = $(this).val(); - selected['BRAND_ID'] = id; - selected['MODEL'] = undefined; - selected['MODEL_ID'] = undefined; - - $("#small_filter_brands").find("option").first().text("Любая").attr("disabled", false); - $("#filter_brands").find("option").first().text("Любая").attr("disabled", false); - - loadModels(uid); - } - }); - - $("#filter_models").on("change", function(event) - { - if($(this).val() === "") - { - selected['MODEL'] = undefined; - selected['MODEL_ID'] = undefined; - - $("#filter_models").find("option").first().text("Модель").attr("disabled", "disabled"); - } - else - { - let id = $(this).find(':selected').data('id'); - selected['MODEL_ID'] = id; - - $("#filter_models").find("option").first().text("Любая").attr("disabled", false); - } - - updateCounter(selected); - }); - - $("#catalog_small_form").on("submit", function(e) - { - e.preventDefault(); - }); - - $("#catalog_small_find").on("click", function() - { - var path = "/catalog"; - - if($("#small_filter_brands").val() !== "") - { - path = path+"/"+$("#small_filter_brands").val(); - } - if($("#small_filter_models").val() !== "") - { - path = path+"/"+$("#small_filter_models").val(); - } - - path = path+"/"; - - window.location.href = path; - //$("#catalog_small_form").submit(); - }); - - $("#rich_filter_toggle").on("click", function() - { - updateCounter(selected); - $("#filter").addClass("visible"); - $("#catalog_small_filter").addClass("hidden"); - }); - - $.get("/api/catalog/parameters/", - { - params: {}, - }, function(response) - { - for(let i in response.bodies) - { - $("#filter_bodies").append(""); - } - if(selected['BODY'] !== undefined && selected['BODY'] !== null && selected['BODY'] !== "") - { - $("#filter_bodies").val(selected['BODY']); - $("#filter_bodies").find("option").first().text("Любой").attr("disabled", false); - } - - for(let i in response.gears) - { - $("#filter_gears").append(""); - } - if(selected['GEAR'] !== undefined && selected['GEAR'] !== null && selected['GEAR'] !== "") - { - $("#filter_gears").val(selected['GEAR']); - $("#filter_gears").find("option").first().text("Любая").attr("disabled", false); - } - - for(let i in response.engine_fuels) - { - $("#filter_engine_fuels").append(""); - } - if(selected['ENGINE_FUEL'] !== undefined && selected['ENGINE_FUEL'] !== null && selected['ENGINE_FUEL'] !== "") - { - $("#filter_engine_fuels").val(selected['ENGINE_FUEL']); - $("#filter_engine_fuels").find("option").first().text("Любой").attr("disabled", false); - } - - for(let i in response.drives) - { - $("#filter_drives").append(""); - } - if(selected['DRIVE'] !== undefined && selected['DRIVE'] !== null && selected['DRIVE'] !== "") - { - $("#filter_drives").val(selected['DRIVE']); - $("#filter_drives").find("option").first().text("Любой").attr("disabled", false); - } - - if(selected['ENGINE_VOLUME_FROM'] !== undefined && selected['ENGINE_VOLUME_FROM'] !== null && selected['ENGINE_VOLUME_FROM'] !== "") - { - $("#filter_engine_volume_from").val(selected['ENGINE_VOLUME_FROM']); - $("#filter_engine_volume_from").find("option").first().text("Любой").attr("disabled", false); - } - - if(selected['ENGINE_VOLUME_TO'] !== undefined && selected['ENGINE_VOLUME_TO'] !== null && selected['ENGINE_VOLUME_TO'] !== "") - { - $("#filter_engine_volume_to").val(selected['ENGINE_VOLUME_TO']); - $("#filter_engine_volume_to").find("option").first().text("Любой").attr("disabled", false); - } - - console.log("response", response); - }, "json"); - - $("#filter_bodies").on("change", function() - { - if($(this).val() !== "") - { $(this).find("option").first().text("Любой").attr("disabled", false); } - else - { $(this).find("option").first().text("Кузов").attr("disabled", "disabled"); } - - selected['BODY'] = $(this).val();; - updateCounter(selected); - }); - - $("#filter_drives").on("change", function() - { - if($(this).val() !== "") - { $(this).find("option").first().text("Любой").attr("disabled", false); } - else - { $(this).find("option").first().text("Привод").attr("disabled", "disabled"); } - - selected['DRIVE'] = $(this).val();; - updateCounter(selected); - }); - - $("#filter_engine_fuels").on("change", function() - { - if($(this).val() !== "") - { $(this).find("option").first().text("Любой").attr("disabled", false); } - else - { $(this).find("option").first().text("Двигатель").attr("disabled", "disabled"); } - - selected['ENGINE_FUEL'] = $(this).val();; - updateCounter(selected); - }); - - $("#filter_gears").on("change", function() - { - if($(this).val() !== "") - { $(this).find("option").first().text("Любая").attr("disabled", false); } - else - { $(this).find("option").first().text("Коробка").attr("disabled", "disabled"); } - - selected['GEAR'] = $(this).val();; - updateCounter(selected); - }); - - $("#catalog_filter_search_button").on("click", function(e) - { - e.preventDefault(); - var path = "/catalog"; - - if($("#filter_brands").val() !== undefined && $("#filter_brands").val() !== null && $("#filter_brands").val() !== "") - { - path = path+"/"+$("#filter_brands").val(); - } - if($("#filter_models").val() !== undefined && $("#filter_models").val() !== null && $("#filter_models").val() !== "") - { - path = path+"/"+$("#filter_models").val(); - } - - var p = {}; - for(let i in selected) - { - if(i !== "BRAND" && i !== "BRAND_ID" && i !== "MODEL" && i !== "MODEL_ID") - { - p[i] = selected[i]; - } - } - - path = path+"/?"+$.param(p); - window.location.href = path; - }); - - $("#filter_engine_volume_from").on("change", function() - { - if($(this).val() !== "") - { $(this).find("option").first().text("Любой").attr("disabled", false); } - else - { $(this).find("option").first().text("Объем, от").attr("disabled", "disabled"); } - - selected['ENGINE_VOLUME_FROM'] = $(this).val();; - updateCounter(selected); - }); - - $("#filter_engine_volume_to").on("change", function() - { - if($(this).val() !== "") - { $(this).find("option").first().text("Любой").attr("disabled", false); } - else - { $(this).find("option").first().text("Объем, до").attr("disabled", "disabled"); } - - selected['ENGINE_VOLUME_TO'] = $(this).val();; - updateCounter(selected); - }); -}); -*/ \ No newline at end of file +}); \ No newline at end of file diff --git a/local/components/evolution/catalog/templates/.default/template.php b/local/components/evolution/catalog/templates/.default/template.php index def478e..ba8ec6b 100644 --- a/local/components/evolution/catalog/templates/.default/template.php +++ b/local/components/evolution/catalog/templates/.default/template.php @@ -11,7 +11,25 @@ /** @var string $componentPath */ /** @var CBitrixComponent $component */ $this->setFrameMode(true); + +$title = ""; +if(!empty($arResult['TITLES']['BRAND'])) +{ + $title .= "Новые автомобили ".$arResult['TITLES']['BRAND']; +} + +if(!empty($arResult['TITLES']['MODEL'])) +{ + $title = $arResult['TITLES']['BRAND']." ".$arResult['TITLES']['MODEL']; +} ?> + @@ -20,7 +38,7 @@ $this->setFrameMode(true);
-

Каталог автомобилей

+

@@ -53,7 +71,6 @@ $this->setFrameMode(true); - Фильтр
@@ -74,110 +91,133 @@ $this->setFrameMode(true); ); ?>
- IncludeComponent( - "evolution:catalog.sort", - "", - Array( - "SORT" => $arParams['SORT'], - "FILTER" => $arResult['FILTER_SMALL'], - ) - ); ?> 0): ?> -
- -
- - <?= $arItem['PROPERTIES']['BRAND']['RELATED']['NAME']; ?> <?= $arItem['PROPERTIES']['MODEL']['RELATED']['NAME']; ?> <?= $arItem['PROPERTIES']['BODY']['VALUE']; ?> -

-

- - , , л.с. -

-
    -
  • -

    Ежемесячный платёж (от)

    -

    р.

    -
  • -
  • -

    Стоимость автомобиля (от)

    -

    р.

    -
  • -
  • -

    Экономия по налогу на прибыль (до)

    -

    р.

    -
  • -
  • -

    НДС к возмещению из бюджета (до)

    -

    р.

    -
  • -
- -

-
- + IncludeComponent( + "evolution:catalog.sort", + "", + Array( + "SORT" => $arParams['SORT'], + "FILTER" => $arResult['FILTER_SMALL'], + ) + ); ?> + +
+
+
+ + IncludeComponent( + "evolution:catalog.special.offers", + "", + Array( + "COUNT" => 3, + "EXTENDED" => $arResult['EXTENDED'], + "BRAND_ID" => $arResult['SELECTED']['BRAND_ID'], + ) + ); ?> + + + + IncludeComponent( + "evolution:catalog.promo.brand", + "", + Array( + "COUNT" => 3, + ) + ); ?> + + + + IncludeComponent( + "evolution:catalog.promo.model", + "", + Array( + "COUNT" => 3, + "BRAND_NAME" => $arResult['TITLES']['BRAND'], + "BRAND_CODE" => $arResult['SELECTED']['BRAND'], + "BRAND_UID" => $arResult['SELECTED']['BRAND_UID'], + ) + ); ?> + + + 0): ?> +
+ + IncludeComponent( + "evolution:catalog.list.item", + "", + $arItem + ); ?> + +
+ 1 && $arResult['PAGE_CURRENT'] != $arResult['PAGE_COUNT']): ?> + + + Показать еще + + + +

Рекомендуемые модели Audi для вас

-
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+ - */ ?> - - - - - IncludeComponent( "evolution:catalog.brands", @@ -211,67 +246,65 @@ $this->setFrameMode(true); ) ); ?> - -

Седаны в лизинг

-
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+ -
diff --git a/local/components/evolution/catalog/templates/ajax/template.php b/local/components/evolution/catalog/templates/ajax/template.php new file mode 100644 index 0000000..d76618e --- /dev/null +++ b/local/components/evolution/catalog/templates/ajax/template.php @@ -0,0 +1,22 @@ +setFrameMode(true); + +?> + + IncludeComponent( + "evolution:catalog.list.item", + "", + $arItem + ); ?> + \ No newline at end of file diff --git a/local/components/evolution/form.catalog.filter/templates/.default/script.js b/local/components/evolution/form.catalog.filter/templates/.default/script.js index e0464da..be3c694 100644 --- a/local/components/evolution/form.catalog.filter/templates/.default/script.js +++ b/local/components/evolution/form.catalog.filter/templates/.default/script.js @@ -1,17 +1,19 @@ -var current = {}; +var current_params = {}; var selected = {}; var inputs = {}; var path = ""; var program = null; var updating = false; var counter_params = undefined; +var loaded = false; +var total = undefined; function formCatalogFilter(p, pr, props) { console.log("FILTER", "program", pr); path = p; selected = props; - current = props; + current_params = props; program = pr; $(".filter_header .tabs .tab").on("click", function() @@ -21,14 +23,17 @@ function formCatalogFilter(p, pr, props) }); } -function updateCounter(parameters) +function updateCounter(parameters, reset = false) { - console.log("updateCounter", parameters); + $(".catalog_filter_select").attr("disabled", true); + + console.log("updateCounter", "parameters (selected)", parameters); if(!updating) { updating = true; + $("#catalog_filter_spinner").show(); $("#catalog_filter_spinner").show(); $("#catalog_filter_search_button_counter").hide(); @@ -37,23 +42,330 @@ function updateCounter(parameters) { params['PROGRAM'] = program; } + for(let i in parameters) { if(parameters[i] !== undefined) { params[i] = parameters[i]; } } - + counter_params = params; setTimeout(function() { - console.log("sending"); - - $.get("/api/catalog/count/", counter_params, function(response) + $.get("/api/catalog/parameters/", counter_params, function(response) { + $(".catalog_filter_select").attr("disabled", false); + + if(response.brands !== undefined) + { + if(response.brands.length > 0) + { + var current = $("#filter_brands").val(); + + $("#filter_brands").empty(); + + if(!reset && current !== "" && current !== null) + { + $("#filter_brands").append(''); + } + else + { + $("#filter_brands").append(''); + } + + for(let i in response.brands) + { + var brand = response.brands[i]; + $("#filter_brands").append(''); + } + + $("#filter_brands").val(reset ? "" : current); + } + } + + if(response.models !== undefined) + { + var current = $("#filter_models").val(); + + $("#filter_models").empty(); + + if(!reset && current !== "" && current !== null) + { + $("#filter_models").append(''); + } + else + { + $("#filter_models").append(''); + } + + for(let i in response.models) + { + var model = response.models[i]; + $("#filter_models").append(''); + } + + $("#filter_models").val(reset ? "" : current); + } + + if(response.modifications !== undefined) + { + var current = $("#filter_modifications").val(); + + $("#filter_modifications").empty(); + + if(!reset && current !== "" && current !== null) + { + $("#filter_modifications").append(''); + } + else + { + $("#filter_modifications").append(''); + } + + for(let i in response.modifications) + { + var modification = response.modifications[i]; + $("#filter_modifications").append(''); + } + + $("#filter_modifications").val(reset ? "" : current); + } + + if(response.bodies !== undefined) + { + console.log("BODY FROM RESPONSE"); + if(response.bodies.length > 0) + { + var current = $("#filter_bodies").val(); + console.log("BODY FROM RESPONSE", "current", current); + $("#filter_bodies").empty(); + + if(!reset && current !== "" && current !== null) + { + $("#filter_bodies").append(''); + } + else + { + $("#filter_bodies").append(''); + } + + for(let i in response.bodies) + { + $("#filter_bodies").append(''); + } + + if(!loaded) + { + if(selected['BODY'] !== undefined && selected['BODY'] !== null && selected['BODY'] !== "") + { + $("#filter_bodies").val(selected['BODY']); + $("#filter_bodies").find("option").first().text("Любой").attr("disabled", false); + } + } + else + { + $("#filter_bodies").val(reset ? "" : current); + } + } + } + + if(response.gears !== undefined) + { + if(response.gears.length > 0) + { + var current = $("#filter_gears").val(); + $("#filter_gears").empty(); + + if(!reset && current !== "" && current !== null) + { + $("#filter_gears").append(''); + } + else + { + $("#filter_gears").append(''); + } + + for(let i in response.gears) + { + $("#filter_gears").append(''); + } + + if(!loaded) + { + if(selected['GEAR'] !== undefined && selected['GEAR'] !== null && selected['GEAR'] !== "") + { + $("#filter_gears").val(selected['GEAR']); + $("#filter_gears").find("option").first().text("Любая").attr("disabled", false); + } + } + else + { + $("#filter_gears").val(reset ? "" : current); + } + } + } + + if(response.engine_fuels !== undefined) + { + if(response.engine_fuels.length > 0) + { + var current = $("#filter_engine_fuels").val(); + $("#filter_engine_fuels").empty(); + + if(!reset && current !== "" && current !== null) + { + $("#filter_engine_fuels").append(''); + } + else + { + $("#filter_engine_fuels").append(''); + } + + for(let i in response.engine_fuels) + { + $("#filter_engine_fuels").append(''); + } + + if(!loaded) + { + if(selected['ENGINE_FUEL'] !== undefined && selected['ENGINE_FUEL'] !== null && selected['ENGINE_FUEL'] !== "") + { + $("#filter_engine_fuels").val(selected['ENGINE_FUEL']); + $("#filter_engine_fuels").find("option").first().text("Любой").attr("disabled", false); + } + } + else + { + $("#filter_engine_fuels").val(reset ? "" : current); + } + } + } + + if(response.drives !== undefined) + { + if(response.drives.length > 0) + { + var current = $("#filter_drives").val(); + $("#filter_drives").empty(); + + if(!reset && current !== "" && current !== null) + { + $("#filter_drives").append(''); + } + else + { + $("#filter_drives").append(''); + } + + for(let i in response.drives) + { + $("#filter_drives").append(''); + } + + if(!loaded) + { + if(selected['DRIVE'] !== undefined && selected['DRIVE'] !== null && selected['DRIVE'] !== "") + { + $("#filter_drives").val(selected['DRIVE']); + $("#filter_drives").find("option").first().text("Любой").attr("disabled", false); + } + } + else + { + $("#filter_drives").val(reset ? "" : current); + } + } + } + + if(response.engine_volumes !== undefined) + { + if(response.engine_volumes.length > 0) + { + var current_from = parameters['ENGINE_VOLUME_FROM'] !== undefined ? parameters['ENGINE_VOLUME_FROM'] : ""; + var current_to = parameters['ENGINE_VOLUME_TO'] !== undefined ? parameters['ENGINE_VOLUME_TO'] : ""; + + $("#filter_engine_volume_from").empty(); + $("#filter_engine_volume_to").empty(); + + if(!reset && current_from !== "" && current_from !== null) + { + $("#filter_engine_volume_from").append(''); + } + else + { + $("#filter_engine_volume_from").append(''); + } + + if(!reset && current_to !== "" && current_to !== null) + { + $("#filter_engine_volume_to").append(''); + } + else + { + $("#filter_engine_volume_to").append(''); + } + + var c = 0; + for(let i in response.engine_volumes) + { + var v = (response.engine_volumes[i] / 1000); + if(v.toString().length === 1) + { + v = v+".0"; + } + + if(c < response.engine_volumes.length - 1) + { + $("#filter_engine_volume_from").append(''); + } + + if(c > 0) + { + $("#filter_engine_volume_to").append(''); + } + c++; + } + + if(!loaded) + { + if(selected['ENGINE_VOLUME_FROM'] !== undefined && selected['ENGINE_VOLUME_FROM'] !== null && selected['ENGINE_VOLUME_FROM'] !== "") + { + $("#filter_engine_volume_from").val(selected['ENGINE_VOLUME_FROM']); + $("#filter_engine_volume_from").find("option").first().text("Любой").attr("disabled", false); + } + + if(selected['ENGINE_VOLUME_TO'] !== undefined && selected['ENGINE_VOLUME_TO'] !== null && selected['ENGINE_VOLUME_TO'] !== "") + { + $("#filter_engine_volume_to").val(selected['ENGINE_VOLUME_TO']); + $("#filter_engine_volume_to").find("option").first().text("Любой").attr("disabled", false); + } + } + else + { + $("#filter_engine_volume_from").val(reset ? "" : current_from); + $("#filter_engine_volume_to").val(reset ? "" : current_to); + } + } + } + $("#catalog_filter_spinner").hide(); $("#catalog_filter_search_button_counter").text("Показать "+response.total+" вариантов").show(); $("#catalog_small_find").text("Показать "+response.total+" вариантов"); + total = response.total; + + if(response.total == 0) + { + $("#catalog_filter_search_button").attr("disabled", true); + $("#catalog_small_find").attr("disabled", true); + } + else + { + $("#catalog_filter_search_button").attr("disabled", false); + $("#catalog_small_find").attr("disabled", false); + } + updating = false; + loaded = true; }, "json"); }, 100); } @@ -75,13 +387,13 @@ function updateCounter(parameters) function loadModels(uid) { + console.log("loadModels()", "uid", uid); + $.post("/api/catalog/models/", { BRAND_UID: uid }, function(response) { - console.log("loadModels", selected['MODEL_ID'], selected['MODEL']); - $("#small_filter_models").empty(); $("#filter_models").empty(); @@ -125,7 +437,6 @@ function loadModels(uid) selected['MODEL_ID'] = id; loadModifications(uid); - updateCounter(selected); } else { @@ -142,9 +453,6 @@ function loadModifications(uid) MODEL_UID: uid }, function(response) { - console.log(response); - console.log("loadModifications", selected['MODIFICATION']); - $("#filter_modifications").empty(); if(selected['MODIFICATION'] !== undefined) @@ -163,20 +471,19 @@ function loadModifications(uid) $("#filter_modifications").append(""); } - updateCounter(selected); if(selected['MODIFICATION'] !== undefined) { $("#filter_modifications").val(selected['MODIFICATION']); } - else - { - updateCounter(selected); - } + + updateCounter(selected); }, "json"); } $(function() { + $(".catalog_filter_select").attr("disabled", true); + $("#catalog_filter_form").on("submit", function(event) { event.preventDefault(); @@ -270,6 +577,8 @@ $(function() $("#filter_models").find("option").first().text("Модель").attr("disabled", "disabled"); $("#filter_modifications").empty(); $("#filter_modifications").append(""); + + updateCounter(selected); } else { @@ -288,13 +597,10 @@ $(function() loadModifications(uid); } - - updateCounter(selected); }); $("#filter_brands").on("change", function(event) { - console.log("BBBBB", $(this).val()); if($(this).val() === '') { selected['BRAND'] = undefined; @@ -342,6 +648,8 @@ $(function() selected['MODIFICATION'] = undefined; $("#filter_models").find("option").first().text("Модель").attr("disabled", "disabled"); + + updateCounter(selected); } else { @@ -353,8 +661,6 @@ $(function() $("#filter_models").find("option").first().text("Любая").attr("disabled", false); loadModifications(uid); } - - updateCounter(selected); }); $("#filter_modifications").on("change", function(event) @@ -393,76 +699,22 @@ $(function() } window.location.href = p; - //$("#catalog_small_form").submit(); + }); + + $("#catalog_filter_reset_button").on("click", function() + { + selected = {}; + updateCounter({}, true); }); $("#rich_filter_toggle").on("click", function() { + $("#catalog_special_h2").addClass("catalog_h2_title_with_filter"); updateCounter(selected); $("#filter").addClass("visible").css("display", "block"); $("#catalog_small_filter").addClass("hidden").css("display", "none"); }); - $.get("/api/catalog/parameters/", - { - params: {}, - }, function(response) - { - for(let i in response.bodies) - { - $("#filter_bodies").append(""); - } - if(selected['BODY'] !== undefined && selected['BODY'] !== null && selected['BODY'] !== "") - { - $("#filter_bodies").val(selected['BODY']); - $("#filter_bodies").find("option").first().text("Любой").attr("disabled", false); - } - - for(let i in response.gears) - { - $("#filter_gears").append(""); - } - if(selected['GEAR'] !== undefined && selected['GEAR'] !== null && selected['GEAR'] !== "") - { - $("#filter_gears").val(selected['GEAR']); - $("#filter_gears").find("option").first().text("Любая").attr("disabled", false); - } - - for(let i in response.engine_fuels) - { - $("#filter_engine_fuels").append(""); - } - if(selected['ENGINE_FUEL'] !== undefined && selected['ENGINE_FUEL'] !== null && selected['ENGINE_FUEL'] !== "") - { - $("#filter_engine_fuels").val(selected['ENGINE_FUEL']); - $("#filter_engine_fuels").find("option").first().text("Любой").attr("disabled", false); - } - - for(let i in response.drives) - { - $("#filter_drives").append(""); - } - if(selected['DRIVE'] !== undefined && selected['DRIVE'] !== null && selected['DRIVE'] !== "") - { - $("#filter_drives").val(selected['DRIVE']); - $("#filter_drives").find("option").first().text("Любой").attr("disabled", false); - } - - if(selected['ENGINE_VOLUME_FROM'] !== undefined && selected['ENGINE_VOLUME_FROM'] !== null && selected['ENGINE_VOLUME_FROM'] !== "") - { - $("#filter_engine_volume_from").val(selected['ENGINE_VOLUME_FROM']); - $("#filter_engine_volume_from").find("option").first().text("Любой").attr("disabled", false); - } - - if(selected['ENGINE_VOLUME_TO'] !== undefined && selected['ENGINE_VOLUME_TO'] !== null && selected['ENGINE_VOLUME_TO'] !== "") - { - $("#filter_engine_volume_to").val(selected['ENGINE_VOLUME_TO']); - $("#filter_engine_volume_to").find("option").first().text("Любой").attr("disabled", false); - } - - console.log("response", response); - }, "json"); - $("#filter_bodies").on("change", function() { if($(this).val() !== "") @@ -510,33 +762,37 @@ $(function() $("#catalog_filter_search_button").on("click", function(e) { e.preventDefault(); - var p = path; - if($("#filter_brands").val() !== undefined && $("#filter_brands").val() !== null && $("#filter_brands").val() !== "") + if(total > 0) { - p = p + $("#filter_brands").val()+"/"; - } - if($("#filter_models").val() !== undefined && $("#filter_models").val() !== null && $("#filter_models").val() !== "") - { - p = p + $("#filter_models").val()+"/"; - } + var p = path; - var pa = {}; - var pa_count = 0; - for(let i in selected) - { - if(i !== "BRAND" && i !== "BRAND_ID" && i !== "MODEL" && i !== "MODEL_ID") + if($("#filter_brands").val() !== undefined && $("#filter_brands").val() !== null && $("#filter_brands").val() !== "") { - if(selected[i] !== undefined && selected[i] !== null && selected[i] !== "") + p = p + $("#filter_brands").val()+"/"; + } + if($("#filter_models").val() !== undefined && $("#filter_models").val() !== null && $("#filter_models").val() !== "") + { + p = p + $("#filter_models").val()+"/"; + } + + var pa = {}; + var pa_count = 0; + for(let i in selected) + { + if(i !== "BRAND" && i !== "BRAND_ID" && i !== "BRAND_UID" && i !== "MODEL" && i !== "MODEL_ID") { - pa[i] = selected[i]; - pa_count++; + if(selected[i] !== undefined && selected[i] !== null && selected[i] !== "") + { + pa[i] = selected[i]; + pa_count++; + } } } - } - if(pa_count > 0) { p = p + "?"+$.param(pa); } - window.location.href = p; + if(pa_count > 0) { p = p + "?"+$.param(pa); } + window.location.href = p; + } }); $("#filter_engine_volume_from").on("change", function() @@ -561,49 +817,33 @@ $(function() updateCounter(selected); }); - /* - $("#engine_power_from").on("change", function(event) - { - inputs['engine_power_from'] = event.target.value; - }); - - $("#engine_power_to").on("change", function(event) - { - inputs['engine_power_to'] = event.target.value; - }); - - $("#engine_volume_from").on("change", function(event) - { - inputs['engine_volume_from'] = event.target.value; - }); - - $("#engine_volume_to").on("change", function(event) - { - inputs['engine_volume_to'] = event.target.value; - }); - */ - $(".sort_option").on("click", function() { console.log("path", path); + console.log("current_params", current_params); + var value = $(this).data("value"); var p = path; var o = {}; - for(let i in current) + + for(let i in current_params) { - if(i !== "SORT" && i !== "BRAND" && i !== "MODEL" && i !== "BRAND_ID" && i !== "MODEL_ID") + if(i !== "SORT" && i !== "BRAND" && i !== "MODEL" && i !== "BRAND_ID" && i !== "BRAND_UID" && i !== "MODEL_ID") { - o[i] = current[i]; + o[i] = current_params[i]; } } - if(current['BRAND'] !== undefined) + + if(current_params['BRAND'] !== undefined) { - p = p + current['BRAND']+"/"; + p = p + current_params['BRAND']+"/"; } - if(current['MODEL'] !== undefined) + + if(current_params['MODEL'] !== undefined) { - p = p + current['MODEL']+"/"; + p = p + current_params['MODEL']+"/"; } + p = p+"?"; //if(value !== "name") //{ @@ -613,9 +853,10 @@ $(function() var params = $.param(o); if(params.length > 0) { - p = "&"+params; + p += "&"+params; } + //console.log("p", p); document.location.href = p; }); diff --git a/local/components/evolution/form.catalog.filter/templates/.default/template.php b/local/components/evolution/form.catalog.filter/templates/.default/template.php index 6c7c30e..cec3110 100644 --- a/local/components/evolution/form.catalog.filter/templates/.default/template.php +++ b/local/components/evolution/form.catalog.filter/templates/.default/template.php @@ -62,18 +62,18 @@ $this->setFrameMode(true);
-
-
-
@@ -81,18 +81,18 @@ $this->setFrameMode(true);
-
-
-
@@ -100,13 +100,13 @@ $this->setFrameMode(true);
-
- @@ -116,7 +116,7 @@ $this->setFrameMode(true);
- @@ -150,13 +150,16 @@ $this->setFrameMode(true); */ ?>
- - \ No newline at end of file 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 96ca06f..3fabcc0 100644 --- a/local/components/evolution/form.leasing.nomail/templates/.default/script.js +++ b/local/components/evolution/form.leasing.nomail/templates/.default/script.js @@ -74,8 +74,17 @@ function form_leasing_request_submit() $("#send_button_text").css("display", "block"); $("#send_button_spinner").css("display", "none"); - + leasing_form_submitting = false; + + try + { + ym(66905533,'reachGoal','leasingform') + } + catch(e) + { + console.error(e); + } } else if(response.status === "error") { diff --git a/local/components/evolution/form.leasing/templates/.default/script.js b/local/components/evolution/form.leasing/templates/.default/script.js index 30e54fc..3fabcc0 100644 --- a/local/components/evolution/form.leasing/templates/.default/script.js +++ b/local/components/evolution/form.leasing/templates/.default/script.js @@ -76,6 +76,15 @@ function form_leasing_request_submit() $("#send_button_spinner").css("display", "none"); leasing_form_submitting = false; + + try + { + ym(66905533,'reachGoal','leasingform') + } + catch(e) + { + console.error(e); + } } else if(response.status === "error") { diff --git a/local/components/evolution/leasing.programs.entry/component.php b/local/components/evolution/leasing.programs.entry/component.php index 6d02824..d4e6ea4 100644 --- a/local/components/evolution/leasing.programs.entry/component.php +++ b/local/components/evolution/leasing.programs.entry/component.php @@ -64,6 +64,8 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true)))) $APPLICATION->SetPageProperty("title", $meta['ELEMENT_META_TITLE']); $APPLICATION->SetPageProperty("keywords", $meta['ELEMENT_META_KEYWORDS']); $APPLICATION->SetPageProperty("description", $meta['ELEMENT_META_DESCRIPTION']); + + $APPLICATION->AddHeadString(''); } $this->IncludeComponentTemplate(); diff --git a/local/components/evolution/leasing.programs.faq/templates/.default/script.js b/local/components/evolution/leasing.programs.faq/templates/.default/script.js index e9260b5..bbf8117 100644 --- a/local/components/evolution/leasing.programs.faq/templates/.default/script.js +++ b/local/components/evolution/leasing.programs.faq/templates/.default/script.js @@ -3,10 +3,34 @@ var faq_item_index = 0; $(function() { + var hash = document.location.hash.replace("#", ""); + + if(hash !== "") + { + $(".faq_item_title").each(function() + { + if($(this).data('id') == hash) + { + faq_section_index = $(this).data('section'); + faq_item_index = $(this).data('index'); + + $(".faq_section_button").removeClass("active"); + $(".faq_section_button_"+faq_section_index).addClass("active"); + $(".faq_items_list").css("display", "none"); + $(".faq_items_list_"+faq_section_index).css("display", "block"); + + $(".faq_item").removeClass("open"); + $(".faq_item_"+faq_item_index).addClass("open"); + + return false; + } + }); + } + $(".faq_item_title").on("click", function() { - let id = $(this).data('id'); - faq_item_index = id; + let index = $(this).data('index'); + faq_item_index = index; }); $("#faq_search_form_field").on("keydown", function(event) @@ -45,10 +69,14 @@ $(function() let section = $(this).data('section'); faq_section_index = section; + faq_item_index = 0; $(".faq_section_button").removeClass("active"); $(".faq_section_button_"+section).addClass("active"); $(".faq_items_list").css("display", "none"); $(".faq_items_list_"+section).css("display", "block"); + + $(".faq_item").removeClass("open"); + $(".faq_item_"+faq_item_index).addClass("open"); }); }); \ No newline at end of file diff --git a/local/components/evolution/leasing.programs.faq/templates/.default/template.php b/local/components/evolution/leasing.programs.faq/templates/.default/template.php index 61b1284..461b072 100644 --- a/local/components/evolution/leasing.programs.faq/templates/.default/template.php +++ b/local/components/evolution/leasing.programs.faq/templates/.default/template.php @@ -48,8 +48,8 @@ $this->setFrameMode(true);