CMS MADE SIMPLE FORGE

Products

 

[#6909] good pagination << < 1 2 3 4 5 > >>

avatar
Created By: Igor (Osvencim)
Date Submitted: Thu Sep 29 12:09:58 -0400 2011

Assigned To:
Version: None
CMSMS Version: None
Severity: Trivial
Resolution: Won't Fix
State: Closed
Summary:
good pagination << < 1 2 3 4 5 > >>
Detailed Description:
(sorry for my bad english...)

i find this question on forum but there is no answer(moderator bug my message
because this is a hack=))

QUESTION:

By default Products module uses the following scheme for pagination:

Code:
<< < Page 1 Of 5 > >>


I'd like it to be:

Code:
< Previous 1 2 3 4 5 6 7 Next >


Is it possible? And how can I do it?

---------------------------------------------------------------------------

 may be this help

go to action.default.php

find this code (string 526 may be little more or less)

[code]
if( $page == 1 )
  {
    $smarty->assign('firstlink',$this->Lang('firstpage'));
    $smarty->assign('prevlink',$this->Lang('prevpage'));
  }
[/code]
........

go section with pages 
[code]
  else
	{
		
		$parms = $params;
		$parms['page'] = $npages;
......
[/code]

put this code
[code]
		
		$pages_array = array();

		for($z=1;$z<=$npages;$z++)
		{
			$parms['page'] = $z;
			$pages_array[$z] = $this->CreateLink($id,'default',$returnid, $z,$parms);
		}

		$smarty->assign('fucking_pages',$pages_array);	
[/code]

and put this code in section 
[code]
 if( $page == $npages )....
[/code]

go to summaty tempate and write something like this

[code]
<div style="border: 1px solid red">
{$firstlink}
{$prevlink}
{foreach from=$fucking_pages key=page_key item=page}
{if $page_key == $curpage}
	<span style="border: 1px solid red">{$page}</span>
{else}	
	{$page}
{/if}	
{/foreach}
{$nextlink}
{$lastlink}
</div>
[/code]

in my project this work good..) 


History

Comments
avatar
Date: 2011-09-29 13:48
Posted By: Robert Campbell (calguy1000)

this is not a bug... there are valid reasons why I do pagination this way...
first of them though is that 'other pagination' is essentially useless.
      
avatar
Date: 2011-09-29 13:52
Posted By: Igor (Osvencim)

I understand you, thank's and sorry) but  may be it's need other people, 
once again, sorry.
      
avatar
Date: 2011-09-29 13:59
Posted By: Igor (Osvencim)

just on forum i saw this question) and have same trouble on my project.
      
avatar
Date: 2012-03-31 06:27
Posted By: Hristo Zlatarski (cms_man)

Hi Igor,

Thanks a lot for posting this solution. Unfortunately not all of the code is
posted there.

 
Please help me out if you have the time, I need the code where says:

and put this code in section 
[code]
 if( $page == $npages )....
[/code]

Thank you a lot in advance for you help 

Hristo
      
Updates

Updated: 2011-12-02 13:31
state: Open => Closed

Updated: 2011-09-29 13:48
resolution_id: => 8