Limit Search Results


i have a cs-cart 2.2.4 store … and i want to limit return search results … to 100 for example !

i think that a search that return much more results it's done for nothing … it's incorect and no one will spend time to actually loop throught more results !

so how can i do that ?!

directly from ??? … i've tried there to put a LIMIT 100 to the search query … but it is the same !


Please open the core/fn.catalog.php file and add the following line:

$total = (AREA == 'C' && !empty($params['search_performed']) && $total > 100) ? 100 : $total;

after this one:

$total = db_get_found_rows();

Hope this will help.


i found only this in fn.catalog.php ( i have 2.2.4 version of cs-cart)

if (!empty($items_per_page)) {

$total = !empty($total)? $total : db_get_found_rows();

fn_paginate($params['page'], $total, $items_per_page);

} else {

$total = count($products);



i want this limit ( for example 100) to be in query search function … so the serach query to return only first 100 matches … nothing more !



Another code modification is required for old CS-Cart versions. We will check it

hi Dragos,

our specialists will be glad to make this small customization for you so please don't hesitate to contact us

best regards,

WSA team

Try to add:

$total = (AREA == 'C' && !empty($params['search_performed']) && $total > 100) ? 100 : $total;

after this line:

$total = !empty($total)? $total : db_get_found_rows();


yes that's working !

i search this function db_get_found_rows() … and it's actually get's :

“Get the number of found rows from the last query”

… from the database performance point … couldn't we set this limitaion in the query section !

right now … with this solution we impose limitation to the rendering part of the page … not to the database query !

in what phase we use function from … fn_search() … function ?!



Your question is not quite clear. Please clarify