Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Pagination on Category Page Rate Topic   - - - - -

 
  • wkress
  • Member
  • Members
  • Join Date: 25-Mar 08
  • 48 posts

Posted 10 December 2008 - 07:06 PM #1

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
Nearly Normal Warren
CS-Cart 1.3.5 - SP2
Kickin' out the jams on http://www.A3Radio.com ... where all the mics smell like beer.
The rooster is on the prowl.

 
  • roban
  • Senior Member
  • Moderators
  • Join Date: 23-Oct 06
  • 1132 posts

Posted 10 December 2008 - 07:45 PM #2

Have you seen this:

http://vb.cs-cart.co...t=previous/next

 
  • wkress
  • Member
  • Members
  • Join Date: 25-Mar 08
  • 48 posts

Posted 10 December 2008 - 08:04 PM #3

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 -
http://forum.cs-cart...hlight=previous

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.
Nearly Normal Warren
CS-Cart 1.3.5 - SP2
Kickin' out the jams on http://www.A3Radio.com ... where all the mics smell like beer.
The rooster is on the prowl.

 
  • wkress
  • Member
  • Members
  • Join Date: 25-Mar 08
  • 48 posts

Posted 11 December 2008 - 03:16 AM #4

Ok... I wrote the code

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

After (about line 23) -

<p></p>
<div align="center" class="pagination-wrapper">
{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}<a href="{$index_script}?{$qstring}&page={$smarty.capture.PrevPage-1}" {$onclick} class="pagination-link"><<Prev |</a>
{/if}
{if $paginations.$id.current_page < $paginations.$id.total_pages}
{capture name="NextPage"}{$paginations.$id.current_page}{/capture}<a href="{$index_script}?{$qstring}&page={$smarty.capture.NextPage+1}" {$onclick} class="pagination-link">Next>> |</a>
{/if}
{* END Warren's Prev/Next Page *}
Nearly Normal Warren
CS-Cart 1.3.5 - SP2
Kickin' out the jams on http://www.A3Radio.com ... where all the mics smell like beer.
The rooster is on the prowl.

 
  • johnjohn
  • Member
  • Members
  • Join Date: 05-Mar 09
  • 35 posts

Posted 25 June 2009 - 06:43 AM #5

The variables changed slightly in ver 2.0:

{if $pagination.current_page > 1}
{capture name="PrevPage"}{$pagination.current_page}{/capture}<a href="{$index_script}?{$qstring}&page={$smarty.capture.PrevPage-1}" {$onclick} class="pagination-link">« Prev</a>
{/if}
{if $pagination.current_page < $pagination.total_pages}
{capture name="NextPage"}{$pagination.current_page}{/capture}<a href="{$index_script}?{$qstring}&page={$smarty.capture.NextPage+1}" {$onclick} class="pagination-link">Next »</a>
{/if}



 
  • Darius
  • Douchebag
  • Members
  • Join Date: 20-Apr 08
  • 3531 posts

Posted 25 June 2009 - 06:49 AM #6

The variables changed slightly in ver 2.0:


Is this a solution?

http://forum.cs-cart...t=previous/next
This is also required ?

 
  • knowmad
  • Junior Member
  • Members
  • Join Date: 10-Jan 07
  • 14 posts

Posted 12 February 2010 - 05:52 AM #7

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}
    <span class="disabled">{$lang.previous}</span>
{else}
    <a href="{$index_script}?{$qstring}&page={$smarty.capture.CurrPage-1}" {$onclick} class="pagination-link">{$lang.previous}</a>
{/if}


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

{if $pagination.current_page == $pagination.total_pages}
    <span class="disabled">{$lang.next}</span>
{else}
    <a href="{$index_script}?{$qstring}&page={$smarty.capture.CurrPage+1}" {$onclick} class="pagination-link">{$lang.next}</a>
{/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.
--
Knowmad Technologies - E-business Web Sites
http://www.knowmad.com