News:

Looking for documentation? Take a look on our wiki

Main Menu

Too many pages at Pagination in browsepage

Started by capricornio, November 27, 2012, 23:21:40 PM

Previous topic - Next topic

capricornio

My customer has a 180 products in one category.
Default view is 3 products in a row and 3 rows on a single page (thus default limit is 9 products).
Now my pagination on the top of the page shows pagenrs 1 to 20, which does not fit in my template layout (already hide the start, prev, next, end buttons).

Is there a way to adjust the pagenumbers to display only 6 pagenumbers instead of all (where pagenrs depend on the page you are in), or otherwise should it be possible to adjust the product results box dynamically based on the number of products found ?

bytelord

#1
hmm...

I think that vm already changes it every "10" pages .... and i think also that virtuemart uses joomla pagination, works like this:

Start Prev 23 24 25 26 27 28 29 30 32 32 Next Last

So you could edit the original joomla pagination.php file and make a small hack. The file is located under  libraries\joomla\html\pagination.php, around line 107 you will find:

// Set the pagination iteration loop values.
$displayedPages = 10;


Changed the "10" to the prefered one ... like 5

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

capricornio

Quote from: bytelord on November 28, 2012, 00:23:38 AM
hmm...

I think that vm already changes it every "10" pages .... and i think also that virtuemart uses joomla pagination, works like this:

Start Prev 23 24 25 26 27 28 29 30 32 32 Next Last

So you could edit the original joomla pagination.php file and make a small hack. The file is located under  libraries\joomla\html\pagination.php, around line 107 you will find:

// Set the pagination iteration loop values.
$displayedPages = 10;


Changed the "10" to the prefered one ... like 5

Regards

Thnx, did the trick almost.
I've used 5 as displayed pages and set the limitbox to 3, which shows indeed max 5 pagenrs, but after going from page 3 to 4 it shows me pagenrs like 1.5, 2.5, 3.5, 4.5 and 5.5

capricornio

Okay found it.

Replaced
// Set the pagination iteration loop values.
$displayedPages = 10;
$this->set('pages.start', $this->get('pages.current') - ($displayedPages / 2));


With

// Set the pagination iteration loop values.
$displayedPages = 5;
$this->set('pages.start', $this->get('pages.current') - ceil(($displayedPages / 2)));

bytelord

Hi,

Nice, you round them ... i don't have issues like that, strange.
ohh, it needs even numbers that can be divided by 2 ... like 4, 6, 8, 10, 20, ... etc

Regards

Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

kelecz

Quote from: capricornio on November 28, 2012, 01:51:08 AM
Okay found it.

Replaced
// Set the pagination iteration loop values.
$displayedPages = 10;
$this->set('pages.start', $this->get('pages.current') - ($displayedPages / 2));


With

// Set the pagination iteration loop values.
$displayedPages = 5;
$this->set('pages.start', $this->get('pages.current') - ceil(($displayedPages / 2)));


That works perfect! THX