Сам поиск работает, но не фильтрует по категориям. Много вариантов перепробовал с filter_category_id, но решения не нашёл, потому что в кодах не разбираюсь vqmod/vqcache Код: <?php $this->language->load('module/univertheme'); $button_quick = $this->language->get('entry_quickview'); $this->language->load('module/fast_order'); $text_order = $this->language->get('text_order'); ?> <?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?> <div id="content"><?php echo $content_top; ?> <div class="breadcrumb"> <?php foreach ($breadcrumbs as $i=> $breadcrumb) { ?> <?php echo $breadcrumb['separator']; ?><?php if($i+1<count($breadcrumbs)) { ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a> <?php } else { ?><?php echo $breadcrumb['text']; ?><?php } ?> <?php } ?> </div> <h1><?php echo $heading_title; ?></h1> <div class="box-search"> <b><?php echo $text_critea; ?></b> <div class="content"> <?php echo $entry_search; ?> <?php if ($search) { ?> <input type="text" name="search" size="50" value="<?php echo $search; ?>" /> <?php } else { ?> <input type="text" name="search" size="50" value="<?php echo $search; ?>" onclick="this.value = '';" onkeydown="this.style.color = '000000'" style="color: #999;" /> <?php } ?> <select name="filter_category_id"> <option value="0"><?php echo $text_category; ?></option> <?php foreach ($categories as $category_1) { ?> <?php if ($category_1['category_id'] == $filter_category_id) { ?> <option value="<?php echo $category_1['category_id']; ?>" selected="selected"><?php echo $category_1['name']; ?></option> <?php } else { ?> <option value="<?php echo $category_1['category_id']; ?>"><?php echo $category_1['name']; ?></option> <?php } ?> <?php foreach ($category_1['children'] as $category_2) { ?> <?php if ($category_2['category_id'] == $filter_category_id) { ?> <option value="<?php echo $category_2['category_id']; ?>" selected="selected"> <?php echo $category_2['name']; ?></option> <?php } else { ?> <option value="<?php echo $category_2['category_id']; ?>"> <?php echo $category_2['name']; ?></option> <?php } ?> <?php foreach ($category_2['children'] as $category_3) { ?> <?php if ($category_3['category_id'] == $filter_category_id) { ?> <option value="<?php echo $category_3['category_id']; ?>" selected="selected"> <?php echo $category_3['name']; ?></option> <?php } else { ?> <option value="<?php echo $category_3['category_id']; ?>"> <?php echo $category_3['name']; ?></option> <?php } ?> <?php } ?> <?php } ?> <?php } ?> </select> <?php if ($sub_category) { ?> <input type="checkbox" name="sub_category" value="1" id="sub_category" checked="checked" /> <?php } else { ?> <input type="checkbox" name="sub_category" value="1" id="sub_category" /> <?php } ?> <label for="sub_category"><?php echo $text_sub_category; ?></label> <?php if ($description) { ?> <input type="checkbox" name="description" value="1" id="description" checked="checked" /> <?php } else { ?> <input type="checkbox" name="description" value="1" id="description" /> <?php } ?> <label for="description"><?php echo $entry_description; ?></label> </div> <div class="buttons"> <div class="right"><input type="button" value="<?php echo $button_search; ?>" id="button-search" class="button" /></div> </div> </div> <h2><?php echo $text_search; ?></h2> <?php if ($products) { ?> <div class="product-filter"> <div class="display"><b><?php echo $text_display; ?></b> <?php echo $text_list; ?> <b>/</b> <a onclick="display('grid');"><?php echo $text_grid; ?></a></div> <div class="limit"><?php echo $text_limit; ?> <select onchange="location = this.value;" class="select1"> <?php foreach ($limits as $limits) { ?> <?php if ($limits['value'] == $limit) { ?> <option value="<?php echo $limits['href']; ?>" selected="selected"><?php echo $limits['text']; ?></option> <?php } else { ?> <option value="<?php echo $limits['href']; ?>"><?php echo $limits['text']; ?></option> <?php } ?> <?php } ?> </select> </div> <div class="sort"> <select onchange="location = this.value;" class="select1"> <?php foreach ($sorts as $sorts) { ?> <?php if ($sorts['value'] == $sort . '-' . $order) { ?> <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option> <?php } else { ?> <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option> <?php } ?> <?php } ?> </select> </div> <?php if ($this->config->get('show_compare') == '1') { ?> <div class="product-compare"><a href="<?php echo $compare; ?>" id="compare-total"><div></div><?php echo $text_compare; ?></a></div> <?php } ?> </div> <div class="product-list"> <?php foreach ($products as $product) { ?> <div class="item"> <?php if ($product['thumb']) { ?> <div class="image"><a href="<?php echo $product['href']; ?>" data-image="<?php echo $product['thumb']; ?>"> <img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" > </a></div> <?php } ?> <?php if ($product['special']) { if (isset($product['saving'])) { ?> <div class="savemoney">- <?php echo $product['saving']; ?>%</div> <?php }} ?> <div class="hover_but"> <?php if ($this->config->get('show_compare') == '1') { ?> <div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');" title="<?php echo $button_compare; ?>"><?php echo $button_compare; ?></a></div> <?php } ?> <?php if ((isset($product['quickview'])) && ($this->config->get('quick_view') == '1')) { ?> <div class="quickviewbutton"><a class='quickview' href="<?php echo $product['quickview']; ?>" title="<?php echo $button_quick; ?>"><?php echo $button_quick; ?></a></div> <?php } ?> </div> <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div> <div class="description"><?php echo $product['description']; ?></div> <?php if ($product['price']) { ?> <div class="price"> <?php if (!$product['special']) { ?> <?php echo $product['price']; ?> <?php } else { ?> <span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span> <?php } ?> <?php if ($product['tax']) { ?> <br /> <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span> <?php } ?> </div> <?php } ?> <div class="cart"> <input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" /> </div> <?php if ($this->config->get('config_review_status')) { ?> <div class="rating"><img src="catalog/view/theme/univer/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div> <?php } ?> <?php if ((isset($product['dop_img'])) && ($this->config->get('img_additional2') == '1') && ($product['thumb']) ) { ?> <?php $i=1; if ($product['dop_img']) { ?> <div class="owl-addimagecat owl-carousel"> <div data-index="0"> <a href="<?php echo $product['href']; ?>" title="<?php echo $product['name']; ?>" data-image="<?php echo $product['thumb']; ?>"> <img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" ></a> </div> <?php foreach ($product['dop_img'] as $key => $img) { ?> <div data-index="<?php echo $i; ?>" class="image<?php echo $key;?>"> <a href="<?php echo $product['href']; ?>" title="<?php echo $product['name']; ?>" data-image="<?php echo $img; ?>"> <img src="<?php echo $img;?>" alt="<?php echo $product['name']; ?>"></a> </div> <?php $i++; } ?> </div> <?php } ?> <?php } ?> </div> <?php } ?> </div> <div class="pagination"><?php echo $pagination; ?></div> <?php } else { ?> <div class="content"><?php echo $text_empty; ?></div> <?php }?></div> <div class="cont_bottom"></div> <?php echo $content_bottom; ?> <script type="text/javascript"><!-- $('#content input[name=\'search\']').keydown(function(e) { if (e.keyCode == 13) { $('#button-search').trigger('click'); } }); $('select[name=\'filter_category_id\']').bind('change', function() { if (this.value == '0') { $('input[name=\'sub_category\']').attr('disabled', 'disabled'); $('input[name=\'sub_category\']').removeAttr('checked'); } else { $('input[name=\'sub_category\']').removeAttr('disabled'); } }); $('select[name=\'filter_category_id\']').trigger('change'); $('#button-search').bind('click', function() { url = 'index.php?route=product/search'; var search = $('#content input[name=\'search\']').attr('value'); if (search) { url += '&search=' + encodeURIComponent(search); } var filter_category_id = $('#content select[name=\'filter_category_id\']').attr('value'); if (filter_category_id > 0) { url += '&filter_category_id=' + encodeURIComponent(filter_category_id); } var sub_category = $('#content input[name=\'sub_category\']:checked').attr('value'); if (sub_category) { url += '&sub_category=true'; } var filter_description = $('#content input[name=\'description\']:checked').attr('value'); if (filter_description) { url += '&description=true'; } location = url; }); function display(view) { if (view == 'list') { $('.product-grid').attr('class', 'product-list'); $('.product-list > div').each(function(index, element) { html = '<div class="left">'; <?php if ((isset($product['quickview'])) && ($this->config->get('quick_view') == '1')) { ?> html += ' <div class="quickviewbutton">' + $(element).find('.quickviewbutton').html() + '</div>'; <?php } ?> var savemoney = $(element).find('.savemoney').html(); if (savemoney != null) { html += '<div class="savemoney">' + savemoney + '</div>'; } <?php if ($this->config->get('img_additional2') == '1') { ?> html += '<div class="owl-addimagecat owl-carousel">'; <?php } ?> var image = $(element).find('.image').html(); if (image != null) { html += '<div class="image">' + image + '</div>'; } <?php if ($this->config->get('img_additional2') == '1') { for ($key = 0; $key < 3; $key++) { ?> var image2 = $(element).find('.image<?php echo $key;?>').html(); if (image2 != null) { html += ' <div class="image image<?php echo $key;?>">' + image2 + '</div>'; } <?php } ?> html += '</div>'; <?php } ?> html += '</div>'; html += '<div class="centr">'; html += ' <div class="name">' + $(element).find('.name').html() + '</div>'; html += '<div class="right">'; var price = $(element).find('.price').html(); if (price != null) { html += '<div class="price">' + price + '</div>'; } html += ' <div class="cart">' + $(element).find('.cart').html() + '</div>'; html += '</div>'; var rating = $(element).find('.rating').html(); if (rating != null) { html += '<div class="rating">' + rating + '</div>'; } html += ' <div class="description">' + $(element).find('.description').html() + '</div>'; <?php if ($this->config->get('univer_fastorder') == '1') { ?> html += ' <div class="singleclick_wrapper"><a class="singleclick" title="<?php echo $text_order; ?>"><?php echo $text_order; ?></a></div>'; <?php } ?> <?php if ($this->config->get('show_compare') == '1') { ?> html += ' <div class="compare">' + $(element).find('.compare').html() + '</div>'; <?php } ?> html += '</div>'; $(element).html(html); }); $(".owl-addimagecat").owlCarousel({ navigation : true, pagination : false, singleItem : true }); $('.display').html('<span class="iconlist"></span> <a onclick="display(\'grid\');" class="icongrid"></a>'); $.totalStorage('display', 'list'); } else { $('.product-list').attr('class', 'product-grid'); $('.product-grid > div').each(function(index, element) { html = ''; <?php if ($this->config->get('img_additional2') == '1') { ?> var image0 = $(element).find('.image0').html(); if (image0 != null) { html += ' <div class="owl_modul">'; html += '<div data-index="0">'; var image = $(element).find('.image').html(); if (image != null) { html += image; } html += '</div>'; <?php $i= 1; for ($key = 0; $key < 3; $key++) { ?> var image2 = $(element).find('.image<?php echo $key;?>').html(); if (image2 != null) { html += ' <div data-index="<?php echo $i;?>" class="image<?php echo $key;?>">' + image2 + '</div>'; } <?php $i++; } ?> } html += '</div>'; <?php } ?> html += '<div class=imgbut>'; var image = $(element).find('.image').html(); if (image != null) { html += '<div class="image">' + image + '</div>'; } <?php if ((isset($product['quickview'])) && ($this->config->get('quick_view') == '1')) { ?> html += ' <div class="quickviewbutton">' + $(element).find('.quickviewbutton').html() + '</div>'; <?php } ?> html += '</div>'; var savemoney = $(element).find('.savemoney').html(); if (savemoney != null) { html += '<div class="savemoney">' + savemoney + '</div>'; } html += '<div class="name">' + $(element).find('.name').html() + '</div>'; html += ' <div class="description">' + $(element).find('.description').html() + '</div>'; var price = $(element).find('.price').html(); if (price != null) { html += '<div class="price">' + price + '</div>'; } html += '<div class="cart">' + $(element).find('.cart').html() + '</div>'; html += ' <div class="hover_but">'; <?php if ($this->config->get('univer_fastorder') == '1') { ?> html += ' <div class="singleclick_wrapper"><a class="singleclick" title="<?php echo $text_order; ?>"><?php echo $text_order; ?></a></div>'; <?php } ?> <?php if ($this->config->get('show_compare') == '1') { ?> html += ' <div class="compare">' + $(element).find('.compare').html() + '</div>'; <?php } ?> html += '</div>'; var rating = $(element).find('.rating').html(); if (rating != null) { html += '<div class="rating">' + rating + '</div>'; } $(element).html(html); }); $(".owl-addimagecat").owlCarousel({ navigation : true, pagination : false, items : 3, itemsDesktop : false, itemsDesktopSmall: false, itemsTablet :false, itemsMobile: false, }); $('.item').hover(function(){ var $gallery = $(this); $('.owl_modul div a',$gallery).hover(function(){ $('.owl_modul div',$gallery).removeClass('active'); $(this).parent().addClass('active'); $('.image img',$gallery).attr('src', $(this).attr('data-image'));}); $('.owl_modul div:first',$gallery).addClass('active'); if ( $('.owl_modul',$gallery).parents('.item').length ) { $gallery.addClass('itemwd')}; }); $('.display').html('<a onclick="display(\'list\');" class="iconlist"></a> <span class="icongrid"></span>'); $.totalStorage('display', 'grid'); } } view = $.totalStorage('display'); if (view) { display(view); } else { display('grid'); } //--></script> <?php echo $footer; ?> <?php require 'catalog/view/theme/univer/template/module/singleclick.tpl'; ?> search.tpl Код: <?php $this->language->load('module/univertheme'); $button_quick = $this->language->get('entry_quickview'); $this->language->load('module/fast_order'); $text_order = $this->language->get('text_order'); ?> <?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?> <div id="content"><?php echo $content_top; ?> <div class="breadcrumb"> <?php foreach ($breadcrumbs as $breadcrumb) { ?> <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a> <?php } ?> </div> <h1><?php echo $heading_title; ?></h1> <div class="box-search"> <b><?php echo $text_critea; ?></b> <div class="content"> <?php echo $entry_search; ?> <?php if ($search) { ?> <input type="text" name="search" size="50" value="<?php echo $search; ?>" /> <?php } else { ?> <input type="text" name="search" size="50" value="<?php echo $search; ?>" onclick="this.value = '';" onkeydown="this.style.color = '000000'" style="color: #999;" /> <?php } ?> <select name="filter_category_id"> <option value="0"><?php echo $text_category; ?></option> <?php foreach ($categories as $category_1) { ?> <?php if ($category_1['category_id'] == $filter_category_id) { ?> <option value="<?php echo $category_1['category_id']; ?>" selected="selected"><?php echo $category_1['name']; ?></option> <?php } else { ?> <option value="<?php echo $category_1['category_id']; ?>"><?php echo $category_1['name']; ?></option> <?php } ?> <?php foreach ($category_1['children'] as $category_2) { ?> <?php if ($category_2['category_id'] == $filter_category_id) { ?> <option value="<?php echo $category_2['category_id']; ?>" selected="selected"> <?php echo $category_2['name']; ?></option> <?php } else { ?> <option value="<?php echo $category_2['category_id']; ?>"> <?php echo $category_2['name']; ?></option> <?php } ?> <?php foreach ($category_2['children'] as $category_3) { ?> <?php if ($category_3['category_id'] == $filter_category_id) { ?> <option value="<?php echo $category_3['category_id']; ?>" selected="selected"> <?php echo $category_3['name']; ?></option> <?php } else { ?> <option value="<?php echo $category_3['category_id']; ?>"> <?php echo $category_3['name']; ?></option> <?php } ?> <?php } ?> <?php } ?> <?php } ?> </select> <?php if ($sub_category) { ?> <input type="checkbox" name="sub_category" value="1" id="sub_category" checked="checked" /> <?php } else { ?> <input type="checkbox" name="sub_category" value="1" id="sub_category" /> <?php } ?> <label for="sub_category"><?php echo $text_sub_category; ?></label> <?php if ($description) { ?> <input type="checkbox" name="description" value="1" id="description" checked="checked" /> <?php } else { ?> <input type="checkbox" name="description" value="1" id="description" /> <?php } ?> <label for="description"><?php echo $entry_description; ?></label> </div> <div class="buttons"> <div class="right"><input type="button" value="<?php echo $button_search; ?>" id="button-search" class="button" /></div> </div> </div> <h2><?php echo $text_search; ?></h2> <?php if ($products) { ?> <div class="product-filter"> <div class="display"><b><?php echo $text_display; ?></b> <?php echo $text_list; ?> <b>/</b> <a onclick="display('grid');"><?php echo $text_grid; ?></a></div> <div class="limit"><?php echo $text_limit; ?> <select onchange="location = this.value;" class="select1"> <?php foreach ($limits as $limits) { ?> <?php if ($limits['value'] == $limit) { ?> <option value="<?php echo $limits['href']; ?>" selected="selected"><?php echo $limits['text']; ?></option> <?php } else { ?> <option value="<?php echo $limits['href']; ?>"><?php echo $limits['text']; ?></option> <?php } ?> <?php } ?> </select> </div> <div class="sort"> <select onchange="location = this.value;" class="select1"> <?php foreach ($sorts as $sorts) { ?> <?php if ($sorts['value'] == $sort . '-' . $order) { ?> <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option> <?php } else { ?> <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option> <?php } ?> <?php } ?> </select> </div> <?php if ($this->config->get('show_compare') == '1') { ?> <div class="product-compare"><a href="<?php echo $compare; ?>" id="compare-total"><div></div><?php echo $text_compare; ?></a></div> <?php } ?> </div> <div class="product-list"> <?php foreach ($products as $product) { ?> <div class="item"> <?php if ($product['thumb']) { ?> <div class="image"><a href="<?php echo $product['href']; ?>" data-image="<?php echo $product['thumb']; ?>"> <img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" > </a></div> <?php } ?> <?php if ($product['special']) { if (isset($product['saving'])) { ?> <div class="savemoney">- <?php echo $product['saving']; ?>%</div> <?php }} ?> <div class="hover_but"> <?php if ($this->config->get('show_compare') == '1') { ?> <div class="compare"><a onclick="addToCompare('<?php echo $product['product_id']; ?>');" title="<?php echo $button_compare; ?>"><?php echo $button_compare; ?></a></div> <?php } ?> <?php if ((isset($product['quickview'])) && ($this->config->get('quick_view') == '1')) { ?> <div class="quickviewbutton"><a class='quickview' href="<?php echo $product['quickview']; ?>" title="<?php echo $button_quick; ?>"><?php echo $button_quick; ?></a></div> <?php } ?> </div> <div class="name"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></div> <div class="description"><?php echo $product['description']; ?></div> <?php if ($product['price']) { ?> <div class="price"> <?php if (!$product['special']) { ?> <?php echo $product['price']; ?> <?php } else { ?> <span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span> <?php } ?> <?php if ($product['tax']) { ?> <br /> <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span> <?php } ?> </div> <?php } ?> <div class="cart"> <input type="button" value="<?php echo $button_cart; ?>" onclick="addToCart('<?php echo $product['product_id']; ?>');" class="button" /> </div> <?php if ($this->config->get('config_review_status')) { ?> <div class="rating"><img src="catalog/view/theme/univer/image/stars-<?php echo $product['rating']; ?>.png" alt="<?php echo $product['reviews']; ?>" /></div> <?php } ?> <?php if ((isset($product['dop_img'])) && ($this->config->get('img_additional2') == '1') && ($product['thumb']) ) { ?> <?php $i=1; if ($product['dop_img']) { ?> <div class="owl-addimagecat owl-carousel"> <div data-index="0"> <a href="<?php echo $product['href']; ?>" title="<?php echo $product['name']; ?>" data-image="<?php echo $product['thumb']; ?>"> <img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" ></a> </div> <?php foreach ($product['dop_img'] as $key => $img) { ?> <div data-index="<?php echo $i; ?>" class="image<?php echo $key;?>"> <a href="<?php echo $product['href']; ?>" title="<?php echo $product['name']; ?>" data-image="<?php echo $img; ?>"> <img src="<?php echo $img;?>" alt="<?php echo $product['name']; ?>"></a> </div> <?php $i++; } ?> </div> <?php } ?> <?php } ?> </div> <?php } ?> </div> <div class="pagination"><?php echo $pagination; ?></div> <?php } else { ?> <div class="content"><?php echo $text_empty; ?></div> <?php }?></div> <div class="cont_bottom"></div> <?php echo $content_bottom; ?> <script type="text/javascript"><!-- $('#content input[name=\'search\']').keydown(function(e) { if (e.keyCode == 13) { $('#button-search').trigger('click'); } }); $('select[name=\'filter_category_id\']').bind('change', function() { if (this.value == '0') { $('input[name=\'sub_category\']').attr('disabled', 'disabled'); $('input[name=\'sub_category\']').removeAttr('checked'); } else { $('input[name=\'sub_category\']').removeAttr('disabled'); } }); $('select[name=\'filter_category_id\']').trigger('change'); $('#button-search').bind('click', function() { url = 'index.php?route=product/search'; var search = $('#content input[name=\'search\']').attr('value'); if (search) { url += '&search=' + encodeURIComponent(search); } var filter_category_id = $('#content select[name=\'filter_category_id\']').attr('value'); if (filter_category_id > 0) { url += '&filter_category_id=' + encodeURIComponent(filter_category_id); } var sub_category = $('#content input[name=\'sub_category\']:checked').attr('value'); if (sub_category) { url += '&sub_category=true'; } var filter_description = $('#content input[name=\'description\']:checked').attr('value'); if (filter_description) { url += '&description=true'; } location = url; }); function display(view) { if (view == 'list') { $('.product-grid').attr('class', 'product-list'); $('.product-list > div').each(function(index, element) { html = '<div class="left">'; <?php if ((isset($product['quickview'])) && ($this->config->get('quick_view') == '1')) { ?> html += ' <div class="quickviewbutton">' + $(element).find('.quickviewbutton').html() + '</div>'; <?php } ?> var savemoney = $(element).find('.savemoney').html(); if (savemoney != null) { html += '<div class="savemoney">' + savemoney + '</div>'; } <?php if ($this->config->get('img_additional2') == '1') { ?> html += '<div class="owl-addimagecat owl-carousel">'; <?php } ?> var image = $(element).find('.image').html(); if (image != null) { html += '<div class="image">' + image + '</div>'; } <?php if ($this->config->get('img_additional2') == '1') { for ($key = 0; $key < 3; $key++) { ?> var image2 = $(element).find('.image<?php echo $key;?>').html(); if (image2 != null) { html += ' <div class="image image<?php echo $key;?>">' + image2 + '</div>'; } <?php } ?> html += '</div>'; <?php } ?> html += '</div>'; html += '<div class="centr">'; html += ' <div class="name">' + $(element).find('.name').html() + '</div>'; html += '<div class="right">'; var price = $(element).find('.price').html(); if (price != null) { html += '<div class="price">' + price + '</div>'; } html += ' <div class="cart">' + $(element).find('.cart').html() + '</div>'; html += '</div>'; var rating = $(element).find('.rating').html(); if (rating != null) { html += '<div class="rating">' + rating + '</div>'; } html += ' <div class="description">' + $(element).find('.description').html() + '</div>'; <?php if ($this->config->get('univer_fastorder') == '1') { ?> html += ' <div class="singleclick_wrapper"><a class="singleclick" title="<?php echo $text_order; ?>"><?php echo $text_order; ?></a></div>'; <?php } ?> <?php if ($this->config->get('show_compare') == '1') { ?> html += ' <div class="compare">' + $(element).find('.compare').html() + '</div>'; <?php } ?> html += '</div>'; $(element).html(html); }); $(".owl-addimagecat").owlCarousel({ navigation : true, pagination : false, singleItem : true }); $('.display').html('<span class="iconlist"></span> <a onclick="display(\'grid\');" class="icongrid"></a>'); $.totalStorage('display', 'list'); } else { $('.product-list').attr('class', 'product-grid'); $('.product-grid > div').each(function(index, element) { html = ''; <?php if ($this->config->get('img_additional2') == '1') { ?> var image0 = $(element).find('.image0').html(); if (image0 != null) { html += ' <div class="owl_modul">'; html += '<div data-index="0">'; var image = $(element).find('.image').html(); if (image != null) { html += image; } html += '</div>'; <?php $i= 1; for ($key = 0; $key < 3; $key++) { ?> var image2 = $(element).find('.image<?php echo $key;?>').html(); if (image2 != null) { html += ' <div data-index="<?php echo $i;?>" class="image<?php echo $key;?>">' + image2 + '</div>'; } <?php $i++; } ?> } html += '</div>'; <?php } ?> html += '<div class=imgbut>'; var image = $(element).find('.image').html(); if (image != null) { html += '<div class="image">' + image + '</div>'; } <?php if ((isset($product['quickview'])) && ($this->config->get('quick_view') == '1')) { ?> html += ' <div class="quickviewbutton">' + $(element).find('.quickviewbutton').html() + '</div>'; <?php } ?> html += '</div>'; var savemoney = $(element).find('.savemoney').html(); if (savemoney != null) { html += '<div class="savemoney">' + savemoney + '</div>'; } html += '<div class="name">' + $(element).find('.name').html() + '</div>'; html += ' <div class="description">' + $(element).find('.description').html() + '</div>'; var price = $(element).find('.price').html(); if (price != null) { html += '<div class="price">' + price + '</div>'; } html += '<div class="cart">' + $(element).find('.cart').html() + '</div>'; html += ' <div class="hover_but">'; <?php if ($this->config->get('univer_fastorder') == '1') { ?> html += ' <div class="singleclick_wrapper"><a class="singleclick" title="<?php echo $text_order; ?>"><?php echo $text_order; ?></a></div>'; <?php } ?> <?php if ($this->config->get('show_compare') == '1') { ?> html += ' <div class="compare">' + $(element).find('.compare').html() + '</div>'; <?php } ?> html += '</div>'; var rating = $(element).find('.rating').html(); if (rating != null) { html += '<div class="rating">' + rating + '</div>'; } $(element).html(html); }); $(".owl-addimagecat").owlCarousel({ navigation : true, pagination : false, items : 3, itemsDesktop : false, itemsDesktopSmall: false, itemsTablet :false, itemsMobile: false, }); $('.item').hover(function(){ var $gallery = $(this); $('.owl_modul div a',$gallery).hover(function(){ $('.owl_modul div',$gallery).removeClass('active'); $(this).parent().addClass('active'); $('.image img',$gallery).attr('src', $(this).attr('data-image'));}); $('.owl_modul div:first',$gallery).addClass('active'); if ( $('.owl_modul',$gallery).parents('.item').length ) { $gallery.addClass('itemwd')}; }); $('.display').html('<a onclick="display(\'list\');" class="iconlist"></a> <span class="icongrid"></span>'); $.totalStorage('display', 'grid'); } } view = $.totalStorage('display'); if (view) { display(view); } else { display('grid'); } //--></script> <?php echo $footer; ?> <?php require 'catalog/view/theme/univer/template/module/singleclick.tpl'; ?> search.php Код: <?php class ControllerProductSearch extends Controller { public function index() { $this->language->load('product/search'); $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); if (isset($this->request->get['search'])) { $search = $this->request->get['search']; } else { $search = ''; } if (isset($this->request->get['tag'])) { $tag = $this->request->get['tag']; } elseif (isset($this->request->get['search'])) { $tag = $this->request->get['search']; } else { $tag = ''; } if (isset($this->request->get['description'])) { $description = $this->request->get['description']; } else { $description = ''; } if (isset($this->request->get['category_id'])) { $category_id = $this->request->get['category_id']; } else { $category_id = 0; } if (isset($this->request->get['sub_category'])) { $sub_category = $this->request->get['sub_category']; } else { $sub_category = ''; } if (isset($this->request->get['sort'])) { $sort = $this->request->get['sort']; } else { $sort = 'p.sort_order'; } if (isset($this->request->get['order'])) { $order = $this->request->get['order']; } else { $order = 'ASC'; } if (isset($this->request->get['page'])) { $page = $this->request->get['page']; } else { $page = 1; } if (isset($this->request->get['limit'])) { $limit = $this->request->get['limit']; } else { $limit = $this->config->get('config_catalog_limit'); } if (isset($this->request->get['search'])) { $this->document->setTitle($this->language->get('heading_title') . ' - ' . $this->request->get['search']); } else { $this->document->setTitle($this->language->get('heading_title')); } $this->document->setRobots('noindex,follow'); $this->document->addScript('catalog/view/javascript/jquery/jquery.total-storage.min.js'); $this->document->addScript('catalog/view/javascript/jquery/jail/jail.min.js'); $this->data['breadcrumbs'] = array(); $this->data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false ); $url = ''; if (isset($this->request->get['search'])) { $url .= '&search=' . urlencode(html_entity_decode($this->request->get['search'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['tag'])) { $url .= '&tag=' . urlencode(html_entity_decode($this->request->get['tag'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['description'])) { $url .= '&description=' . $this->request->get['description']; } 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']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['page'])) { $url .= '&page=' . $this->request->get['page']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $this->data['breadcrumbs'][] = array( 'text' => $this->language->get('heading_title'), 'href' => $this->url->link('product/search', $url), 'separator' => $this->language->get('text_separator') ); if (isset($this->request->get['search'])) { $this->data['heading_title'] = $this->language->get('heading_title') . ' - ' . $this->request->get['search']; } else { $this->data['heading_title'] = $this->language->get('heading_title'); } $this->document->setRobots('noindex,follow'); $this->data['text_empty'] = $this->language->get('text_empty'); $this->data['text_critea'] = $this->language->get('text_critea'); $this->data['text_search'] = $this->language->get('text_search'); $this->data['text_keyword'] = $this->language->get('text_keyword'); $this->data['text_category'] = $this->language->get('text_category'); $this->data['text_sub_category'] = $this->language->get('text_sub_category'); $this->data['text_quantity'] = $this->language->get('text_quantity'); $this->data['text_manufacturer'] = $this->language->get('text_manufacturer'); $this->data['text_model'] = $this->language->get('text_model'); $this->data['text_price'] = $this->language->get('text_price'); $this->data['text_tax'] = $this->language->get('text_tax'); $this->data['text_points'] = $this->language->get('text_points'); $this->data['text_compare'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0)); $this->data['text_display'] = $this->language->get('text_display'); $this->data['text_list'] = $this->language->get('text_list'); $this->data['text_grid'] = $this->language->get('text_grid'); $this->data['text_sort'] = $this->language->get('text_sort'); $this->data['text_limit'] = $this->language->get('text_limit'); $this->data['text_benefits'] = $this->language->get('text_benefits'); $this->data['entry_search'] = $this->language->get('entry_search'); $this->data['entry_description'] = $this->language->get('entry_description'); $this->data['button_search'] = $this->language->get('button_search'); $this->data['button_cart'] = $this->language->get('button_cart'); $this->data['button_wishlist'] = $this->language->get('button_wishlist'); $this->data['button_compare'] = $this->language->get('button_compare'); $this->data['compare'] = $this->url->link('product/compare'); $this->load->model('catalog/category'); // 3 Level Category Search $this->data['categories'] = array(); $categories_1 = $this->model_catalog_category->getCategories(0); foreach ($categories_1 as $category_1) { $level_2_data = array(); $categories_2 = $this->model_catalog_category->getCategories($category_1['category_id']); foreach ($categories_2 as $category_2) { $level_3_data = array(); $categories_3 = $this->model_catalog_category->getCategories($category_2['category_id']); foreach ($categories_3 as $category_3) { $level_3_data[] = array( 'category_id' => $category_3['category_id'], 'name' => $category_3['name'], ); } $level_2_data[] = array( 'category_id' => $category_2['category_id'], 'name' => $category_2['name'], 'children' => $level_3_data ); } $this->data['categories'][] = array( 'category_id' => $category_1['category_id'], 'name' => $category_1['name'], 'children' => $level_2_data ); } $this->data['products'] = array(); if (isset($this->request->get['search']) || isset($this->request->get['tag'])) { $data = array( 'filter_name' => $search, 'filter_tag' => $tag, 'filter_description' => $description, 'category_id' => $category_id, 'sub_category' => $sub_category, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit ); $product_total = $this->model_catalog_product->getTotalProducts($data); $results = $this->model_catalog_product->getProducts($data); foreach ($results as $result) { if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')); $imagewidth = $this->config->get('config_image_product_width'); $imageheight = $this->config->get('config_image_product_height'); } else { $image = false; $imagewidth = ''; $imageheight = ''; } if (($this->config->get('config_customer_price') && $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'))); } else { $price = false; } if ((float)$result['special']) { $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax'))); } else { $special = false; } if ($this->config->get('config_tax')) { $tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price']); } else { $tax = false; } if ($this->config->get('config_review_status')) { $rating = (int)$result['rating']; } else { $rating = false; } $stickers = $this->getStickers($result['product_id']) ; //ocshop benefits $productbenefits = $this->model_catalog_product->getProductBenefitsbyProductId($result['product_id']); $benefits = array(); foreach ($productbenefits as $benefit) { if ($benefit['image'] && file_exists(DIR_IMAGE . $benefit['image'])) { $bimage = $benefit['image']; if ($benefit['type']) { $bimage = $this->model_tool_image->resize($bimage, 25, 25); } else { $bimage = $this->model_tool_image->resize($bimage, 120, 60); } } else { $bimage = 'no_image.jpg'; } $benefits[] = array( 'benefit_id' => $benefit['benefit_id'], 'name' => $benefit['name'], 'description' => strip_tags(html_entity_decode($benefit['description'])), 'thumb' => $bimage, 'link' => $benefit['link'], 'type' => $benefit['type'] //'sort_order' => $benefit['sort_order'] ); } //ocshop benefits $this->data['products'][] = array( 'product_id' => $result['product_id'], 'thumb' => $image, 'thumbwidth' => $imagewidth, 'thumbheight' => $imageheight, 'name' => $result['name'], 'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, 300) . '..', 'description_mini' => html_entity_decode ($result['description_mini']), 'price' => $price, 'special' => $special, 'tax' => $tax, 'rating' => $result['rating'], 'sticker' => $stickers, 'benefits' => $benefits, 'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']), 'href' => $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url) ); } $url = ''; if (isset($this->request->get['search'])) { $url .= '&search=' . urlencode(html_entity_decode($this->request->get['search'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['tag'])) { $url .= '&tag=' . urlencode(html_entity_decode($this->request->get['tag'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['description'])) { $url .= '&description=' . $this->request->get['description']; } 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']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $this->data['sorts'] = array(); $this->data['sorts'][] = array( 'text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/search', 'sort=p.sort_order&order=ASC' . $url) ); $this->data['sorts'][] = array( 'text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/search', 'sort=pd.name&order=ASC' . $url) ); $this->data['sorts'][] = array( 'text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/search', 'sort=pd.name&order=DESC' . $url) ); $this->data['sorts'][] = array( 'text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/search', 'sort=p.price&order=ASC' . $url) ); $this->data['sorts'][] = array( 'text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/search', 'sort=p.price&order=DESC' . $url) ); if ($this->config->get('config_review_status')) { $this->data['sorts'][] = array( 'text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/search', 'sort=rating&order=DESC' . $url) ); $this->data['sorts'][] = array( 'text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/search', 'sort=rating&order=ASC' . $url) ); } $this->data['sorts'][] = array( 'text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/search', 'sort=p.model&order=ASC' . $url) ); $this->data['sorts'][] = array( 'text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/search', 'sort=p.model&order=DESC' . $url) ); $url = ''; if (isset($this->request->get['search'])) { $url .= '&search=' . urlencode(html_entity_decode($this->request->get['search'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['tag'])) { $url .= '&tag=' . urlencode(html_entity_decode($this->request->get['tag'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['description'])) { $url .= '&description=' . $this->request->get['description']; } 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']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } $this->data['limits'] = array(); $limits = array_unique(array($this->config->get('config_catalog_limit'), 25, 50, 75, 100)); sort($limits); foreach($limits as $value){ $this->data['limits'][] = array( 'text' => $value, 'value' => $value, 'href' => $this->url->link('product/search', $url . '&limit=' . $value) ); } $url = ''; if (isset($this->request->get['search'])) { $url .= '&search=' . urlencode(html_entity_decode($this->request->get['search'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['tag'])) { $url .= '&tag=' . urlencode(html_entity_decode($this->request->get['tag'], ENT_QUOTES, 'UTF-8')); } if (isset($this->request->get['description'])) { $url .= '&description=' . $this->request->get['description']; } 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']; } if (isset($this->request->get['sort'])) { $url .= '&sort=' . $this->request->get['sort']; } if (isset($this->request->get['order'])) { $url .= '&order=' . $this->request->get['order']; } if (isset($this->request->get['limit'])) { $url .= '&limit=' . $this->request->get['limit']; } $pagination = new Pagination(); $pagination->total = $product_total; $pagination->page = $page; $pagination->limit = $limit; $pagination->text = $this->language->get('text_pagination'); $pagination->url = $this->url->link('product/search', $url . '&page={page}'); $this->data['pagination'] = $pagination->render(); } $this->data['search'] = $search; $this->data['description'] = $description; $this->data['category_id'] = $category_id; $this->data['sub_category'] = $sub_category; $this->data['sort'] = $sort; $this->data['order'] = $order; $this->data['limit'] = $limit; if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/search.tpl')) { $this->template = $this->config->get('config_template') . '/template/product/search.tpl'; } else { $this->template = 'default/template/product/search.tpl'; } $this->children = array( 'common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header' ); $this->response->setOutput($this->render()); } private function getStickers($product_id) { $stickers = $this->model_catalog_product->getProductStickerbyProductId($product_id) ; if (!$stickers) { return; } $this->data['stickers'] = array(); foreach ($stickers as $sticker) { $this->data['stickers'][] = array( 'position' => $sticker['position'], 'image' => HTTP_SERVER . 'image/' . $sticker['image'] ); } if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/stickers.tpl')) { $this->template = $this->config->get('config_template') . '/template/product/stickers.tpl'; } else { $this->template = 'default/template/product/stickers.tpl'; } return $this->render(); } } ?>
А где содержимое файла vq2-catalog_view_theme_univer_template_common_header.tpl? В любом случае, оставшиеся ошибки не могут влиять на поиск. Один из вариантов, почему не фильтрует по категориям - поиск по категориям работает только для товаров, у которых поставлена галочка показывать в той категории, по которой происходит поиск. То есть, если есть категория с товаром, а в поиске выбрана её родительская категория, то этот товар найти не получится, если он не выводится и в родительской категории.