diff --git a/local/components/evolution/catalog/component.php b/local/components/evolution/catalog/component.php index 5162b25..b507ce6 100644 --- a/local/components/evolution/catalog/component.php +++ b/local/components/evolution/catalog/component.php @@ -54,18 +54,29 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true)))) $arResult['SELECTED']['SORT'] = $arParams['SORT']; } - $filter = Array("ACTIVE" => "Y", "IBLOCK_ID" => 1); + $filter = Array("ACTIVE" => "Y", "IBLOCK_ID" => IBLOCK_ID_CATALOG_CARS_NEW); $options = Array("nPageSize" => !empty($arParams['COUNT_PER_PAGE']) ? $arParams['COUNT_PER_PAGE'] : 15); $pages_url = $arParams['PATH']; + $arResult['BRAND_DISABLED'] = true; + $arResult['MODEL_DISABLED'] = true; $arResult['EXTENDED'] = false; $arResult['BY_OPTIONS'] = false; $arResult['FILTER_SMALL'] = $arParams['FILTER_SMALL'] ? true : false; + $arResult['SHOW_BRANDS_LIST'] = true; + $arResult['SHOW_MODELS_LIST'] = false; + + if(empty($arParams['PROGRAM'])) + { + $arResult['SHOW_SPECIAL_OFFERS'] = true; + $arResult['SHOW_PROMO_BRANDS'] = true; + } + if(!empty($arParams['BRAND'])) { - $brands_res = CIBlockElement::GetList(["NAME" => "ASC"], ["ACTIVE" => "Y", "IBLOCK_ID" => 8, "CODE" => $arParams['BRAND']], false, []); + $brands_res = CIBlockElement::GetList(["NAME" => "ASC"], ["IBLOCK_ID" => IBLOCK_ID_BRANDS, "CODE" => $arParams['BRAND']], false, []); while ($brands_ob_element = $brands_res->GetNextElement()) { $brands_ar_res = $brands_ob_element->GetFields(); @@ -79,6 +90,20 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true)))) $arResult['TITLES']['BRAND'] = $brands_ar_res['NAME']; $arResult['TITLES']['TRANSCRIPTION'] = $brands_ar_res['PROPERTIES']['TRANSCRIPTION']['VALUE']; + if($brands_ar_res['ACTIVE'] === "Y") + { + $arResult['BRAND_DISABLED'] = false; + $arResult['SHOW_BRANDS_LIST'] = false; + $arResult['SHOW_MODELS_LIST'] = true; + $arResult['MODEL_DISABLED'] = false; + } + else + { + $arResult['SHOW_MODELS_LIST'] = false; + } + + $arResult['SHOW_PROMO_BRANDS'] = false; + $APPLICATION->AddChainItem($brands_ar_res['NAME'], "https://".SITE_SERVER_NAME."/catalog/".$arResult['SELECTED']['BRAND']."/"); } @@ -94,7 +119,7 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true)))) if(!empty($arParams['MODEL'])) { - $models_res = CIBlockElement::GetList(["NAME" => "ASC"], ["ACTIVE" => "Y", "IBLOCK_ID" => 9, "CODE" => $arParams['MODEL']], false, []); + $models_res = CIBlockElement::GetList(["NAME" => "ASC"], ["IBLOCK_ID" => IBLOCK_ID_MODELS, "CODE" => $arParams['MODEL'], "PROPERTY_BRAND_UID" => $arResult['SELECTED']['BRAND_UID']], false, []); while ($models_ob_element = $models_res->GetNextElement()) { $models_ar_res = $models_ob_element->GetFields(); @@ -103,6 +128,17 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true)))) $arResult['SELECTED']['MODEL'] = $models_ar_res['CODE']; $arResult['TITLES']['MODEL'] = $models_ar_res['NAME']; + if($models_ar_res['ACTIVE'] === "Y") + { + $arResult['MODEL_DISABLED'] = false; + $arResult['SHOW_MODELS_LIST'] = false; + } + else + { + $arResult['MODEL_DISABLED'] = true; + $arResult['SHOW_PROMO_BRANDS'] = false; + } + $APPLICATION->AddChainItem($models_ar_res['NAME'], "https://".SITE_SERVER_NAME."/catalog/".$arResult['SELECTED']['BRAND']."/".$arResult['SELECTED']['MODEL']."/"); } @@ -294,71 +330,102 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true)))) $filter['PROPERTY_LEASING_PROGRAMS'] = $arParams["leasing_program"]; } - if(empty($arParams['PROGRAM'])) - { - $arResult['SHOW_SPECIAL_OFFERS'] = true; - $arResult['SHOW_PROMO_BRANDS'] = true; - } - if(!empty($arParams['BRAND'])) { - $arResult['SHOW_PROMO_BRANDS'] = false; + $arResult['SHOW_PROMO_BRANDS'] = true; + + if($arResult['BRAND_DISABLED']) + { + $arResult['SHOW_PROMO_BRANDS'] = false; + } } if(!empty($arParams['BRAND']) && empty($arParams['MODEL'])) { $arResult['SHOW_PROMO_MODELS'] = true; + + if($arResult['BRAND_DISABLED']) + { + $arResult['SHOW_PROMO_BRANDS'] = false; + $arResult['SHOW_PROMO_MODELS'] = false; + } + + if($arResult['MODEL_DISABLED']) + { + $arResult['SHOW_PROMO_BRANDS'] = false; + $arResult['SHOW_PROMO_MODELS'] = false; + } + } + + if(!empty($arParams['BRAND']) && !empty($arParams['MODEL'])) + { + if($arResult['MODEL_DISABLED']) + { + $arResult['SHOW_PROMO_BRANDS'] = false; + $arResult['SHOW_PROMO_MODELS'] = false; + } + } + + if(!empty($arParams['PROGRAM'])) + { + $arResult['SHOW_BRANDS_LIST'] = false; + $arResult['SHOW_MODELS_LIST'] = false; + $arResult['BRAND_DISABLED'] = false; + $arResult['MODEL_DISABLED'] = false; } 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()) + if(!$arResult['BRAND_DISABLED'] && !$arResult['MODEL_DISABLED']) { - $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'] = false; + $arResult['SHOW_PROMO_BRANDS'] = false; + $arResult['SHOW_PROMO_MODELS'] = false; - $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, ".", " "); + $res = CIBlockElement::GetList($sort, $filter, false, $options); - //print "\n"; - //print "\n\n\n"; - - /* - if(isset($ar_res['PREVIEW_PICTURE'])) + 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; + } } } @@ -402,6 +469,24 @@ if($this->StartResultCache(60*60*24, md5(var_export($_POST, true)))) $arResult['PAGE_CURRENT'] = $res->NavPageNomer; $arResult['PAGE_COUNT'] = $res->NavPageCount; + if($arResult['MODEL_DISABLED']) + { + $arResult['MODEL'] = null; + $arResult['SELECTED']['MODEL'] = null; + $arResult['SELECTED']['MODEL_ID'] = null; + $arResult['SELECTED']['MODEL_UID'] = null; + $arResult['SHOW_SPECIAL_OFFERS'] = false; + } + + if($arResult['BRAND_DISABLED']) + { + $arResult['BRAND'] = null; + $arResult['SELECTED']['BRAND'] = null; + $arResult['SELECTED']['BRAND_ID'] = null; + $arResult['SELECTED']['BRAND_UID'] = null; + $arResult['SHOW_SPECIAL_OFFERS'] = false; + } + if(isset($_REQUEST['ajax'])) { $GLOBALS['APPLICATION']->RestartBuffer(); diff --git a/local/components/evolution/catalog/templates/.default/template.php b/local/components/evolution/catalog/templates/.default/template.php index ba8ec6b..a46bbf0 100644 --- a/local/components/evolution/catalog/templates/.default/template.php +++ b/local/components/evolution/catalog/templates/.default/template.php @@ -106,6 +106,15 @@ if(!empty($arResult['TITLES']['MODEL'])) endif; ?> + if($arResult['BRAND_DISABLED'] && $arResult['MODEL_DISABLED']): ?> +
Автомобили = $arResult['TITLES']['BRAND']; ?> на данный момент отсутствуют в каталоге, но это не означает, что мы не сможем их для Вас найти. Оставьте заявку или позвоните по номеру горячей линии 8 800 333 75 75 и мы найдём Вам автомобиль!
+Посмотрите автомобили других марок:
+ else: ?> + if($arResult['MODEL_DISABLED']): ?> +Модель = $arResult['TITLES']['BRAND']; ?> = $arResult['TITLES']['MODEL']; ?> на данный момент отсутствует в каталоге, но это не означает, что мы не сможем её для Вас найти. Оставьте заявку или позвоните по номеру горячей линии 8 800 333 75 75 и мы найдём Вам автомобиль!
+Посмотрите другие модели Bentley:
+ endif; ?> + endif; ?> if($arResult['SHOW_SPECIAL_OFFERS']): ?> $APPLICATION->IncludeComponent( @@ -225,7 +234,7 @@ if(!empty($arResult['TITLES']['MODEL'])) */ ?> - if(!isset($_REQUEST['BRAND'])): ?> + if($arResult['SHOW_BRANDS_LIST']): ?> $APPLICATION->IncludeComponent( "evolution:catalog.brands", "", @@ -236,7 +245,7 @@ if(!empty($arResult['TITLES']['MODEL'])) ) ); ?> endif; ?> - if(isset($_REQUEST['BRAND'])): ?> + if($arResult['SHOW_MODELS_LIST']): ?> $APPLICATION->IncludeComponent( "evolution:catalog.models", "", 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 be3c694..590cc08 100644 --- a/local/components/evolution/form.catalog.filter/templates/.default/script.js +++ b/local/components/evolution/form.catalog.filter/templates/.default/script.js @@ -10,7 +10,7 @@ var total = undefined; function formCatalogFilter(p, pr, props) { - console.log("FILTER", "program", pr); +// console.log("FILTER", "program", pr); path = p; selected = props; current_params = props; @@ -27,7 +27,7 @@ function updateCounter(parameters, reset = false) { $(".catalog_filter_select").attr("disabled", true); - console.log("updateCounter", "parameters (selected)", parameters); +// console.log("updateCounter", "parameters (selected)", parameters); if(!updating) { @@ -63,23 +63,28 @@ function updateCounter(parameters, reset = false) var current = $("#filter_brands").val(); $("#filter_brands").empty(); + $("#small_filter_brands").empty(); if(!reset && current !== "" && current !== null) { $("#filter_brands").append(''); + $("#small_filter_brands").append(''); } else { $("#filter_brands").append(''); + $("#small_filter_brands").append(''); } for(let i in response.brands) { var brand = response.brands[i]; $("#filter_brands").append(''); + $("#small_filter_brands").append(''); } $("#filter_brands").val(reset ? "" : current); + $("#small_filter_brands").val(reset ? "" : current); } } @@ -88,23 +93,28 @@ function updateCounter(parameters, reset = false) var current = $("#filter_models").val(); $("#filter_models").empty(); + $("#small_filter_models").empty(); if(!reset && current !== "" && current !== null) { $("#filter_models").append(''); + $("#small_filter_models").append(''); } else { $("#filter_models").append(''); + $("#small_filter_models").append(''); } for(let i in response.models) { var model = response.models[i]; $("#filter_models").append(''); + $("#small_filter_models").append(''); } $("#filter_models").val(reset ? "" : current); + $("#small_filter_models").val(reset ? "" : current); } if(response.modifications !== undefined) @@ -133,11 +143,9 @@ function updateCounter(parameters, reset = false) 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) @@ -387,7 +395,7 @@ function updateCounter(parameters, reset = false) function loadModels(uid) { - console.log("loadModels()", "uid", uid); +// console.log("loadModels()", "uid", uid); $.post("/api/catalog/models/", { @@ -447,7 +455,7 @@ function loadModels(uid) function loadModifications(uid) { - console.log("loadModifications", uid); +// console.log("loadModifications", uid); $.post("/api/catalog/modifications/", { MODEL_UID: uid @@ -494,7 +502,7 @@ $(function() params: {}, }, function(response) { - console.log("selected", selected); +// 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); @@ -635,7 +643,9 @@ $(function() $("#filter_modifications").empty(); $("#filter_modifications").append(""); - loadModels(uid); + //console.log("selected", selected); + //loadModels(uid); + updateCounter(selected); } }); @@ -819,8 +829,8 @@ $(function() $(".sort_option").on("click", function() { - console.log("path", path); - console.log("current_params", current_params); +// console.log("path", path); +// console.log("current_params", current_params); var value = $(this).data("value"); var p = path; diff --git a/local/components/evolution/form.leasing/templates/.default/template.php b/local/components/evolution/form.leasing/templates/.default/template.php index e6b8228..849ce47 100644 --- a/local/components/evolution/form.leasing/templates/.default/template.php +++ b/local/components/evolution/form.leasing/templates/.default/template.php @@ -47,6 +47,7 @@ $this->setFrameMode(true); } .send_button_spinner_animation div { box-sizing: content-box; } +© ООО "ЛК Эволюция"
+© ООО "ЛК Эволюция"
г. Москва, Котляковская ул., д. 8
© ООО "ЛК Эволюция"
+© ООО "ЛК Эволюция"
г. Москва, Котляковская ул., д. 8