You are here:  » If searchresult is greater than ...


If searchresult is greater than ...

Submitted by Peter on Sun, 2006-11-12 11:50 in

Hi David,

is it possible, if the searchresult is greater than (for example) 10,000 products, it shows only 10,000 products and a text who inform the user that there are shown only 10,000 products?

i hope you understand what i mean :)

thanks, Peter

Submitted by support on Sun, 2006-11-12 18:42

Hi Peter,

In search.php you will find this code:

    $resultCount = $rows[0]["resultcount"];
    $banner["h2"] = translate("Product search results for")." <strong>".htmlentities($q,ENT_QUOTES,$config_charset)."</strong>&nbsp;";

You could change this to test the value of $resultCount and then display an alternative message and also cap the value doing something like this:

    $resultCount = $rows[0]["resultcount"];
    if ($resultCount >= 10000)
    {
      $banner["h2"] = translate("Product search results for")." <strong>".htmlentities($q,ENT_QUOTES,$config_charset)."</strong>&nbsp;-&nbsp;Maximum 10000 results reached&nbsp;";
      $resultCount = 10000;
    }
    else
    {
      $banner["h2"] = translate("Product search results for")." <strong>".htmlentities($q,ENT_QUOTES,$config_charset)."</strong>&nbsp;";
    }

Hope this helps,
Cheers,
David.