Jump to content

remove results from block search


omerdavid

Recommended Posts

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

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

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

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

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

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 by musicmaster (see edit history)
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...