Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

DimaScorpio

Newbie
  
  • Posts

    2
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

DimaScorpio's Achievements

Newbie

Newbie (1/14)

  • First Post
  • Week One Done
  • One Month Later
  • One Year In
  • Conversation Starter

Recent Badges

0

Reputation

  1. по поиску только эти файлы я нашел о каком файле идет речь? search.twig {% macro renderSearchCategories(j3, categories, category_id, index) %} {% import _self as self %} {% for category in categories %} {% set classes = {'selected': category.category_id == category_id} %} <li data-category_id="{{ category.category_id }}" class="{{ j3.classes(classes) }} category-level-{{ index }}"><a>{{ category.title }}</a></li> {{ self.renderSearchCategories(j3, category.items, category_id, index + 1) }} {% endfor %} {% endmacro %} {% import _self as self %} {% if j3.settings.get('catalogSearchStatus') %} <div id="search" class="dropdown"> <button class="dropdown-toggle search-trigger" data-toggle="dropdown"></button> <div class="dropdown-menu j-dropdown"> <div class="header-search"> {% if j3.settings.get('searchStyleSearchCategoriesSelectorStatus') and categories %} <div class="search-categories dropdown drop-menu"> <div class="search-categories-button dropdown-toggle" data-toggle="dropdown">{{ category_id ? category : j3.settings.get('searchStyleSearchCategories') }}</div> <div class="dropdown-menu j-dropdown"> <ul class="j-menu"> <li data-category_id="0" class="category-level-1"><a>{{ j3.settings.get('searchStyleSearchCategories') }}</a></li> {{ self.renderSearchCategories(j3, categories, category_id, 1) }} </ul> </div> </div> {% endif %} <input type="text" name="search" value="{{ search }}" placeholder="{{ j3.settings.get('searchStyleSearchPlaceholder') }}" class="search-input" data-category_id="{{ category_id }}"/> </div> </div> </div> {% endif %}
  2. Привет всем Подскажите как реализовать поиск по статьям /index.php?route=information/information&information_id=8 обычный поиск ищет только по ссылкам /index.php?route=product/product&product_id=3 ниже код из search.php <?php use js3\js3\Controller; use js3\Utils\Arr; class Controllerjs3Search extends Controller { public function index() { $search = Arr::get($this->request->get, 'search'); $category_id = Arr::get($this->request->get, 'category_id'); $url = ''; if ($search) { $url .= '&search=' . urlencode(html_entity_decode($this->request->get['search'], ENT_QUOTES, 'UTF-8')); } $limit = (int)$this->js3->settings->get('searchStyleSearchAutoSuggestLimit'); if (!$limit) { $limit = 10; } $filter_data = array( 'filter_name' => $search, 'filter_description' => $this->js3->settings->get('searchStyleSearchAutoSuggestDescription'), 'start' => 0, 'limit' => $limit, ); if ($category_id) { $filter_data['filter_category_id'] = $category_id; } $this->load->model('js3/filter'); $this->load->model('js3/image'); $products = array(); $results = $this->model_js3_filter->getProducts($filter_data); foreach ($results as $result) { if ($result['image']) { $image = $this->model_js3_image->resize($result['image'], $this->js3->settings->get('image_dimensions_autosuggest.width'), $this->js3->settings->get('image_dimensions_autosuggest.height'), $this->js3->settings->get('image_dimensions_autosuggest.resize')); $image2 = $this->model_js3_image->resize($result['image'], $this->js3->settings->get('image_dimensions_autosuggest.width') * 2, $this->js3->settings->get('image_dimensions_autosuggest.height') * 2, $this->js3->settings->get('image_dimensions_autosuggest.resize')); } else { $image = $this->model_js3_image->resize('placeholder.png', $this->js3->settings->get('image_dimensions_autosuggest.width'), $this->js3->settings->get('image_dimensions_autosuggest.height'), $this->js3->settings->get('image_dimensions_autosuggest.resize')); $image2 = $this->model_js3_image->resize('placeholder.png', $this->js3->settings->get('image_dimensions_autosuggest.width') * 2, $this->js3->settings->get('image_dimensions_autosuggest.height') * 2, $this->js3->settings->get('image_dimensions_autosuggest.resize')); } $price = false; $special = false; if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) { $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')), $this->session->data['currency']); } } $products[] = array( 'quantity' => (int)$result['quantity'], 'price_value' => $result['special'] ? $result['special'] > 0 : $result['price'] > 0, 'product_id' => $result['product_id'], 'name' => html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'), 'thumb' => $image, 'thumb2' => $image2, 'price' => $price, 'special' => $special, 'href' => $this->url->link('product/product', '&search=' . urlencode(html_entity_decode($this->request->get['search'], ENT_QUOTES, 'UTF-8')) . '&product_id=' . $result['product_id'] . $url), ); } if ($products) { $url = ''; if (isset($this->request->get['search'])) { $url .= '&search=' . urlencode(html_entity_decode($this->request->get['search'], ENT_QUOTES, 'UTF-8')); } if ($this->js3->settings->get('searchStyleSearchAutoSuggestDescription')) { $url .= '&description=true'; } if (isset($this->request->get['category_id'])) { $url .= '&category_id=' . $this->request->get['category_id']; } if (isset($this->request->get['sub_category'])) { $url .= '&sub_category=' . $this->request->get['sub_category']; } $products[] = array( 'view_more' => true, 'name' => $this->js3->settings->get('searchStyleSearchViewMoreText'), 'href' => $this->url->link('product/search', $url), ); } else { $products[] = array( 'no_results' => true, 'name' => $this->js3->settings->get('searchStyleSearchNoResultsText'), ); } $this->renderJson('success', $products); } } вот кусочек кода еще из js // Search var $search = $('#search').find('input[name=\'search\']'); $('.search-button').on('click', function () { var url = $(this).data('search-url'); var value = $search.val(); var category_id = parseInt($search.attr('data-category_id')); if (value) { url += encodeURIComponent(value); } if (js['searchStyleSearchAutoSuggestDescription']) { url += '&description=true'; } if (category_id) { url += '&category_id=' + category_id; } location = url; }); $search.on('keydown', function (e) { if (e.keyCode === 13) { $('.search-button').trigger('click'); } }); $('.search-categories li').on('click', function (e) { e.stopPropagation(); var $this = $(this); $('.search-categories-button').html($this.html()); $search.attr('data-category_id', $this.attr('data-category_id')) }); // Autosuggest if (js['searchStyleSearchAutoSuggestStatus']) { $search.typeahead({ hint: true, minLength: 1, autoSelect: true }, { async: true, display: 'name', limit: Infinity, source: function (query, processSync, processAsync) { var data = { search: query }; var category_id = parseInt($search.attr('data-category_id')); if (category_id) { data.category_id = category_id; } return $.ajax({ url: 'index.php?route=js3/search', data: data, dataType: 'json', success: function (json) { return processAsync(json['response']); } }); }, templates: { suggestion: function (data) { if (data['view_more']) { return '<div class="search-result view-more"><a href="' + data['href'] + '">' + data['name'] + '</a></div>'; } if (data['no_results']) { return '<div class="search-result no-results"><a>' + data['name'] + '</a></div>'; } var html = ''; html += '<div class="search-result"><a href="' + data['href'] + '">'; if (data['thumb']) { html += '<img src="' + data['thumb'] + '" srcset="' + data['thumb'] + ' 1x, ' + data['thumb2'] + ' 2x" />'; } var classes = []; if (data['quantity'] <= 0) { classes.push('out-of-stock'); } if (!data['price_value']) { classes.push('has-zero-price'); } html += '<span class="' + classes.join(' ') + '">'; html += '<span class="product-name">' + data['name'] + '</span>'; if (data['price']) { if (data['special']) { html += '<span><span class="price-old">' + data['price'] + '</span><span class="price-new">' + data['special'] + '</span></span>'; } else { html += '<span class="price">' + data['price'] + '</span>'; } } html += '</span>'; html += '</a></div>'; return html; } } }); $('.header-search > span > div').addClass('.tt-empty'); Меняя с product_id на information_id Поиск ни чего не видит Если есть такой модуль по поиску описания в товарах , статьях , производителя и тд дайте знать
×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.