omerdavid Posted June 26, 2015 Share Posted June 26, 2015 (edited) Hello, I am new to Prestashop ,just installed ver 1.6, the search block results shows the category name and the product name, i would like to view only the product name without the his category ? Thanx Omer Edited June 26, 2015 by omerdavid (see edit history) Link to comment Share on other sites More sharing options...
musicmaster Posted June 26, 2015 Share Posted June 26, 2015 The rendering of the search result details is done in the product-list.tpl file. But that file handles also similar list on for example the homepage. Link to comment Share on other sites More sharing options...
omerdavid Posted June 26, 2015 Author Share Posted June 26, 2015 (edited) Thanx, if i understood right,if i will edit the product-list.tpl it will influnce the home page ,therefore it is better to use the Triple edit script ? Edited June 26, 2015 by omerdavid (see edit history) Link to comment Share on other sites More sharing options...
musicmaster Posted June 26, 2015 Share Posted June 26, 2015 I am not sure if I understand your question right. You wrote about not wanting to show some information in your search results. That is a matter of rendition and you can change that in the template (.tpl) file. If you do not want to affect other listings you copy make a copy of the product-list.tpl file, call it product-list2.tpl and modify search.tpl so that it refers to that file. My Triple Edit script is about changing products as they are stored in the database. It offers many mass edit features that make it possible to change a lot of products at once (for example increasing their price). However, that is not the kind of thing that your question is about. Link to comment Share on other sites More sharing options...
omerdavid Posted June 28, 2015 Author Share Posted June 28, 2015 Hey i did'nt explain the question right ,what i meant is when entering a word into the search block before pressing the search botton,it show the catagory name and the product name , probebly it is the ajax that pops up the quick results and i would like this results to show only the product info.without the category . Link to comment Share on other sites More sharing options...
omerdavid Posted June 28, 2015 Author Share Posted June 28, 2015 I have found the ajax call in the Search.php, when deleting the category name from the sql 'select' statments ,the ajax results showing 'undefind' word instead of the category name and than the product name, probebley there is a function that getts the ajax results and assigns the returned array while replacing the values which are not found or null ....but i could'nt find the function that getts the results. Link to comment Share on other sites More sharing options...
musicmaster Posted June 28, 2015 Share Posted June 28, 2015 This is determined in the file blocksearch-instantsearch.tpl from the blocksearch module (quick search block). There is one in the modules directory but very likely it is overridden by your theme. This file starts as follows: {if $ajaxsearch} <script type="text/javascript"> // <![CDATA[ $('document').ready(function() { var $input = $("#search_query_{$blocksearch_type}"); $input.autocomplete( '{if $search_ssl == 1}{$link->getPageLink('search', true)|addslashes}{else}{$link->getPageLink('search')|addslashes}{/if}', { minChars: 3, max: 10, width: 500, selectFirst: false, scroll: false, dataType: "json", formatItem: function(data, i, max, value, term) { value=value.replace(/[^>]*> /,''); return value; }, I have added the blue line (value=value.replace(/[^>]*> /,''). It takes care of removing the category part. Be careful that each time you make a change in this file you need to empty the Prestashop cache. Otherwise the change will not be applied. This applies even when have switched caching off. Link to comment Share on other sites More sharing options...
omerdavid Posted June 28, 2015 Author Share Posted June 28, 2015 i tried to log in to my dash-board in order to clear cache ,suddently my dash board will not load ,i can only see the top header with the quick access , cart + some more icons... till i fix it.... Link to comment Share on other sites More sharing options...
omerdavid Posted June 28, 2015 Author Share Posted June 28, 2015 o.k. this is how the blocksearch-instantsearch.tpl code looks like now ,i have addad the 'value.replace' line and cleared the prestashop cache,but steel the category name is shown when entering a word into the the search block, {if $ajaxsearch} <script type="text/javascript"> // <![CDATA[ $('document').ready( function() { $("#search_query_{$blocksearch_type}") .autocomplete( '{if $search_ssl == 1}{$link->getPageLink('search', true)|addslashes}{else}{$link->getPageLink('search')|addslashes}{/if}', { minChars: 3, max: 10, width: 500, selectFirst: false, scroll: false, dataType: "json", formatItem: function(data, i, max, value, term) { value=value.replace(/[^>]*> /,''); 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; }, Link to comment Share on other sites More sharing options...
musicmaster Posted June 28, 2015 Share Posted June 28, 2015 (edited) Did you change the right blocksearch-instantsearch.tpl? As I mentioned your theme may have its own one. You also look in the source code of your page if the modification is there. In my page the javascript of blocksearch-instantsearch.tpl is in the source code at around line 190. Edited June 28, 2015 by musicmaster (see edit history) Link to comment Share on other sites More sharing options...
omerdavid Posted June 28, 2015 Author Share Posted June 28, 2015 i have only one blocksearch-instantsearch.tpl file in the C:\wamp\www\modules\blocksearch Link to comment Share on other sites More sharing options...
musicmaster Posted June 29, 2015 Share Posted June 29, 2015 Did you look in the source code... Link to comment Share on other sites More sharing options...
omerdavid Posted June 29, 2015 Author Share Posted June 29, 2015 yes i did look, i did'nt see any function that deals with either ajax or the search block, Link to comment Share on other sites More sharing options...
omerdavid Posted June 29, 2015 Author Share Posted June 29, 2015 i am trying to debug using PHP storm but with no success Link to comment Share on other sites More sharing options...
musicmaster Posted June 29, 2015 Share Posted June 29, 2015 You don't need php tools. You just need to do a text search in the source code for the javascript that is generated by blocksearch-instantsearch.tpl minChars: 3, max: 10, width: 500, etc... Link to comment Share on other sites More sharing options...
omerdavid Posted June 30, 2015 Author Share Posted June 30, 2015 i did view source to make text search on the main page wheres the search text-box, as you suggested before, did'nt find anything that looks like the the code i am looking, i used php tools in order to understand the 'ajax search' work flow this way i might know which file/function is being called Link to comment Share on other sites More sharing options...
omerdavid Posted June 30, 2015 Author Share Posted June 30, 2015 OK, we did it, the function was in the blocksearch.js in the theme folder. thanks a lotttt. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now