Jump to content

[Solved] Adjusting Pagination Behavior


Recommended Posts

I'm hoping to make some modifications to the way pagination is handled on product lists, but I'm not really sure where to start (well, I know to start with pagination.tpl, but I don't know what to do once there). I'd like to add some information to the pagination area, as well as a "Show All" option. Specifically, I'd like to have something like this:

Showing 1 - 12 of 38 Products | Show All
(Where "Show All" is a link to do just that).

I think I can figure out how to show the number of products and which of them are currently being displayed, but I haven't found any ideas on how to pull off a "Show All" link. Anyone able to offer some help?

Thanks!

Link to comment
Share on other sites

  • 4 weeks later...

If anyone is still looking for a solution to this, I've come up with a kind of sloppy one that nonetheless works. The code for the "Show All" link should look like this:

Show All


with n set to a ridiculously high number, higher than any of your categories will ever hold. This forces the page to display everything in the category on one page. For the "Show x - y of z products," here's the code:

Showing {(Configuration::get('PS_PRODUCTS_PER_PAGE') * ($p - 1)) + 1} - {if $maxProducts > $nb_products || $n > $nb_products}{$nb_products}{else}{$maxProducts}{/if} of {$nb_products} products



Again, this is a pretty sloppy way to do it, but it does work. If I'm doing something horrifically wrong/dangerous, please let me know!

Link to comment
Share on other sites

  • 1 year later...

Your code works fine only on the first page: "Products 1 to 4 of 4" but when I click on the second page display becomes "Products 4-1 of 4".

What should I do to make it work every time I change page?

 

Thanks

Link to comment
Share on other sites

×
×
  • Create New...