Pagination on Category Page

I know the answer is going to make me feel stupid but I’m ready to pay the price.



My client insists on previous/next links in the pagination for the category pages that list products.



I see forum discussion that refers to this as though it already exists or is an Admin setting but I don’t have it, can’t find a setting for it in Admin and tried the “Dynamic HTML” switch for pagination both off and on.



Looking at pagination.tpl it expects to get $paginations.$id.prev_page or $paginations.$id.next_page but I don’t show those choices on the page, just -



Pages: 1 2 3 Range: 1 … 3 Full list

Have you seen this:



[url]http://vb.cs-cart.com/showthread.php?t=9051&highlight=previous%2Fnext[/url]

Yes I did see that post but I believe it refers to a Prev/Next on the Product Detail page, not the Category listing.



This Post -

[url]http://forum.cs-cart.com/showthread.php?t=9191&highlight=previous[/url]



seems to refer to the Category page and gives the impression that the Prev/Next was already there but that he had a problem with when they were greyed-out.

Ok… I wrote the code



it goes in whatever_skin/customer/common_templates/pagination.tpl



After (about line 23) -




{if $paginations.$id.current_page != 'full_list'}

Add this -

{* Warren's Prev/Next Page *}
{if $paginations.$id.current_page > 1}
{capture name="PrevPage"}{$paginations.$id.current_page}{/capture}<
{/if}
{if $paginations.$id.current_page < $paginations.$id.total_pages}
{capture name="NextPage"}{$paginations.$id.current_page}{/capture}
Next>> |
{/if}
{* END Warren's Prev/Next Page *}

The variables changed slightly in ver 2.0:

[QUOTE]

{if $pagination.current_page > 1}

{capture name=“PrevPage”}{$pagination.current_page}{/capture}« Prev

{/if}

{if $pagination.current_page < $pagination.total_pages}

{capture name=“NextPage”}{$pagination.current_page}{/capture}
Next »

{/if}[/QUOTE]

[quote name=‘johnjohn’]The variables changed slightly in ver 2.0:[/QUOTE]



Is this a solution?



[url]http://forum.cs-cart.com/showthread.php?t=9051&highlight=previous%2Fnext[/url]

This is also required ?

None of those examples were working for me in v2.0.12. However, they did lead me to a solution.



Edit the template customers/common_templates/pagination.tpl. Add the following code after the “{$lang.navi_pages}:” line:



{capture name="CurrPage"}{$pagination.current_page}{/capture}
{if $pagination.current_page == 1}
{$lang.previous}
{else}
{$lang.previous}
{/if}






Then add the following after the block that starts with “{if $pagination.next_range}”:


{if $pagination.current_page == $pagination.total_pages}
{$lang.next}
{else}
{$lang.next}
{/if}




Finally add the following to your styles.css to grey out the text when on first & last page:



.disabled {
color:grey;
}






EDIT #1: It turns out that you don’t have to disable the Ajax presentation. During testing, I had put the code outside of the pagination div which prevented my url’s from being correctly re-written for Ajax. Also put the name of the template file to edit.



EDIT #2: OK, spoke to soon about supporting Ajax. The link still work with Ajax enabled but they will cause a page refresh to occur. The page number links still behave correctly.