Search Result

HI every one how are you? sorrry I know this question been answered so many times but i cant find it I am using 2.1.4 and when ever some one click on search without any word it show all our DB can some one tell me how can we block this atlist they need to put 1-4 word to show search result please advice thank you

I had not thought about that. I see that it happens in version 2.1.1 and 2.1.4

My thought would have it just pop up a message that the customer did not enter any search terms



I'll keep my eye on this thread,

David

Would be a relatively simple change to check if a search request had a configurable length value and if not, generated an error and returned the user to the page they came from.

[quote name='tbirnseth' timestamp='1310155673' post='116627']

Would be a relatively simple change to check if a search request had a configurable length value and if not, generated an error and returned the user to the page they came from.

[/quote]

Can you please tell me little more how to do it ? i am not tecsabby if you can give little more hint where and how will be greatly appreciate it thank you again

Not tested, but if you create a file called:

addons/my_changes/controllers/customer/init.post.php

with this content:

```php

if( !defined('AREA') ) die('Access denied');

define('MinSearchLen', 3);

if( $_SERVER['REQUEST_METHOD'] == 'POST'
&& !empty($_REQUEST['search_performed'])
&& isset($_REQUEST['q'])
&& strlen($_REQUEST['q']) < MinSearchLen ) {
fn_set_notification('C', "Search", sprintf("Search string length must be greater than or equal to '%d' characters", MinSearchLen) );
return array(CONTROLLER_STATUS_REDIRECT, Registry::get('config.current_url') ? Registery::get('config.current_url') : INDEX_SCRIPT);
}
return array(CONTROLLER_STATUS_OK);
?>

```

It “should” deny search strings less than MinSearchLen characters.

[quote name='tbirnseth' timestamp='1310162227' post='116648']

Not tested, but if you create a file called:

addons/my_changes/controllers/customer/init.post.php

with this content:

```php

if( !defined('AREA') ) die('Access denied');

define('MinSearchLen', 3);

if( $_SERVER['REQUEST_METHOD'] == 'POST'
&& !empty($_REQUEST['search_performed'])
&& isset($_REQUEST['q'])
&& strlen($_REQUEST['q']) < MinSearchLen ) {
fn_set_notification('C', "Search", sprintf("Search string length must be greater than or equal to '%d' characters", MinSearchLen) );
return array(CONTROLLER_STATUS_REDIRECT, Registry::get('config.current_url') ? Registery::get('config.current_url') : INDEX_SCRIPT);
}
return array(CONTROLLER_STATUS_OK);
?>

```

It “should” deny search strings less than MinSearchLen characters.

[/quote]

Thank you FYI I have my changes addon is disable… do I still i need to enabel that to do this…

[quote]Thank you FYI I have my changes addon is disable… do I still i need to enabel that to do this… [/quote]



Yes!

If that's the addon you choose to use then yes. They all work the same. Why have the my_changes addon disabled? As distributed, it does nothing. It's basically empty.

[quote name=‘tbirnseth’ timestamp=‘1310179528’ post=‘116671’]

If that’s the addon you choose to use then yes. They all work the same. Why have the my_changes addon disabled? As distributed, it does nothing. It’s basically empty.

[/quote]

MY site is so slow i am trying to improve that some people suggest me to disabled all the addon that i dont use…

Most site speed issues are a result of using too large/dense images or are problems related to the host's ability to serve the pages.