diff --git a/admin/controller/module/promo_top_bar_nat.php b/admin/controller/module/promo_top_bar_nat.php index 14f64c3..cf4469c 100644 --- a/admin/controller/module/promo_top_bar_nat.php +++ b/admin/controller/module/promo_top_bar_nat.php @@ -205,6 +205,8 @@ class PromoTopBarNat extends \Opencart\System\Engine\Controller { 'module_promo_top_bar_nat_show_desktop' => '1', 'module_promo_top_bar_nat_show_mobile' => '1', 'module_promo_top_bar_nat_height' => '45px', + 'module_promo_top_bar_nat_padding_top' => '0', + 'module_promo_top_bar_nat_padding_bottom' => '0', 'module_promo_top_bar_nat_border_radius' => '0px', 'module_promo_top_bar_nat_shadow' => 'none', 'module_promo_top_bar_nat_shadow_custom' => '', @@ -294,14 +296,26 @@ class PromoTopBarNat extends \Opencart\System\Engine\Controller { $this->load->model('localisation/language'); if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { - if (isset($this->request->post['module_promo_top_bar_nat_slides_json'])) { - $slides = json_decode(html_entity_decode($this->request->post['module_promo_top_bar_nat_slides_json'], ENT_QUOTES, 'UTF-8'), true); - if (is_array($slides)) { - $this->request->post['module_promo_top_bar_nat_slides'] = $this->encodeSlides($slides); + $is_full_save = isset($this->request->post['module_promo_top_bar_nat_status']); + + if ($is_full_save) { + $this->request->post['module_promo_top_bar_nat_show_desktop'] = isset($this->request->post['module_promo_top_bar_nat_show_desktop']) ? 1 : 0; + $this->request->post['module_promo_top_bar_nat_show_mobile'] = isset($this->request->post['module_promo_top_bar_nat_show_mobile']) ? 1 : 0; + + if (isset($this->request->post['module_promo_top_bar_nat_slides_json'])) { + $slides = json_decode(html_entity_decode($this->request->post['module_promo_top_bar_nat_slides_json'], ENT_QUOTES, 'UTF-8'), true); + if (is_array($slides)) { + $this->request->post['module_promo_top_bar_nat_slides'] = $this->encodeSlides($slides); + } + unset($this->request->post['module_promo_top_bar_nat_slides_json']); + } elseif (isset($this->request->post['module_promo_top_bar_nat_slides']) && is_array($this->request->post['module_promo_top_bar_nat_slides'])) { + $this->request->post['module_promo_top_bar_nat_slides'] = $this->encodeSlides($this->request->post['module_promo_top_bar_nat_slides']); } + } else { + $existing_settings = $this->model_setting_setting->getSetting('module_promo_top_bar_nat'); unset($this->request->post['module_promo_top_bar_nat_slides_json']); - } elseif (isset($this->request->post['module_promo_top_bar_nat_slides']) && is_array($this->request->post['module_promo_top_bar_nat_slides'])) { - $this->request->post['module_promo_top_bar_nat_slides'] = $this->encodeSlides($this->request->post['module_promo_top_bar_nat_slides']); + unset($this->request->post['module_promo_top_bar_nat_slides']); + $this->request->post = array_merge($existing_settings, $this->request->post); } $posted_lic = isset($this->request->post['module_promo_top_bar_nat_license']) ? trim((string)$this->request->post['module_promo_top_bar_nat_license']) : ''; @@ -431,6 +445,8 @@ class PromoTopBarNat extends \Opencart\System\Engine\Controller { 'module_promo_top_bar_nat_show_desktop', 'module_promo_top_bar_nat_show_mobile', 'module_promo_top_bar_nat_height', + 'module_promo_top_bar_nat_padding_top', + 'module_promo_top_bar_nat_padding_bottom', 'module_promo_top_bar_nat_border_radius', 'module_promo_top_bar_nat_shadow', 'module_promo_top_bar_nat_shadow_custom', @@ -574,17 +590,28 @@ class PromoTopBarNat extends \Opencart\System\Engine\Controller { } if (!$json) { - if (isset($this->request->post['module_promo_top_bar_nat_slides_json'])) { - $slides = json_decode(html_entity_decode($this->request->post['module_promo_top_bar_nat_slides_json'], ENT_QUOTES, 'UTF-8'), true); - if (is_array($slides)) { - $this->request->post['module_promo_top_bar_nat_slides'] = $this->encodeSlides($slides); - } - unset($this->request->post['module_promo_top_bar_nat_slides_json']); - } elseif (isset($this->request->post['module_promo_top_bar_nat_slides']) && is_array($this->request->post['module_promo_top_bar_nat_slides'])) { - $this->request->post['module_promo_top_bar_nat_slides'] = $this->encodeSlides($this->request->post['module_promo_top_bar_nat_slides']); - } - $this->load->model('setting/setting'); + $is_full_save = isset($this->request->post['module_promo_top_bar_nat_status']); + + if ($is_full_save) { + $this->request->post['module_promo_top_bar_nat_show_desktop'] = isset($this->request->post['module_promo_top_bar_nat_show_desktop']) ? 1 : 0; + $this->request->post['module_promo_top_bar_nat_show_mobile'] = isset($this->request->post['module_promo_top_bar_nat_show_mobile']) ? 1 : 0; + + if (isset($this->request->post['module_promo_top_bar_nat_slides_json'])) { + $slides = json_decode(html_entity_decode($this->request->post['module_promo_top_bar_nat_slides_json'], ENT_QUOTES, 'UTF-8'), true); + if (is_array($slides)) { + $this->request->post['module_promo_top_bar_nat_slides'] = $this->encodeSlides($slides); + } + unset($this->request->post['module_promo_top_bar_nat_slides_json']); + } elseif (isset($this->request->post['module_promo_top_bar_nat_slides']) && is_array($this->request->post['module_promo_top_bar_nat_slides'])) { + $this->request->post['module_promo_top_bar_nat_slides'] = $this->encodeSlides($this->request->post['module_promo_top_bar_nat_slides']); + } + } else { + $existing_settings = $this->model_setting_setting->getSetting('module_promo_top_bar_nat'); + unset($this->request->post['module_promo_top_bar_nat_slides_json']); + unset($this->request->post['module_promo_top_bar_nat_slides']); + $this->request->post = array_merge($existing_settings, $this->request->post); + } $posted_lic = isset($this->request->post['module_promo_top_bar_nat_license']) ? trim((string)$this->request->post['module_promo_top_bar_nat_license']) : ''; $this->request->post['module_promo_top_bar_nat_license'] = $posted_lic; diff --git a/admin/language/en-gb/module/promo_top_bar_nat.php b/admin/language/en-gb/module/promo_top_bar_nat.php index c2de85e..ebc6f91 100644 --- a/admin/language/en-gb/module/promo_top_bar_nat.php +++ b/admin/language/en-gb/module/promo_top_bar_nat.php @@ -134,7 +134,7 @@ $_['text_info_title_database_optimizer'] = 'Database Optimizer [NAT]'; $_['text_info_desc_database_optimizer'] = 'Intelligent database garbage collection, system log management, and adding critical indexes for site speedup.'; $_['text_info_title_image_optimizer'] = 'Image Optimizer [NAT]'; $_['text_info_desc_image_optimizer'] = 'Original image compression to WebP + Mass cleanup of unused images on the server.'; -$_['text_info_title_domain_scanner'] = 'Domain Scanner [NAT] Current module'; +$_['text_info_title_domain_scanner'] = 'Domain Scanner [NAT]'; $_['text_info_desc_domain_scanner'] = 'Search and clean external links and HTTP images in DB and theme files. Perfect for HTTPS migration or parsing cleanup.'; $_['text_info_title_new_arrivals'] = 'New Arrivals [NAT]: True Sort by Date'; $_['text_info_desc_new_arrivals'] = 'Automatic SEO page for new arrivals. Displays items strictly by actual added date. Sliders, grids, and smart date archive sidebar.'; diff --git a/admin/language/ru-ru/module/promo_top_bar_nat.php b/admin/language/ru-ru/module/promo_top_bar_nat.php index 8771bc2..8012e99 100644 --- a/admin/language/ru-ru/module/promo_top_bar_nat.php +++ b/admin/language/ru-ru/module/promo_top_bar_nat.php @@ -134,7 +134,7 @@ $_['text_info_title_database_optimizer'] = 'Database Optimizer [NAT]'; $_['text_info_desc_database_optimizer'] = 'Интеллектуальная очистка мусора в БД, управление системными логами и добавление критических индексов для ускорения сайта.'; $_['text_info_title_image_optimizer'] = 'Image Optimizer [NAT]'; $_['text_info_desc_image_optimizer'] = 'Сжатие оригинальных изображений в WebP + массовая очистка неиспользуемых картинок на сервере.'; -$_['text_info_title_domain_scanner'] = 'Domain Scanner [NAT] Текущий модуль'; +$_['text_info_title_domain_scanner'] = 'Domain Scanner [NAT]'; $_['text_info_desc_domain_scanner'] = 'Поиск и очистка внешних ссылок и картинок по HTTP в БД и файлах темы. Идеально для перехода на HTTPS или очистки после парсинга.'; $_['text_info_title_new_arrivals'] = 'New Arrivals [NAT]: True Sort by Date'; $_['text_info_desc_new_arrivals'] = 'Автоматическая SEO страница для новинок. Выводит товары строго по реальной дате добавления. Слайдеры, сетки и умный сайдбар архива дат.'; diff --git a/admin/language/uk-ua/module/promo_top_bar_nat.php b/admin/language/uk-ua/module/promo_top_bar_nat.php index 33649e0..e9879f4 100644 --- a/admin/language/uk-ua/module/promo_top_bar_nat.php +++ b/admin/language/uk-ua/module/promo_top_bar_nat.php @@ -134,7 +134,7 @@ $_['text_info_title_database_optimizer'] = 'Database Optimizer [NAT]'; $_['text_info_desc_database_optimizer'] = 'Інтелектуальне очищення сміття в БД, управління системними логами та додавання критичних індексів для прискорення сайту.'; $_['text_info_title_image_optimizer'] = 'Image Optimizer [NAT]'; $_['text_info_desc_image_optimizer'] = 'Стиснення оригінальних зображень у WebP + масове очищення невикористовуваних картинок на сервері.'; -$_['text_info_title_domain_scanner'] = 'Domain Scanner [NAT] Поточний модуль'; +$_['text_info_title_domain_scanner'] = 'Domain Scanner [NAT]'; $_['text_info_desc_domain_scanner'] = 'Пошук та очищення зовнішніх посилань та зображень по HTTP в БД та файлах теми. Ідеально для переходу на HTTPS або очищення після парсингу.'; $_['text_info_title_new_arrivals'] = 'New Arrivals [NAT]: True Sort by Date'; $_['text_info_desc_new_arrivals'] = 'Автоматична SEO-сторінка для новинок. Виводить товари строго за датою додавання. Слайдери, сітки та розумний сайдбар архіву дат.'; diff --git a/admin/view/template/module/promo_top_bar_nat.twig b/admin/view/template/module/promo_top_bar_nat.twig index 0e3df61..09dc98e 100644 --- a/admin/view/template/module/promo_top_bar_nat.twig +++ b/admin/view/template/module/promo_top_bar_nat.twig @@ -566,6 +566,9 @@ body.nat-dark-mode .nat-settings-license-row { {% endif %} {% if is_licensed %} + +
+
@@ -1770,6 +1773,18 @@ var nat_promo_lang = { text_block_product_button_text_help: '{{ text_block_product_button_text_help }}', text_block_color_product_btn_bg: '{{ text_block_color_product_btn_bg }}', text_block_color_product_btn_text: '{{ text_block_color_product_btn_text }}', + text_block_shipping_threshold_label: '{{ text_block_shipping_threshold_label }}', + text_block_shipping_threshold_help: '{{ text_block_shipping_threshold_help }}', + text_block_shipping_text_before_label: '{{ text_block_shipping_text_before_label }}', + text_block_shipping_text_before_help: '{{ text_block_shipping_text_before_help }}', + text_block_shipping_text_after_label: '{{ text_block_shipping_text_after_label }}', + text_block_shipping_text_after_help: '{{ text_block_shipping_text_after_help }}', + text_block_shipping_text_reached_label: '{{ text_block_shipping_text_reached_label }}', + text_block_shipping_text_reached_help: '{{ text_block_shipping_text_reached_help }}', + text_block_shipping_show_bar_label: '{{ text_block_shipping_show_bar_label }}', + text_block_subscribe_placeholder_label: '{{ text_block_subscribe_placeholder_label }}', + text_block_subscribe_placeholder_help: '{{ text_block_subscribe_placeholder_help }}', + text_block_subscribe_button_text_label: '{{ text_block_subscribe_button_text_label }}', error_duplicate_block_type: '{{ error_duplicate_block_type }}', text_success_duplicate_block: '{{ text_success_duplicate_block }}', text_inherit_default: '{{ text_inherit_default }}', @@ -1989,6 +2004,12 @@ function selectSlide(idx) { } else if (linkVal.indexOf('route:information:') === 0) { $typeSelect.val('information').trigger('change'); $('.slide-page-select-information[data-lang="' + langId + '"]').val(linkVal); + } else if (linkVal.indexOf('route:manufacturer:') === 0) { + $typeSelect.val('manufacturer').trigger('change'); + $('.slide-page-select-manufacturer[data-lang="' + langId + '"]').val(linkVal); + } else if (linkVal.indexOf('route:product:') === 0) { + $typeSelect.val('product').trigger('change'); + $('.slide-page-select-product-autocomplete[data-lang="' + langId + '"]').val(linkVal); } else { $typeSelect.val(linkVal); } @@ -2677,7 +2698,7 @@ $(document).ready(function() { $el.autocomplete({ 'source': function(request, response) { $.ajax({ - url: 'index.php?route=catalog/product/autocomplete&user_token=' + user_token + '&filter_name=' + encodeURIComponent(request), + url: 'index.php?route=catalog/product' + (window.NAT_OC4_SEP || '.') + 'autocomplete&user_token=' + user_token + '&filter_name=' + encodeURIComponent(request), dataType: 'json', success: function(json) { response($.map(json, function(item) { @@ -2729,7 +2750,9 @@ $(document).on('click', '#btn-apply-preset', function() { // Update inputs $('#slide-bg-type').val(slide.bg_type).trigger('change'); $('#slide-bg-color').val(slide.bg_color); + $('#slide-bg-color-hex').val(slide.bg_color); $('#slide-text-color').val(slide.text_color); + $('#slide-text-color-hex').val(slide.text_color); $('#slide-custom-css').val(slide.custom_css); updateHiddenInputs(); @@ -3352,20 +3375,12 @@ function selectBlock(idx, event) { html += '
'; // Badge colors - html += '
'; + html += '
'; html += '
'; - html += ' '; - html += '
'; - html += ' '; - html += ' '; - html += '
'; + html += renderColorFieldHtml('Цвет фона бейджа', 'badge_bg', block.badge_bg || '#e74c3c'); html += '
'; html += '
'; - html += ' '; - html += '
'; - html += ' '; - html += ' '; - html += '
'; + html += renderColorFieldHtml(nat_promo_lang.text_block_color_text + ' бейджа', 'badge_color', block.badge_color || '#ffffff'); html += '
'; html += '
'; html += '
'; @@ -3907,7 +3922,7 @@ function selectBlock(idx, event) { $fields.find('.product-autocomplete-input').autocomplete({ 'source': function(request, response) { $.ajax({ - url: 'index.php?route=catalog/product/autocomplete&user_token=' + user_token + '&filter_name=' + encodeURIComponent(request), + url: 'index.php?route=catalog/product' + (window.NAT_OC4_SEP || '.') + 'autocomplete&user_token=' + user_token + '&filter_name=' + encodeURIComponent(request), dataType: 'json', success: function(json) { response($.map(json, function(item) { @@ -4897,6 +4912,7 @@ $(document).ready(function() { // AJAX Save $('#button-save').on('click', function() { + updateHiddenInputs(); $.ajax({ url: '{{ save }}', type: 'post', @@ -4926,8 +4942,15 @@ $(document).ready(function() { }); }); + $('#form-promo-top-bar').on('submit', function() { + {% if is_licensed %} + updateHiddenInputs(); + {% endif %} + }); + // Autosave function function autoSaveSettings() { + if (window.natIsPurging) return; updateHiddenInputs(); $.ajax({ url: '{{ save }}', @@ -4943,9 +4966,11 @@ $(document).ready(function() { } // Autosave interval (every 60 seconds) + {% if is_licensed %} setInterval(function() { autoSaveSettings(); }, 60000); + {% endif %} }); function natCopyDomainToClipboard() { diff --git a/catalog/controller/module/promo_top_bar_nat.php b/catalog/controller/module/promo_top_bar_nat.php index 2c8d2de..fc58c76 100644 --- a/catalog/controller/module/promo_top_bar_nat.php +++ b/catalog/controller/module/promo_top_bar_nat.php @@ -63,7 +63,7 @@ class PromoTopBarNat extends \Opencart\System\Engine\Controller { } $lang_id = (int)$this->config->get('config_language_id'); - $server_url = $this->request->server['HTTPS'] ? HTTPS_SERVER : HTTP_SERVER; + $server_url = HTTP_SERVER; // Fetch settings $data['layout'] = $this->config->get('module_promo_top_bar_nat_layout') ?: 'standard'; @@ -640,12 +640,12 @@ class PromoTopBarNat extends \Opencart\System\Engine\Controller { 'link' => $slide_link, 'full_slide_link' => !empty($slide['full_slide_link']), 'weather' => $slide['weather_targeting'] ?? 'off', - 'show_close' => $slide['show_close'] ?? '1', + 'show_close' => $data['show_close'] ? ($slide['show_close'] ?? '1') : '0', 'show_desktop' => $slide['show_desktop'] ?? '1', 'show_mobile' => $slide['show_mobile'] ?? '1', - 'height' => $slide['height'] ?? '', - 'padding_top' => $slide['padding_top'] ?? '0', - 'padding_bottom' => $slide['padding_bottom'] ?? '0', + 'height' => !empty($slide['height']) ? $slide['height'] : $data['height'], + 'padding_top' => (!empty($slide['padding_top']) && (int)$slide['padding_top'] > 0) ? (int)$slide['padding_top'] : $data['padding_top'], + 'padding_bottom' => (!empty($slide['padding_bottom']) && (int)$slide['padding_bottom'] > 0) ? (int)$slide['padding_bottom'] : $data['padding_bottom'], 'marquee_status' => isset($slide['marquee_status']) ? (int)$slide['marquee_status'] : 0, 'marquee_speed' => isset($slide['marquee_speed']) ? (int)$slide['marquee_speed'] : 15, 'custom_css' => isset($slide['custom_css']) ? trim($slide['custom_css']) : '', diff --git a/catalog/view/template/module/promo_top_bar_nat.twig b/catalog/view/template/module/promo_top_bar_nat.twig index abded98..6a1a765 100644 --- a/catalog/view/template/module/promo_top_bar_nat.twig +++ b/catalog/view/template/module/promo_top_bar_nat.twig @@ -132,7 +132,7 @@ overflow: hidden; box-sizing: border-box; transition: all 0.3s ease; - {% if height %}height: {{ height }};{% endif %} + {% if height %}min-height: {{ height }};{% endif %} padding-top: {{ padding_top }}px; padding-bottom: {{ padding_bottom }}px; {% if border_radius %}border-radius: {{ border_radius }};{% endif %} @@ -581,9 +581,7 @@ data-padding-bottom="{{ slide.padding_bottom|default('0') }}" data-show-close="{{ slide.show_close|default('1') }}" style=" - height: {{ slide.height ?: height ?: 'auto' }}; - padding-top: {{ slide.padding_top|default('0') }}px; - padding-bottom: {{ slide.padding_bottom|default('0') }}px; + min-height: {{ slide.height ?: height ?: 'auto' }}; {% if slide.bg_type == 'pattern' and slide.bg_pattern %} background-image: url('{{ slide.bg_pattern }}'); background-repeat: repeat; {% elseif slide.bg_type == 'gradient' and slide.bg_gradient %} @@ -1272,7 +1270,9 @@ window.NAT_PROMO_SLIDER = (function() { var showClose = activeSlide.getAttribute('data-show-close') !== '0'; if (bar) { - bar.style.height = slideHeight ? slideHeight : ''; + if (slideHeight) { + bar.style.minHeight = slideHeight; + } bar.style.paddingTop = paddingTop + 'px'; bar.style.paddingBottom = paddingBottom + 'px'; } diff --git a/promo_top_bar_nat.ocmod.zip b/promo_top_bar_nat.ocmod.zip index 1dbd018..5d7aa86 100644 Binary files a/promo_top_bar_nat.ocmod.zip and b/promo_top_bar_nat.ocmod.zip differ