You are here:  » Can I possibly show all search results rather than 10 at a time?

Support Forum



Can I possibly show all search results rather than 10 at a time?

Submitted by harican on Tue, 2006-12-26 20:45 in

Can I possibly show all results rather than 10 at a time or at least give the user the option to show all results?

Actually, I would like to have:
Previous 1 2 3 4 Next All

Your software currently shows:
Previous 1 2 3 4 Next

Submitted by support on Tue, 2006-12-26 21:34

Hi,

The easiest thing to do would be to set the maximum number of results per page to a very large number. In config.php use something like:

  $config_resultsPerPage = 65536;

However, you should only do this if you only have a small number of products. Any more than a couple of hundred and you will soon run into memory problems unless the code is rewritten to handle this by using unbuffered queries (where the result of a query is not all loaded into memory)....!

Cheers,
David.

Submitted by Gobbo on Sat, 2012-09-08 15:08

Hi David,

But how can we increase the number of page numbers? i.e. Previous 1 2 3 4 5 6 7 8 6 9 10 11 12 13 14 15 16 17 18 19 20 Next

Kind Regards,
Gobbo

Submitted by support on Sun, 2012-09-09 13:16

Hi Gobbo,

Sure - look for the following code beginning at line 30 if html/navigation.php:

    if ($page < 5)
    {
      $pageFrom = 1;
      $pageTo = 9;
    }
    else
    {
      $pageFrom = ($page - 4);
      $pageTo = ($page + 4);
    }
    if ($pageTo > $totalPages)
    {
      $pageTo = $totalPages;
      $pageFrom = $totalPages - 8;
    }

...and REPLACE this with:

    $p = 19;
    if ($page < (($p+1)/2))
    {
      $pageFrom = 1;
      $pageTo = $p;
    }
    else
    {
      $pageFrom = ($page - (($p-1)/2));
      $pageTo = ($page + (($p-1)/2));
    }
    if ($pageTo > $totalPages)
    {
      $pageTo = $totalPages;
      $pageFrom = $totalPages - ($p-1);
    }

Adjust the value of $p in the first line of the replacement as required but it should be an ODD number for the gaps etc. to calculate correctly.

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Gobbo on Sun, 2012-09-09 16:16

David,

I just wanted to increase the page count to 20 so changed $pageTo = 9; to $pageTo = 20;.

I guess the above is to show all pages?

Kind Regards,
Gobbo.

Submitted by support on Sun, 2012-09-09 17:53

Hi Gobbo,

Each numeric entry in that block of code has to relate to the maximum number of pages you want to be displayed so the modification does this by calculation rather than having them hard coded. Bear in mind that it's a maximum so you'll only see 19+ pages if there are > 200 results for the test query (use bw: to return all products)...

Cheers,
David.
--
PriceTapestry.com