Dolke Posted July 23, 2013 Share Posted July 23, 2013 (edited) Hello. I'm using instant search on my website.There are exactly 3270 product indexed. When I'm searching for some products it shows me 10 results. I would like to change this and get 20 or maybe more results shown. How to do that? P.S. check the printscreen below: My second question would be why it takes around 7-9 seconds before instant search gives me suggestions or search results in other words? You can go to www.dekom.co.rs and try it. Thank you all in advance Dean Edited July 23, 2013 by Dolke (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted July 23, 2013 Share Posted July 23, 2013 i think that the solution is in the blocksearch-instantsearch.tpl file you've got there: if $ajaxsearch} <script type="text/javascript"> // <![CDATA[ $('document').ready( function() { $("#search_query_{$blocksearch_type}") .autocomplete( '{if $search_ssl == 1}{$link->getPageLink('search', true)}{else}{$link->getPageLink('search')}{/if}', { minChars: 3, max: 10, width: 500, selectFirst: false, scroll: false, dataType: "json", formatItem: function(data, i, max, value, term) { return value; }, parse: function(data) { var mytab = new Array(); for (var i = 0; i < data.length; i++) mytab[mytab.length] = { data: data[i], value: data[i].cname + ' > ' + data[i].pname }; return mytab; }, extraParams: { ajaxSearch: 1, id_lang: {$cookie->id_lang} } } ) .result(function(event, data, formatted) { $('#search_query_{$blocksearch_type}').val(data.pname); document.location.href = data.product_link; }) }); // ]]> </script> {/if} as you can see, there is a variable: max: 10, i never tested this, but i suppose that this is the value of the number of results Link to comment Share on other sites More sharing options...
Dolke Posted July 23, 2013 Author Share Posted July 23, 2013 (edited) I tested this right now, so changed the value in the file, deleted the browser cash and tried again but 10 results remains. Edited July 23, 2013 by Dolke (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted July 23, 2013 Share Posted July 23, 2013 so the problem is somewhere else, thanks for info, im going to check it on my own demo store Link to comment Share on other sites More sharing options...
Dolke Posted July 23, 2013 Author Share Posted July 23, 2013 Thanks Vekia I appreciate it Link to comment Share on other sites More sharing options...
vekia Posted July 23, 2013 Share Posted July 23, 2013 i've got bad news. my method works. But you have to define also LIMIT in the class: Search.php open the file classes/Search.php, you've got there: if ($ajax) { $sql = 'SELECT DISTINCT p.id_product, pl.name pname, cl.name cname, cl.link_rewrite crewrite, pl.link_rewrite prewrite '.$score.' FROM '._DB_PREFIX_.'product p INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON ( p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').' ) '.Shop::addSqlAssociation('product', 'p').' INNER JOIN `'._DB_PREFIX_.'category_lang` cl ON ( product_shop.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').' ) WHERE p.`id_product` '.$product_pool.' ORDER BY position DESC LIMIT 10'; return $db->executeS($sql); } increase the value of the LIMIT 10 now in the blocksearch-instatsearch.tpl file you have to define the number of results (max variable) here is full step by step tutorial: increase the number of the AJAX hint search results Link to comment Share on other sites More sharing options...
vekia Posted July 23, 2013 Share Posted July 23, 2013 im going to write tutorial related to this case, problem is noteworthy Link to comment Share on other sites More sharing options...
Dolke Posted July 23, 2013 Author Share Posted July 23, 2013 (edited) Beautiful Vekia. You go ahead and add this to the tutorial you are making. It seems to me that I always found some stuff nobody tried before and you find a great and easy fix for it. We are working great together friend. Of course, you should take more credit then I but still great cooperation OK this first part of this topic is solved. I guess I should have made separate threads but is there a reason for the delay problem in my second q? Thanks. Edited July 23, 2013 by Dolke (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted July 23, 2013 Share Posted July 23, 2013 it's weird coz i don't have to wait 7-9 seconds, for me results appears after 1-3 sec take a look i recorded it: no worries, i will remove the vid Link to comment Share on other sites More sharing options...
Dolke Posted July 23, 2013 Author Share Posted July 23, 2013 Hm very interesting... Please don't remove the video just yet. I would like to show this to my colleague. What kind of internet connection do you have? Link to comment Share on other sites More sharing options...
vekia Posted July 23, 2013 Share Posted July 23, 2013 it's a mobile 4G LTE connection ~100mb/s Link to comment Share on other sites More sharing options...
Dolke Posted July 23, 2013 Author Share Posted July 23, 2013 Can that be the answer for the 2nd question? I have 6mb/s ADSL connection but it is shared between several PCs... Link to comment Share on other sites More sharing options...
vekia Posted July 23, 2013 Share Posted July 23, 2013 i changed my lte wireless to the cable 8mb DSL still the same, nothing changed Link to comment Share on other sites More sharing options...
Dolke Posted July 23, 2013 Author Share Posted July 23, 2013 Thanks for the quick info... Ill continue searching... Link to comment Share on other sites More sharing options...
vekia Posted July 23, 2013 Share Posted July 23, 2013 tut ready: increase the number of search results i put there video, you will have got a little advertise once again Link to comment Share on other sites More sharing options...
Dolke Posted July 23, 2013 Author Share Posted July 23, 2013 Hehe great. Thanks for the advert although my website is for domestic visitors and customers only but extra traffic doesn't really hurt Link to comment Share on other sites More sharing options...
Recommended Posts