first commit
This commit is contained in:
36
modules/leoproductsearch/views/css/index.php
Normal file
36
modules/leoproductsearch/views/css/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -0,0 +1,56 @@
|
||||
.ac_results {
|
||||
text-align: left;
|
||||
padding: 0px;
|
||||
border: 1px solid black;
|
||||
background-color: white;
|
||||
overflow: hidden;
|
||||
z-index: 99999;
|
||||
display: none;
|
||||
padding-bottom: 35px;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.ac_results ul {
|
||||
width: 100%;
|
||||
list-style-position: outside;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.ac_results li {
|
||||
margin: 0px;
|
||||
padding: 5px 10px;
|
||||
cursor: default;
|
||||
display: block;
|
||||
/*
|
||||
if width will be 100% horizontal scrollbar will apear
|
||||
when scroll mode will be used
|
||||
*/
|
||||
/*width: 100%;*/
|
||||
font: menu;
|
||||
font-size: 12px;
|
||||
/*
|
||||
it is very important, if line-height not setted or setted
|
||||
in relative units scroll will be broken in firefox
|
||||
*/
|
||||
line-height: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/*
|
||||
.ac_loading {
|
||||
background: white url('indicator.gif') right center no-repeat;
|
||||
}
|
||||
*/
|
||||
|
||||
.ac_odd {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
.ac_over {
|
||||
background-color: #0A246A;
|
||||
color: white;
|
||||
}
|
||||
230
modules/leoproductsearch/views/css/leosearch.css
Normal file
230
modules/leoproductsearch/views/css/leosearch.css
Normal file
@@ -0,0 +1,230 @@
|
||||
/* block top search */
|
||||
#search_block_top {
|
||||
position:absolute;
|
||||
right: 26%;
|
||||
top: 34px;
|
||||
}
|
||||
#search_block_top p {padding:0;}
|
||||
#search_block_top #search_query_top {
|
||||
padding:0 5px;
|
||||
height:23px;
|
||||
width:300px;/* 310 */
|
||||
border:1px solid #666;
|
||||
border-right: 0 !important;
|
||||
color:#666;
|
||||
background:url(img/bg_search_input.png) repeat-x 0 0 #fff;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#search_block_top .button {
|
||||
border:none;
|
||||
border-radius:0;
|
||||
color:#fff;
|
||||
text-transform:uppercase;
|
||||
background:url(img/bg_search_submit.png) repeat-x 0 0 #101010;
|
||||
float: left;
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
form#searchbox{padding-top:5px}
|
||||
form#searchbox label{color:#333;margin-bottom:1px}
|
||||
form#searchbox input#leo_search_query_block{
|
||||
border: 1px solid #CCCCCC;
|
||||
-webkit-border-radius:3px !important;
|
||||
-moz-border-radius:3px !important;
|
||||
border-radius:3px !important;
|
||||
height: 18px;
|
||||
margin-top:10px;
|
||||
}
|
||||
form#searchbox input#search_button{padding: 1px 4px;}
|
||||
|
||||
.list-cate-wrapper
|
||||
{
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.list-cate
|
||||
{
|
||||
width: 100%;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.cate-item
|
||||
{
|
||||
display: block;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#leosearchtopbox a.cate-item.active, #leosearchtopbox a.cate-item:hover, #leosearchbox a.cate-item.active, #leosearchbox a.cate-item:hover
|
||||
{
|
||||
background: #2fb5d2;
|
||||
color: #414141;
|
||||
}
|
||||
|
||||
#dropdownListCate, #dropdownListCateTop
|
||||
{
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
padding: 5px 0px 5px 15px;
|
||||
}
|
||||
|
||||
#leosearchtopbox #dropdownListCateTop:hover, #leosearchbox #dropdownListCate:hover
|
||||
{
|
||||
color: #414141;
|
||||
}
|
||||
/*****************molify****************/
|
||||
#leo_search_block_top .block_content{
|
||||
border: 1px solid rgba(0,0,0,.25);
|
||||
}
|
||||
#leosearchtopbox input {
|
||||
background: transparent;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
#leo_search_top_button{
|
||||
padding: 9px 16px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
background: #2fb5d2;
|
||||
color: #fff;
|
||||
}
|
||||
#leo_search_top_button .search{
|
||||
color: white;
|
||||
}
|
||||
#leosearchtopbox .list-cate-wrapper{
|
||||
display: inline-block;
|
||||
padding: 0 19px;
|
||||
}
|
||||
#leo_search_block_top {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.ac_results{
|
||||
width: 100%;
|
||||
}
|
||||
.search-in-product ul li > a{
|
||||
float: left;
|
||||
width: 60px;
|
||||
}
|
||||
.search-in-product ul li > div{
|
||||
float: right;
|
||||
width: calc(100% - 60px);
|
||||
}
|
||||
@media (max-width: 1199px){
|
||||
#leosearchtopbox input {
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
#leo_search_block_top .block_content{
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
@media (max-width: 575px){
|
||||
#leosearchtopbox .list-cate-wrapper {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
#leo_search_block_top{
|
||||
float: left;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#leo_search_block_top .title_block{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#leosearchtopbox > label{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#leo_search_block_top .leoproductsearch-result{
|
||||
width: 73%;
|
||||
display: inline-block;
|
||||
margin: 3px 0;
|
||||
border-left: 1px solid rgba(0,0,0,.25);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.leoproductsearch-loading.cssload-speeding-wheel{
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 4px;
|
||||
display: none;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.ac_results.lps_results> div:first-child{
|
||||
overflow-y: scroll;
|
||||
height: 308px;
|
||||
}
|
||||
#leo_search_block_top .ac_results .search-in-suggest .search-value-title,
|
||||
#leo_search_block_top .ac_results .search-in-cat .search-value-title,
|
||||
#leo_search_block_top .ac_results .search-in-product .search-value-title{
|
||||
color: #000;
|
||||
background: #efefef;
|
||||
padding: 10px 5px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.ac_results li{
|
||||
font-size: 13px;
|
||||
padding: 5px;
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
transition: all ease .4s;
|
||||
}
|
||||
|
||||
.ac_results li:hover{
|
||||
background: #efefef;
|
||||
}
|
||||
.ac_results li:hover a{
|
||||
color: #fff;
|
||||
}
|
||||
.ac_results li a{
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
transition: all ease .4s;
|
||||
}
|
||||
#leo_search_block_top .ac_results li:hover .lps-result-title,
|
||||
#leo_search_block_top .ac_results li:hover .lps-result-price{
|
||||
color: #333;
|
||||
}
|
||||
#leo_search_block_top .ac_results .all-search-product{
|
||||
text-align: center;
|
||||
padding: 8px 0;
|
||||
background: #f85f5f;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
}
|
||||
#leo_search_block_top .ac_results .all-search-product a{
|
||||
color: #fff;
|
||||
text-transform: capitalize;
|
||||
font-weight: 600;
|
||||
}
|
||||
#leo_search_block_top .ac_results .search-in-product ul li{
|
||||
position: relative;
|
||||
}
|
||||
#leo_search_block_top .ac_results .search-in-product ul li .lps-result-content{
|
||||
position: absolute;
|
||||
left: 60px;
|
||||
}
|
||||
#leo_search_block_top .ac_results .lps-result-content {
|
||||
width: calc(100% - 50px);
|
||||
display: inline-block;
|
||||
padding-left: 7px;
|
||||
}
|
||||
.head-leosearch-product.ac_results{
|
||||
display: block;
|
||||
position: relative;
|
||||
padding: 20px;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.head-leosearch-product.ac_results > div{
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.head-leosearch-product.ac_results a{
|
||||
color: #000;
|
||||
}
|
||||
BIN
modules/leoproductsearch/views/img/bg_search_input.png
Normal file
BIN
modules/leoproductsearch/views/img/bg_search_input.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 102 B |
BIN
modules/leoproductsearch/views/img/bg_search_submit.png
Normal file
BIN
modules/leoproductsearch/views/img/bg_search_submit.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 192 B |
35
modules/leoproductsearch/views/img/index.php
Normal file
35
modules/leoproductsearch/views/img/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
36
modules/leoproductsearch/views/index.php
Normal file
36
modules/leoproductsearch/views/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
36
modules/leoproductsearch/views/js/index.php
Normal file
36
modules/leoproductsearch/views/js/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -0,0 +1,862 @@
|
||||
/**
|
||||
* @copyright Commercial License By LeoTheme.Com
|
||||
* @email leotheme.com
|
||||
* @visit http://www.leotheme.com
|
||||
*/
|
||||
|
||||
//DONGND:: fix missing $browser jquery 2.x
|
||||
var matched, browser;
|
||||
|
||||
jQuery.uaMatch = function( ua ) {
|
||||
ua = ua.toLowerCase();
|
||||
|
||||
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
|
||||
/(msie) ([\w.]+)/.exec( ua ) ||
|
||||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
|
||||
[];
|
||||
|
||||
return {
|
||||
browser: match[ 1 ] || "",
|
||||
version: match[ 2 ] || "0"
|
||||
};
|
||||
};
|
||||
|
||||
matched = jQuery.uaMatch( navigator.userAgent );
|
||||
browser = {};
|
||||
|
||||
if ( matched.browser ) {
|
||||
browser[ matched.browser ] = true;
|
||||
browser.version = matched.version;
|
||||
}
|
||||
|
||||
// Chrome is Webkit, but Webkit is also Safari.
|
||||
if ( browser.chrome ) {
|
||||
browser.webkit = true;
|
||||
} else if ( browser.webkit ) {
|
||||
browser.safari = true;
|
||||
}
|
||||
|
||||
jQuery.browser = browser;
|
||||
|
||||
;(function($) {
|
||||
|
||||
$.fn.extend({
|
||||
autocomplete: function(urlOrData, options) {
|
||||
var isUrl = typeof urlOrData == "string";
|
||||
options = $.extend({}, $.Autocompleter.defaults, {
|
||||
url: isUrl ? urlOrData : null,
|
||||
data: isUrl ? null : urlOrData,
|
||||
delay: isUrl ? $.Autocompleter.defaults.delay : 10,
|
||||
max: options && !options.scroll ? 10 : 150
|
||||
}, options);
|
||||
|
||||
// if highlight is set to false, replace it with a do-nothing function
|
||||
options.highlight = options.highlight || function(value) { return value; };
|
||||
|
||||
// if the formatMatch option is not specified, then use formatItem for backwards compatibility
|
||||
options.formatMatch = options.formatMatch || options.formatItem;
|
||||
|
||||
return this.each(function() {
|
||||
new $.Autocompleter(this, options);
|
||||
});
|
||||
},
|
||||
result: function(handler) {
|
||||
return this.bind("result", handler);
|
||||
},
|
||||
search: function(handler) {
|
||||
return this.trigger("search", [handler]);
|
||||
},
|
||||
flushCache: function() {
|
||||
return this.trigger("flushCache");
|
||||
},
|
||||
setOptions: function(options){
|
||||
return this.trigger("setOptions", [options]);
|
||||
},
|
||||
unautocomplete: function() {
|
||||
return this.trigger("unautocomplete");
|
||||
}
|
||||
});
|
||||
|
||||
$.Autocompleter = function(input, options) {
|
||||
|
||||
var KEY = {
|
||||
UP: 38,
|
||||
DOWN: 40,
|
||||
DEL: 46,
|
||||
TAB: 9,
|
||||
RETURN: 13,
|
||||
ESC: 27,
|
||||
COMMA: 188,
|
||||
PAGEUP: 33,
|
||||
PAGEDOWN: 34,
|
||||
BACKSPACE: 8
|
||||
};
|
||||
|
||||
// Create $ object for input element
|
||||
var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);
|
||||
//DONGND:: add loading
|
||||
var $loading = $input.parent().find('.leoproductsearch-loading');
|
||||
var timeout;
|
||||
var previousValue = "";
|
||||
var cache = $.Autocompleter.Cache(options);
|
||||
var hasFocus = 0;
|
||||
var lastKeyPressCode;
|
||||
var config = {
|
||||
mouseDownOnSelect: false
|
||||
};
|
||||
var select = $.Autocompleter.Select(options, input, selectCurrent, config);
|
||||
|
||||
var blockSubmit;
|
||||
|
||||
// prevent form submit in opera when selecting with return key
|
||||
$.browser.opera && $(input.form).bind("submit.autocomplete", function() {
|
||||
if (blockSubmit) {
|
||||
blockSubmit = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all
|
||||
$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
|
||||
// track last key pressed
|
||||
lastKeyPressCode = event.keyCode;
|
||||
switch(event.keyCode) {
|
||||
|
||||
case KEY.UP:
|
||||
event.preventDefault();
|
||||
if ( select.visible() ) {
|
||||
select.prev();
|
||||
} else {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY.DOWN:
|
||||
event.preventDefault();
|
||||
if ( select.visible() ) {
|
||||
select.next();
|
||||
} else {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY.PAGEUP:
|
||||
event.preventDefault();
|
||||
if ( select.visible() ) {
|
||||
select.pageUp();
|
||||
} else {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY.PAGEDOWN:
|
||||
event.preventDefault();
|
||||
if ( select.visible() ) {
|
||||
select.pageDown();
|
||||
} else {
|
||||
onChange(0, true);
|
||||
}
|
||||
break;
|
||||
|
||||
// matches also semicolon
|
||||
case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
|
||||
case KEY.TAB:
|
||||
case KEY.RETURN:
|
||||
if( selectCurrent() ) {
|
||||
// stop default to prevent a form submit, Opera needs special handling
|
||||
event.preventDefault();
|
||||
blockSubmit = true;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case KEY.ESC:
|
||||
select.hide();
|
||||
break;
|
||||
|
||||
default:
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(onChange, options.delay);
|
||||
break;
|
||||
}
|
||||
}).focus(function(){
|
||||
// track whether the field has focus, we shouldn't process any
|
||||
// results if the field no longer has focus
|
||||
hasFocus++;
|
||||
}).blur(function() {
|
||||
hasFocus = 0;
|
||||
if (!config.mouseDownOnSelect) {
|
||||
hideResults();
|
||||
}
|
||||
}).click(function() {
|
||||
// show select when clicking in a focused field
|
||||
if ( hasFocus++ > 1 && !select.visible() ) {
|
||||
onChange(0, true);
|
||||
}
|
||||
}).bind("search", function() {
|
||||
// TODO why not just specifying both arguments?
|
||||
var fn = (arguments.length > 1) ? arguments[1] : null;
|
||||
function findValueCallback(q, data) {
|
||||
var result;
|
||||
if( data && data.length ) {
|
||||
for (var i=0; i < data.length; i++) {
|
||||
if( data[i].result.toLowerCase() == q.toLowerCase() ) {
|
||||
result = data[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( typeof fn == "function" ) fn(result);
|
||||
else $input.trigger("result", result && [result.data, result.value]);
|
||||
}
|
||||
$.each(trimWords($input.val()), function(i, value) {
|
||||
request(value, findValueCallback, findValueCallback);
|
||||
});
|
||||
}).bind("flushCache", function() {
|
||||
cache.flush();
|
||||
}).bind("setOptions", function() {
|
||||
$.extend(options, arguments[1]);
|
||||
// if we've updated the data, repopulate
|
||||
if ( "data" in arguments[1] )
|
||||
cache.populate();
|
||||
}).bind("unautocomplete", function() {
|
||||
select.unbind();
|
||||
$input.unbind();
|
||||
$(input.form).unbind(".autocomplete");
|
||||
});
|
||||
|
||||
|
||||
function selectCurrent() {
|
||||
var selected = select.selected();
|
||||
if( !selected )
|
||||
return false;
|
||||
|
||||
var v = selected.result;
|
||||
previousValue = v;
|
||||
|
||||
if ( options.multiple ) {
|
||||
var words = trimWords($input.val());
|
||||
if ( words.length > 1 ) {
|
||||
v = words.slice(0, words.length - 1).join( options.multipleSeparator ) + options.multipleSeparator + v;
|
||||
}
|
||||
v += options.multipleSeparator;
|
||||
}
|
||||
|
||||
$input.val(v);
|
||||
hideResultsNow();
|
||||
$input.trigger("result", [selected.data, selected.value]);
|
||||
return true;
|
||||
}
|
||||
|
||||
function onChange(crap, skipPrevCheck) {
|
||||
if( lastKeyPressCode == KEY.DEL ) {
|
||||
select.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
var currentValue = $input.val();
|
||||
|
||||
if ( !skipPrevCheck && currentValue == previousValue )
|
||||
return;
|
||||
|
||||
previousValue = currentValue;
|
||||
|
||||
currentValue = lastWord(currentValue);
|
||||
if ( currentValue.length >= options.minChars) {
|
||||
$input.addClass(options.loadingClass);
|
||||
if (!options.matchCase)
|
||||
currentValue = currentValue.toLowerCase();
|
||||
request(currentValue, receiveData, hideResultsNow);
|
||||
} else {
|
||||
stopLoading();
|
||||
select.hide();
|
||||
}
|
||||
};
|
||||
|
||||
function trimWords(value) {
|
||||
if ( !value ) {
|
||||
return [""];
|
||||
}
|
||||
var words = value.split( options.multipleSeparator );
|
||||
var result = [];
|
||||
$.each(words, function(i, value) {
|
||||
if ( $.trim(value) )
|
||||
result[i] = $.trim(value);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function lastWord(value) {
|
||||
if ( !options.multiple )
|
||||
return value;
|
||||
var words = trimWords(value);
|
||||
return words[words.length - 1];
|
||||
}
|
||||
|
||||
// fills in the input box w/the first match (assumed to be the best match)
|
||||
// q: the term entered
|
||||
// sValue: the first matching result
|
||||
function autoFill(q, sValue){
|
||||
// autofill in the complete box w/the first match as long as the user hasn't entered in more data
|
||||
// if the last user key pressed was backspace, don't autofill
|
||||
if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) {
|
||||
// fill in the value (keep the case the user has typed)
|
||||
$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
|
||||
// select the portion of the value not typed by the user (so the next character will erase)
|
||||
$.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length);
|
||||
}
|
||||
};
|
||||
|
||||
function hideResults() {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(hideResultsNow, 200);
|
||||
};
|
||||
|
||||
function hideResultsNow() {
|
||||
var wasVisible = select.visible();
|
||||
select.hide();
|
||||
clearTimeout(timeout);
|
||||
stopLoading();
|
||||
if (options.mustMatch) {
|
||||
// call search and run callback
|
||||
$input.search(
|
||||
function (result){
|
||||
// if no value found, clear the input box
|
||||
if( !result ) {
|
||||
if (options.multiple) {
|
||||
var words = trimWords($input.val()).slice(0, -1);
|
||||
$input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") );
|
||||
}
|
||||
else
|
||||
$input.val( "" );
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
if (wasVisible)
|
||||
// position cursor at end of input field
|
||||
$.Autocompleter.Selection(input, input.value.length, input.value.length);
|
||||
};
|
||||
|
||||
function receiveData(q, data) {
|
||||
if ( data && data.length && hasFocus ) {
|
||||
stopLoading();
|
||||
select.display(data, q);
|
||||
autoFill(q, data[0].value);
|
||||
select.show();
|
||||
} else {
|
||||
hideResultsNow();
|
||||
}
|
||||
};
|
||||
|
||||
function request(term, success, failure) {
|
||||
//DONGND:: show loading
|
||||
$loading.show();
|
||||
//$(".leoproductsearch-result .ac_results").hide();
|
||||
if (!options.matchCase)
|
||||
term = term.toLowerCase();
|
||||
var data = cache.load(term);
|
||||
// recieve the cached data
|
||||
if (data && data.length) {
|
||||
success(term, data);
|
||||
// if an AJAX url has been supplied, try loading the data now
|
||||
} else if( (typeof options.url == "string") && (options.url.length > 0) ){
|
||||
|
||||
var extraParams = {
|
||||
timestamp: +new Date()
|
||||
};
|
||||
$.each(options.extraParams, function(key, param) {
|
||||
extraParams[key] = typeof param == "function" ? param() : param;
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
// try to leverage ajaxQueue plugin to abort previous requests
|
||||
mode: "abort",
|
||||
// limit abortion to this input
|
||||
port: "autocomplete" + input.name,
|
||||
dataType: options.dataType,
|
||||
url: options.url,
|
||||
data: $.extend({
|
||||
cate:$('input[name="cate"]').val(),
|
||||
q: lastWord(term),
|
||||
limit: options.max
|
||||
}, extraParams),
|
||||
success: function(data) {
|
||||
var str = '<div>';
|
||||
|
||||
if(data.suggest.length){
|
||||
str += '<div class="search-in-suggest">';
|
||||
str += '<div class="search-value-title">'+$("#leosearchtopbox").data('label-suggestion')+'</div>';
|
||||
str += '<ul>';
|
||||
for(i=0;i<data.suggest.length;i++){
|
||||
str += '<li><a class="suggest-item" href="'+ data.suggest[i]['word'] +'">' + data.suggest[i]['word'] + '</a></li>';
|
||||
}
|
||||
str += '</ul>';
|
||||
str += '</div>';
|
||||
}
|
||||
if(data.category.length){
|
||||
str += '<div class="search-in-cat">';
|
||||
str += '<div class="search-value-title">'+$("#leosearchtopbox").data('search-for')+' "'+ $("#leo_search_query_top").val() +'"</div>';
|
||||
if(data.category.length){
|
||||
str += '<ul>';
|
||||
for(i=0;i<data.category.length;i++){
|
||||
str += '<li><a href="'+ data.category[i]['link'] +'">'+$("#leosearchtopbox").data('in-category')+': <strong>'+ data.category[i]['name'] +'</strong> ('+ data.category[i]['count'] +' produkty)</a></li>';
|
||||
}
|
||||
str += '</ul>';
|
||||
}
|
||||
// if(data.manufacturer.length){
|
||||
// str += '<ul>';
|
||||
// for(i=0;i<data.manufacturer.length;i++){
|
||||
// str += '<li><a href="'+ data.manufacturer[i]['link'] +'">in Manufacturer: <strong>'+ data.manufacturer[i]['name'] +'</strong> ('+ data.manufacturer[i]['count'] +' results)</a></li>';
|
||||
// }
|
||||
// str += '</ul>';
|
||||
// }
|
||||
str += '</div>';
|
||||
}
|
||||
|
||||
if(data.products.length){
|
||||
str += '<div class="search-in-product">';
|
||||
str += '<div class="search-value-title">'+$("#leosearchtopbox").data('products-for')+' "'+ $("#leo_search_query_top").val() +'"</div>';
|
||||
str += '<ul>';
|
||||
for(i=0;i<data.products.length;i++){
|
||||
str += '<li><a href="'+ data.products[i]['link'] +'"><div class="lps-result-img"><img class="img-fluid" align = "center" src=' + data.products[i].cover.bySize.small_default.url + '></div>' + '<div class="lps-result-content"><div class="lps-result-title">' + data.products[i].name +'</div>' + '<div class="lps-result-price">' + data.products[i].price +'</div></a></li>';
|
||||
}
|
||||
str += '</ul>';
|
||||
str += '</div>';
|
||||
str += '</div>';
|
||||
str += '<div class="all-search-product">';
|
||||
str += '<a href="' + data['link'] + '">'+$("#leosearchtopbox").data('view-all')+' ('+data['total_items']+' '+$("#leosearchtopbox").data('label-products')+')</a>'
|
||||
str += '</div>';
|
||||
}else{
|
||||
str += "<div class='no-products'>Nie mam produktów</div>";
|
||||
str += '</div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$(".leoproductsearch-result .ac_results").html(str);
|
||||
$(".leoproductsearch-result .ac_results").show();
|
||||
|
||||
$(".suggest-item").click(function(){
|
||||
$("#leo_search_query_top").val($(this).attr('href'));
|
||||
onChange(0, true);
|
||||
return false;
|
||||
});
|
||||
|
||||
// var parsed = options.parse && options.parse(data) || parse(data);
|
||||
// //cache.add(term, $('select#cate').val(), parsed);
|
||||
// success(term, parsed);
|
||||
// //DONGND:: hide loading
|
||||
$loading.hide();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
|
||||
select.emptyList();
|
||||
failure(term);
|
||||
}
|
||||
};
|
||||
|
||||
function parse(data) {
|
||||
var parsed = [];
|
||||
var rows = data.split("\n");
|
||||
for (var i=0; i < rows.length; i++) {
|
||||
var row = $.trim(rows[i]);
|
||||
if (row) {
|
||||
row = row.split("|");
|
||||
parsed[parsed.length] = {
|
||||
data: row,
|
||||
value: row[0],
|
||||
result: options.formatResult && options.formatResult(row, row[0]) || row[0]
|
||||
};
|
||||
}
|
||||
}
|
||||
return parsed;
|
||||
};
|
||||
|
||||
function stopLoading() {
|
||||
$input.removeClass(options.loadingClass);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
$.Autocompleter.defaults = {
|
||||
inputClass: "ac_input",
|
||||
resultsClass: "ac_results lps_results",
|
||||
loadingClass: "ac_loading",
|
||||
minChars: 1,
|
||||
delay: 400,
|
||||
matchCase: false,
|
||||
matchSubset: true,
|
||||
matchContains: false,
|
||||
cacheLength: 10,
|
||||
max: 100,
|
||||
mustMatch: false,
|
||||
extraParams: {},
|
||||
selectFirst: true,
|
||||
formatItem: function(row) { return row[0]; },
|
||||
formatMatch: null,
|
||||
autoFill: false,
|
||||
width: 0,
|
||||
multiple: false,
|
||||
multipleSeparator: ", ",
|
||||
highlight: function(value, term) {
|
||||
return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
|
||||
},
|
||||
scroll: true,
|
||||
scrollHeight: 180
|
||||
};
|
||||
|
||||
$.Autocompleter.Cache = function(options) {
|
||||
|
||||
var data = {};
|
||||
var length = 0;
|
||||
|
||||
function matchSubset(s, sub) {
|
||||
if (!options.matchCase)
|
||||
s = s.toLowerCase();
|
||||
var i = s.indexOf(sub);
|
||||
if (i == -1) return false;
|
||||
return i == 0 || options.matchContains;
|
||||
};
|
||||
|
||||
function add(q, cate, value) {
|
||||
if (length > options.cacheLength){
|
||||
flush();
|
||||
}
|
||||
if (!data[q]){
|
||||
length++;
|
||||
}
|
||||
data[q] = value;
|
||||
}
|
||||
|
||||
function populate(){
|
||||
if( !options.data ) return false;
|
||||
// track the matches
|
||||
var stMatchSets = {},
|
||||
nullData = 0;
|
||||
|
||||
// no url was specified, we need to adjust the cache length to make sure it fits the local data store
|
||||
if( !options.url ) options.cacheLength = 1;
|
||||
|
||||
// track all options for minChars = 0
|
||||
stMatchSets[""] = [];
|
||||
|
||||
// loop through the array and create a lookup structure
|
||||
for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
|
||||
var rawValue = options.data[i];
|
||||
// if rawValue is a string, make an array otherwise just reference the array
|
||||
rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
|
||||
|
||||
var value = options.formatMatch(rawValue, i+1, options.data.length);
|
||||
if ( value === false )
|
||||
continue;
|
||||
|
||||
var firstChar = value.charAt(0).toLowerCase();
|
||||
// if no lookup array for this character exists, look it up now
|
||||
if( !stMatchSets[firstChar] )
|
||||
stMatchSets[firstChar] = [];
|
||||
|
||||
// if the match is a string
|
||||
var row = {
|
||||
value: value,
|
||||
data: rawValue,
|
||||
result: options.formatResult && options.formatResult(rawValue) || value
|
||||
};
|
||||
|
||||
// push the current match into the set list
|
||||
stMatchSets[firstChar].push(row);
|
||||
|
||||
// keep track of minChars zero items
|
||||
if ( nullData++ < options.max ) {
|
||||
stMatchSets[""].push(row);
|
||||
}
|
||||
};
|
||||
|
||||
// add the data items to the cache
|
||||
$.each(stMatchSets, function(i, value) {
|
||||
// increase the cache size
|
||||
options.cacheLength++;
|
||||
// add to the cache
|
||||
add(i, value);
|
||||
});
|
||||
}
|
||||
|
||||
// populate any existing data
|
||||
setTimeout(populate, 25);
|
||||
|
||||
function flush(){
|
||||
data = {};
|
||||
length = 0;
|
||||
}
|
||||
|
||||
return {
|
||||
flush: flush,
|
||||
add: add,
|
||||
populate: populate,
|
||||
load: function(q) {
|
||||
if (!options.cacheLength || !length)
|
||||
return null;
|
||||
/*
|
||||
* if dealing w/local data and matchContains than we must make sure
|
||||
* to loop through all the data collections looking for matches
|
||||
*/
|
||||
if( !options.url && options.matchContains ){
|
||||
// track all matches
|
||||
var csub = [];
|
||||
// loop through all the data grids for matches
|
||||
for( var k in data ){
|
||||
// don't search through the stMatchSets[""] (minChars: 0) cache
|
||||
// this prevents duplicates
|
||||
if( k.length > 0 ){
|
||||
var c = data[k];
|
||||
$.each(c, function(i, x) {
|
||||
// if we've got a match, add it to the array
|
||||
if (matchSubset(x.value, q)) {
|
||||
csub.push(x);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return csub;
|
||||
} else
|
||||
// if the exact item exists, use it
|
||||
if (data[q]){
|
||||
return data[q];
|
||||
} else
|
||||
if (options.matchSubset) {
|
||||
for (var i = q.length - 1; i >= options.minChars; i--) {
|
||||
var c = data[q.substr(0, i)];
|
||||
if (c) {
|
||||
var csub = [];
|
||||
$.each(c, function(i, x) {
|
||||
if (matchSubset(x.value, q)) {
|
||||
csub[csub.length] = x;
|
||||
}
|
||||
});
|
||||
return csub;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
$.Autocompleter.Select = function (options, input, select, config) {
|
||||
var CLASSES = {
|
||||
ACTIVE: "ac_over"
|
||||
};
|
||||
|
||||
var listItems,
|
||||
active = -1,
|
||||
data,
|
||||
term = "",
|
||||
needsInit = true,
|
||||
element,
|
||||
list;
|
||||
|
||||
// Create results
|
||||
function init() {
|
||||
if (!needsInit)
|
||||
return;
|
||||
element = $("<div/>")
|
||||
.hide()
|
||||
.addClass(options.resultsClass)
|
||||
.css("position", "absolute")
|
||||
.appendTo('.leoproductsearch-result');
|
||||
// .appendTo(document.body);
|
||||
|
||||
list = $("<div/>").appendTo(element).mouseover( function(event) {
|
||||
if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
|
||||
active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
|
||||
$(target(event)).addClass(CLASSES.ACTIVE);
|
||||
}
|
||||
}).click(function(event) {
|
||||
$(target(event)).addClass(CLASSES.ACTIVE);
|
||||
select();
|
||||
// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus
|
||||
input.focus();
|
||||
return false;
|
||||
}).mousedown(function() {
|
||||
config.mouseDownOnSelect = true;
|
||||
}).mouseup(function() {
|
||||
config.mouseDownOnSelect = false;
|
||||
});
|
||||
|
||||
if( options.width > 0 )
|
||||
element.css("width", options.width);
|
||||
|
||||
needsInit = false;
|
||||
}
|
||||
|
||||
function target(event) {
|
||||
var element = event.target;
|
||||
while(element && element.tagName != "LI")
|
||||
element = element.parentNode;
|
||||
// more fun with IE, sometimes event.target is empty, just ignore it then
|
||||
if(!element)
|
||||
return [];
|
||||
return element;
|
||||
}
|
||||
|
||||
function moveSelect(step) {
|
||||
listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
|
||||
movePosition(step);
|
||||
var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
|
||||
if(options.scroll) {
|
||||
var offset = 0;
|
||||
listItems.slice(0, active).each(function() {
|
||||
offset += this.offsetHeight;
|
||||
});
|
||||
if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
|
||||
list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
|
||||
} else if(offset < list.scrollTop()) {
|
||||
list.scrollTop(offset);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function movePosition(step) {
|
||||
active += step;
|
||||
if (active < 0) {
|
||||
active = listItems.size() - 1;
|
||||
} else if (active >= listItems.size()) {
|
||||
active = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function limitNumberOfItems(available) {
|
||||
return options.max && options.max < available
|
||||
? options.max
|
||||
: available;
|
||||
}
|
||||
|
||||
function fillList() {
|
||||
list.empty();
|
||||
var max = limitNumberOfItems(data.length);
|
||||
for (var i=0; i < max; i++) {
|
||||
if (!data[i])
|
||||
continue;
|
||||
var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term);
|
||||
if ( formatted === false )
|
||||
continue;
|
||||
var li = $("<li/>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
|
||||
$.data(li, "ac_data", data[i]);
|
||||
}
|
||||
listItems = list.find("li");
|
||||
if ( options.selectFirst ) {
|
||||
listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
|
||||
active = 0;
|
||||
}
|
||||
// apply bgiframe if available
|
||||
if ( $.fn.bgiframe )
|
||||
list.bgiframe();
|
||||
}
|
||||
|
||||
return {
|
||||
display: function(d, q) {
|
||||
init();
|
||||
data = d;
|
||||
term = q;
|
||||
fillList();
|
||||
},
|
||||
next: function() {
|
||||
moveSelect(1);
|
||||
},
|
||||
prev: function() {
|
||||
moveSelect(-1);
|
||||
},
|
||||
pageUp: function() {
|
||||
if (active != 0 && active - 8 < 0) {
|
||||
moveSelect( -active );
|
||||
} else {
|
||||
moveSelect(-8);
|
||||
}
|
||||
},
|
||||
pageDown: function() {
|
||||
if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
|
||||
moveSelect( listItems.size() - 1 - active );
|
||||
} else {
|
||||
moveSelect(8);
|
||||
}
|
||||
},
|
||||
hide: function() {
|
||||
element && element.hide();
|
||||
listItems && listItems.removeClass(CLASSES.ACTIVE);
|
||||
active = -1;
|
||||
},
|
||||
visible : function() {
|
||||
return element && element.is(":visible");
|
||||
},
|
||||
current: function() {
|
||||
return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
|
||||
},
|
||||
show: function() {
|
||||
var offset = $(input).offset();
|
||||
// element.css({
|
||||
// width: typeof options.width == "string" || options.width > 0 ? options.width : ($(input).width() + parseInt($(input).css('padding-left')) + parseInt($(input).css('padding-right')) + parseInt($(input).css('margin-left')) + parseInt($(input).css('margin-right'))),
|
||||
// top: offset.top + input.offsetHeight,
|
||||
// left: offset.left
|
||||
// }).show();
|
||||
element.css({
|
||||
width: typeof options.width == "string" || options.width > 0 ? options.width : ($(input).width() + parseInt($(input).css('padding-left')) + parseInt($(input).css('padding-right')) + parseInt($(input).css('margin-left')) + parseInt($(input).css('margin-right'))),
|
||||
top: "100%",
|
||||
left: 0
|
||||
}).show();
|
||||
if(options.scroll) {
|
||||
list.css({
|
||||
maxHeight: options.scrollHeight,
|
||||
overflow: 'auto'
|
||||
});
|
||||
|
||||
if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
|
||||
var listHeight = 0;
|
||||
listItems.each(function() {
|
||||
listHeight += this.offsetHeight;
|
||||
});
|
||||
var scrollbarsVisible = listHeight > options.scrollHeight;
|
||||
list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
|
||||
if (!scrollbarsVisible) {
|
||||
// IE doesn't recalculate width when scrollbar disappears
|
||||
listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
selected: function() {
|
||||
var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
|
||||
return selected && selected.length && $.data(selected[0], "ac_data");
|
||||
},
|
||||
emptyList: function (){
|
||||
list && list.empty();
|
||||
},
|
||||
unbind: function() {
|
||||
element && element.remove();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
$.Autocompleter.Selection = function(field, start, end) {
|
||||
if( field.createTextRange ){
|
||||
var selRange = field.createTextRange();
|
||||
selRange.collapse(true);
|
||||
selRange.moveStart("character", start);
|
||||
selRange.moveEnd("character", end);
|
||||
selRange.select();
|
||||
} else if( field.setSelectionRange ){
|
||||
field.setSelectionRange(start, end);
|
||||
} else {
|
||||
if( field.selectionStart ){
|
||||
field.selectionStart = start;
|
||||
field.selectionEnd = end;
|
||||
}
|
||||
}
|
||||
field.focus();
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
189
modules/leoproductsearch/views/js/leosearch.js
Normal file
189
modules/leoproductsearch/views/js/leosearch.js
Normal file
@@ -0,0 +1,189 @@
|
||||
/**
|
||||
* @copyright Commercial License By LeoTheme.Com
|
||||
* @email leotheme.com
|
||||
* @visit http://www.leotheme.com
|
||||
*/
|
||||
|
||||
var instantSearchQueries = [];
|
||||
|
||||
$(document).click(function(event) {
|
||||
var $target = $(event.target);
|
||||
if(!$target.closest('.leoproductsearch-content').length) {
|
||||
$(".leoproductsearch-result .ac_results").hide();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('#leo_search_query_top').click(function(){
|
||||
if ($(this).val().length > 2) {
|
||||
$(".leoproductsearch-result .ac_results").show();
|
||||
}
|
||||
});
|
||||
/* TODO Ids aa blocksearch_type need to be removed*/
|
||||
|
||||
if (typeof ajaxsearch != 'undefined' && ajaxsearch && typeof blocksearch_type !== 'undefined' && blocksearch_type){
|
||||
|
||||
var width_ac_results = $("#leo_search_query_" + blocksearch_type).outerWidth();
|
||||
$("#leo_search_query_" + blocksearch_type).autocomplete(
|
||||
leo_search_url,
|
||||
{
|
||||
minChars: 3,
|
||||
max: numpro_display,
|
||||
width: (width_ac_results > 0 ? width_ac_results : 500),
|
||||
selectFirst: false,
|
||||
scroll: false,
|
||||
dataType: "json",
|
||||
formatItem: function(data, i, max, value, term) {
|
||||
return value;
|
||||
},
|
||||
// parse: function(data) {
|
||||
|
||||
// var result = data.products;
|
||||
// var mytab = new Array();
|
||||
// if (result.length > 0)
|
||||
// {
|
||||
// for (var i = 0; i < result.length; i++)
|
||||
// {
|
||||
// //DONGND:: update config show product img and product price
|
||||
// var lps_html_result = '';
|
||||
// if (typeof lps_show_product_img != 'undefined' && lps_show_product_img && result[i].cover != null)
|
||||
// {
|
||||
// lps_html_result += '<div class="lps-result-img"><img class="img-fluid" align = "center" src=' + result[i].cover.bySize.small_default.url + '></div>';
|
||||
// }
|
||||
// lps_html_result += '<div class="lps-result-content"><div class="lps-result-title">' + result[i].name +'</div>';
|
||||
// if (typeof lps_show_product_price != 'undefined' && lps_show_product_price)
|
||||
// {
|
||||
// lps_html_result += '<div class="lps-result-price">' + result[i].price +'</div>';
|
||||
// }
|
||||
// lps_html_result += '<div>';
|
||||
|
||||
// mytab[mytab.length] = { data: result[i], value: lps_html_result };
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// mytab[0] = {data: { url: window.location.href}, value: '<span class="no-result">'+$('[name="txt_not_found"]').val()+'</span>'};
|
||||
// }
|
||||
|
||||
// return mytab;
|
||||
// },
|
||||
extraParams: {
|
||||
ajaxSearch: 1,
|
||||
id_lang: prestashop.language.id,
|
||||
leoproductsearch_static_token: leoproductsearch_static_token,
|
||||
leoproductsearch_token: leoproductsearch_token
|
||||
}
|
||||
}
|
||||
)
|
||||
.result(function(event, data, formatted) {
|
||||
$('#leo_search_query_' + blocksearch_type).val(data.name);
|
||||
document.location.href = data.url;
|
||||
});
|
||||
|
||||
//DONGND:: update when width of input has been change
|
||||
$("#leo_search_query_" + blocksearch_type).click(function(){
|
||||
width_ac_results = $(this).outerWidth();
|
||||
//DONGND:: update option js libary option when resize
|
||||
$(this).setOptions(
|
||||
{
|
||||
width: width_ac_results
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
$('.cate-item').click(function(){
|
||||
if (!$(this).hasClass('active'))
|
||||
{
|
||||
$('.cate-item.active').removeClass('active');
|
||||
var cate_id = $(this).data('cate-id');
|
||||
var cate_name = $(this).data('cate-name');
|
||||
$('#leosearch-cate-id').val(cate_id);
|
||||
$('#leosearchtop-cate-id').val(cate_id);
|
||||
$('#dropdownListCate span').text(cate_name);
|
||||
$('#dropdownListCateTop span').text(cate_name);
|
||||
$(this).addClass('active');
|
||||
}
|
||||
$('#dropdownListCate').trigger('click');
|
||||
$('#dropdownListCateTop').trigger('click');
|
||||
var e = jQuery.Event("keydown");
|
||||
e.keyCode = 40;
|
||||
$(this).parents('form').find('.search_query').focus().trigger(e);
|
||||
return false;
|
||||
});
|
||||
|
||||
//DONGND:: show result when click to input search
|
||||
$('.search_query').click(function(){
|
||||
if ($(this).val() != '')
|
||||
{
|
||||
// var e = jQuery.Event("keydown");
|
||||
// e.keyCode = 40;
|
||||
// $(this).trigger(e);
|
||||
}
|
||||
});
|
||||
$('.search_query').change(function(){
|
||||
if ($(this).val() != '')
|
||||
{
|
||||
var e = jQuery.Event("keydown");
|
||||
e.keyCode = 40;
|
||||
$(this).trigger(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//DONGND:: update position of result when resize
|
||||
$(window).resize(function(){
|
||||
updatePositionOfResult();
|
||||
});
|
||||
|
||||
//DONGND:: update position of result when scroll
|
||||
//$(window).scroll(function(){
|
||||
// updatePositionOfResult();
|
||||
// if ($('.ac_results').length)
|
||||
// {
|
||||
// $('.ac_results').hide();
|
||||
// }
|
||||
//})
|
||||
|
||||
function updatePositionOfResult()
|
||||
{
|
||||
if ($('.ac_results').length)
|
||||
{
|
||||
width_ac_results = $("#leo_search_query_" + blocksearch_type).outerWidth();
|
||||
//DONGND:: update option js libary option when resize
|
||||
$("#leo_search_query_" + blocksearch_type).setOptions(
|
||||
{
|
||||
width: width_ac_results
|
||||
}
|
||||
);
|
||||
//DONGND:: update position and with of block result when resize
|
||||
//var o_top = $("#leo_search_query_" + blocksearch_type).offset().top;
|
||||
//var o_left = $("#leo_search_query_" + blocksearch_type).offset().left;
|
||||
//var f_height = $("#leo_search_query_" + blocksearch_type).outerHeight();
|
||||
|
||||
$('.ac_results').width(width_ac_results);
|
||||
// $('.ac_results').css({
|
||||
// 'top': o_top+f_height,
|
||||
// 'left' : o_left,
|
||||
// })
|
||||
}
|
||||
}
|
||||
|
||||
function tryToCloseInstantSearch()
|
||||
{
|
||||
if ($('#old_center_column').length > 0)
|
||||
{
|
||||
$('#center_column').remove();
|
||||
$('#old_center_column').attr('id', 'center_column');
|
||||
$('#center_column').show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function stopInstantSearchQueries()
|
||||
{
|
||||
for(i=0;i<instantSearchQueries.length;i++)
|
||||
instantSearchQueries[i].abort();
|
||||
instantSearchQueries = new Array();
|
||||
}
|
||||
36
modules/leoproductsearch/views/templates/admin/index.php
Normal file
36
modules/leoproductsearch/views/templates/admin/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
29
modules/leoproductsearch/views/templates/admin/panel.tpl
Normal file
29
modules/leoproductsearch/views/templates/admin/panel.tpl
Normal file
@@ -0,0 +1,29 @@
|
||||
{*
|
||||
* @Module Name: Leo Product Search
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright Leotheme
|
||||
*}
|
||||
|
||||
<div class="panel form-horizontal">
|
||||
<div class="form-group">
|
||||
<div class="col-lg-1">
|
||||
<a class="megamenu-correct-module btn btn-success" href="{$url_admin}&success=correct&correctmodule=1">
|
||||
<i class="icon-AdminParentPreferences"></i>{l s='Correct module' mod='leoproductsearch'}
|
||||
</a>
|
||||
</div>
|
||||
<div class="control-label col-lg-11" style="text-align: left">* {l s='Make module work well with current Prestashop Version (fix database and old bug of module).' mod='leoproductsearch'}</div>
|
||||
<div class="control-label col-lg-11" style="text-align: left">* {l s='Please backup the database before run correct module to safe' mod='leoproductsearch'}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="leoproductsearch-group">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><i class="icon-cogs"></i> {l s='Leo Product Search Global Config' mod='leoproductsearch'}</div>
|
||||
<div class="panel-content" id="leoquicklogin-setting">
|
||||
<div class="tab-content">
|
||||
{$globalform}{* HTML form , no escape necessary *}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
36
modules/leoproductsearch/views/templates/front/index.php
Normal file
36
modules/leoproductsearch/views/templates/front/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
53
modules/leoproductsearch/views/templates/front/leosearch.tpl
Normal file
53
modules/leoproductsearch/views/templates/front/leosearch.tpl
Normal file
@@ -0,0 +1,53 @@
|
||||
{*
|
||||
* @Module Name: Leo Product Search
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright Leotheme
|
||||
*}
|
||||
|
||||
{function name="lps_categories" nodes=[] depth=0}
|
||||
{strip}
|
||||
{if $nodes|count}
|
||||
{foreach from=$nodes item=node}
|
||||
<a href="#" data-cate-id="{$node.id_category|escape:'htmlall':'UTF-8'|stripslashes}" data-cate-name="{$node.name}" class="cate-item cate-level-{$node.level_depth}{if isset($selectedCate) && $node.id_category eq $selectedCate} active{/if}" >{if $node.level_depth > 1}{str_repeat('-', $node.level_depth)}{/if}{$node.name}</a>
|
||||
{lps_categories nodes=$node.children depth=$depth+1}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{/strip}
|
||||
{/function}
|
||||
|
||||
<!-- Block search module -->
|
||||
<div id="leo_search_block_left" class="block exclusive{if $en_search_by_cat} search-by-category{/if}">
|
||||
<h4 class="title_block">{l s='Search' mod='leoproductsearch'}</h4>
|
||||
<form method="get" action="{$link->getPageLink('productsearch', true)|escape:'html':'UTF-8'}" id="leosearchbox">
|
||||
<input type="hidden" name="fc" value="module" />
|
||||
<input type="hidden" name="module" value="leoproductsearch" />
|
||||
<input type="hidden" name="controller" value="productsearch" />
|
||||
<input type="hidden" name="txt_not_found" value="{l s='No products found' mod='leoproductsearch'}">
|
||||
<input type="hidden" name="orderby" value="position" />
|
||||
<input type="hidden" name="orderway" value="desc" />
|
||||
|
||||
<label for="search_query_block">{l s='Search products:' mod='leoproductsearch'}</label>
|
||||
<div class="block_content clearfix">
|
||||
{if $en_search_by_cat}
|
||||
<div class="list-cate-wrapper">
|
||||
<input id="leosearch-cate-id" name="cate" value="{if isset($selectedCate)}{$selectedCate}{/if}" type="hidden">
|
||||
<a id="dropdownListCate" class="select-title" rel="nofollow" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span>{if $selectedCateName != ''}{$selectedCateName}{else}{l s='All Categories' mod='leoproductsearch'}{/if}</span>
|
||||
<i class="material-icons pull-xs-right">keyboard_arrow_down</i>
|
||||
</a>
|
||||
<div class="list-cate dropdown-menu" aria-labelledby="dropdownListCate">
|
||||
<a href="#" data-cate-id="" data-cate-name="{l s='All Categories' mod='leoproductsearch'}" class="cate-item{if $selectedCate == ''} active{/if}" >{l s='All Categories' mod='leoproductsearch'}</a>
|
||||
<a href="#" data-cate-id="{$cates.id_category|escape:'htmlall':'UTF-8'|stripslashes}" data-cate-name="{$cates.name}" class="cate-item cate-level-{$cates.level_depth}{if isset($selectedCate) && $cates.id_category eq $selectedCate} active{/if}" >{if $cates.level_depth > 1}{str_repeat('-', $cates.level_depth)}{/if}{$cates.name}</a>
|
||||
{lps_categories nodes=$cates.children}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="leoproductsearch-loading cssload-speeding-wheel">
|
||||
</div>
|
||||
<input class="search_query form-control grey" type="text" id="leo_search_query_block" name="search_query" value="{$search_query|escape:'htmlall':'UTF-8'|stripslashes}" />
|
||||
<button type="submit" id="leo_search_button" class="btn btn-default button button-small"><span><i class="material-icons search">search</i></span></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- /Block search module -->
|
||||
@@ -0,0 +1,60 @@
|
||||
{*
|
||||
* @Module Name: Leo Product Search
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright Leotheme
|
||||
*}
|
||||
|
||||
{function name="lps_categories" nodes=[] depth=0}
|
||||
{strip}
|
||||
{if $nodes|count}
|
||||
{foreach from=$nodes item=node}
|
||||
<a href="#" data-cate-id="{$node.id_category|escape:'htmlall':'UTF-8'|stripslashes}" data-cate-name="{$node.name}" class="cate-item cate-level-{$node.level_depth}{if isset($selectedCate) && $node.id_category eq $selectedCate} active{/if}" >{if $node.level_depth > 1}{str_repeat('-', $node.level_depth)}{/if}{$node.name}</a>
|
||||
{lps_categories nodes=$node.children depth=$depth+1}
|
||||
{/foreach}
|
||||
{/if}
|
||||
{/strip}
|
||||
{/function}
|
||||
|
||||
<!-- Block search module -->
|
||||
<div id="leo_search_block_top" class="block exclusive{if $en_search_by_cat} search-by-category{/if}">
|
||||
<h4 class="title_block">{l s='Search' mod='leoproductsearch'}</h4>
|
||||
<form method="get" action="{$link->getPageLink('productsearch', true)|escape:'html':'UTF-8'}" id="leosearchtopbox" data-label-suggestion="{l s='Suggestion' mod='leoproductsearch'}" data-search-for="{l s='Search for' mod='leoproductsearch'}" data-in-category="{l s='in category' mod='leoproductsearch'}" data-products-for="{l s='Products For' mod='leoproductsearch'}" data-label-products="{l s='Products' mod='leoproductsearch'}" data-view-all="{l s='View all' mod='leoproductsearch'}">
|
||||
<input type="hidden" name="fc" value="module" />
|
||||
<input type="hidden" name="module" value="leoproductsearch" />
|
||||
<input type="hidden" name="controller" value="productsearch" />
|
||||
<input type="hidden" name="txt_not_found" value="{l s='No products found' mod='leoproductsearch'}">
|
||||
<input type="hidden" name="leoproductsearch_static_token" value="{$leoproductsearch_static_token|escape:'htmlall':'UTF-8'|stripslashes}"/>
|
||||
{*
|
||||
<input type="hidden" name="orderby" value="position" />
|
||||
<input type="hidden" name="orderway" value="desc" />
|
||||
*}
|
||||
<label>{l s='Search products:' mod='leoproductsearch'}</label>
|
||||
<div id="leo_search_block_input" class="block_content clearfix leoproductsearch-content">
|
||||
{if $en_search_by_cat}
|
||||
<div class="list-cate-wrapper">
|
||||
<input id="leosearchtop-cate-id" name="cate" value="{if isset($selectedCate)}{$selectedCate}{/if}" type="hidden">
|
||||
<a href="javascript:void(0)" id="dropdownListCateTop" class="select-title" rel="nofollow" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span>{if $selectedCateName != ''}{$selectedCateName}{else}{l s='All Categories' mod='leoproductsearch'}{/if}</span>
|
||||
<i class="material-icons pull-xs-right">keyboard_arrow_down</i>
|
||||
</a>
|
||||
<div class="list-cate dropdown-menu" aria-labelledby="dropdownListCateTop">
|
||||
<a href="#" data-cate-id="" data-cate-name="{l s='All Categories' mod='leoproductsearch'}" class="cate-item{if $selectedCate == ''} active{/if}" >{l s='All Categories' mod='leoproductsearch'}</a>
|
||||
<a href="#" data-cate-id="{$cates.id_category|escape:'htmlall':'UTF-8'|stripslashes}" data-cate-name="{$cates.name}" class="cate-item cate-level-{$cates.level_depth}{if isset($selectedCate) && $cates.id_category eq $selectedCate} active{/if}" >{if $cates.level_depth > 1}{str_repeat('-', $cates.level_depth)}{/if}{$cates.name}</a>
|
||||
{lps_categories nodes=$cates.children}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="leoproductsearch-result">
|
||||
<div class="leoproductsearch-loading cssload-speeding-wheel"></div>
|
||||
<input class="search_query form-control grey" type="text" id="leo_search_query_top" name="search_query" value="{$search_query|escape:'htmlall':'UTF-8'|stripslashes}" placeholder="Szukaj sportu, produktu lub marki..."/>
|
||||
<div class="ac_results lps_results"></div>
|
||||
</div>
|
||||
<button type="submit" id="leo_search_top_button" class="btn btn-default button button-small"><span><i class="material-icons search">search</i></span></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var blocksearch_type = 'top';
|
||||
</script>
|
||||
<!-- /Block search module -->
|
||||
98
modules/leoproductsearch/views/templates/front/search.tpl
Normal file
98
modules/leoproductsearch/views/templates/front/search.tpl
Normal file
@@ -0,0 +1,98 @@
|
||||
{*
|
||||
* @Module Name: Leo Product Search
|
||||
* @Website: leotheme.com.com - prestashop template provider
|
||||
* @author Leotheme <leotheme@gmail.com>
|
||||
* @copyright Leotheme
|
||||
*}
|
||||
|
||||
{extends file=$layout}
|
||||
|
||||
{block name='content'}
|
||||
|
||||
{capture name=path}{l s='Search' mod='leoproductsearch'}{/capture}
|
||||
|
||||
<h1
|
||||
{if isset($instant_search) && $instant_search}id="instant_search_results"{/if}
|
||||
class="page-heading {if !isset($instant_search) || (isset($instant_search) && !$instant_search)} product-listing{/if}">
|
||||
{l s='Search' mod='leoproductsearch'}
|
||||
{if $nbProducts > 0}
|
||||
<span class="lighter">
|
||||
"{if isset($search_query) && $search_query}{$search_query|escape:'html':'UTF-8'}{elseif $search_tag}{$search_tag|escape:'html':'UTF-8'}{elseif $ref}{$ref|escape:'html':'UTF-8'}{/if}"
|
||||
</span>
|
||||
{/if}
|
||||
{if isset($instant_search) && $instant_search}
|
||||
<a href="#" class="close">
|
||||
{l s='Return to the previous page' mod='leoproductsearch'}
|
||||
</a>
|
||||
{else}
|
||||
<span class="heading-counter">
|
||||
{if $nbProducts == 1}{l s='%d result has been found.' sprintf=[$nbProducts|intval] mod='leoproductsearch'}{else}{l s='%d results have been found.' sprintf=[$nbProducts|intval] mod='leoproductsearch'}{/if}
|
||||
</span>
|
||||
{/if}
|
||||
</h1>
|
||||
|
||||
{if $search_products.suggest || $search_products.category}
|
||||
<div class="head-leosearch-product">
|
||||
{if $search_products.suggest}
|
||||
<div class="search-in-suggest">
|
||||
<div class="search-value-title">{l s='Suggestion' mod='leoproductsearch'}</div>
|
||||
<ul>
|
||||
{foreach from=$search_products.suggest item=suggest}
|
||||
<li><a class="suggest-item" href="{$suggest.link}">{$suggest.word}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if $search_products.category}
|
||||
<div class="search-in-cat">
|
||||
<div class="search-value-title">{l s='Search in category' mod='leoproductsearch'}</div>
|
||||
<ul>
|
||||
{foreach from=$search_products.category item=category}
|
||||
<li><a href="{$category.link}">{l s='in category' mod='leoproductsearch'}: <strong>{$category.name}</strong> ({$category.count})</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if !$nbProducts}
|
||||
<p class="alert alert-warning">
|
||||
{if isset($search_query) && $search_query}
|
||||
{l s='No results were found for your search' mod='leoproductsearch'} "{if isset($search_query)}{$search_query|escape:'html':'UTF-8'}{/if}"
|
||||
{elseif isset($search_tag) && $search_tag}
|
||||
{l s='No results were found for your search' mod='leoproductsearch'} "{$search_tag|escape:'html':'UTF-8'}"
|
||||
{else}
|
||||
{l s='Please enter a search keyword' mod='leoproductsearch'}
|
||||
{/if}
|
||||
</p>
|
||||
{else}
|
||||
{if isset($instant_search) && $instant_search}
|
||||
<p class="alert alert-info">
|
||||
{if $nbProducts == 1}{l s='%d result has been found.' sprintf=[$nbProducts|intval] mod='leoproductsearch'}{else}{l s='%d results have been found.' sprintf=[$nbProducts|intval] mod='leoproductsearch'}{/if}
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<section id="products">
|
||||
<div id="">
|
||||
{block name='product_list_top'}
|
||||
{include file='catalog/_partials/products-top.tpl' listing=$search_products}
|
||||
{/block}
|
||||
</div>
|
||||
|
||||
{block name='product_list_active_filters'}
|
||||
<div id="" class="hidden-sm-down">
|
||||
{$search_products.rendered_active_filters nofilter}{* HTML form , no escape necessary *}
|
||||
</div>
|
||||
{/block}
|
||||
<div id="">
|
||||
{block name='product_list'}
|
||||
{include file='catalog/_partials/products.tpl' listing=$search_products}
|
||||
{/block}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/if}
|
||||
{/block}
|
||||
36
modules/leoproductsearch/views/templates/index.php
Normal file
36
modules/leoproductsearch/views/templates/index.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2014 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2014 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
Reference in New Issue
Block a user