Post by gitbro » Thu Mar 01, 2018 10:55 pm

Can someone tell me how i can get my pagination like in the picture in opencart 3.0.2.0 .. by editing the core files.
Thanks.

Attachments

pagination.jpg

pagination.jpg (4.84 KiB) Viewed 1894 times


New member

Posts

Joined
Sat Oct 31, 2015 6:58 am

Post by Wid » Thu Mar 01, 2018 11:00 pm

which version of oc are you using?

provide us a link from where you found this pagination?

take a visit to My Modules !


Wid
New member

Posts

Joined
Fri Feb 02, 2018 9:19 pm
Location - Athens/Greece

Post by gitbro » Thu Mar 01, 2018 11:17 pm

opencart 3.0.2.0 and the pic i just found on google

I have over 5000 products and the default pagination is to long.

New member

Posts

Joined
Sat Oct 31, 2015 6:58 am

Post by Wid » Fri Mar 02, 2018 12:08 am

the class pagination creates this
which is in system/library/pagination.php

if you comment Line 85 and 87 you will get somenthing like your posted image
else
if you want something like this: << < 2 3 4 > >>
you can replace lines 84-88 with this:

Code: Select all

	
if (abs($page - $i) < 2 ) { 
	if ($i === 1) {
		$output .= '<li><a href="' . str_replace(array('&amp;page={page}', '?page={page}', '&page={page}'), '', $this->url) . '">' . $i . '</a></li>';
	} else {
		$output .= '<li><a href="' . str_replace('{page}', $i, $this->url) . '">' . $i . '</a></li>';
	}
}
in first line of code above if you change number 2 with 3 you will get: << < 1 2 3 4 5 > >>
with 4: << < 1 2 3 4 5 6 > >> etc etc

take a visit to My Modules !


Wid
New member

Posts

Joined
Fri Feb 02, 2018 9:19 pm
Location - Athens/Greece

Post by gitbro » Fri Mar 02, 2018 3:08 am

nice one .. iv got a custom theme so the coding is different but you put me on the right track.

class Pagination {
public $total = 0;
public $page = 1;
public $limit = 20;
public $num_links = 8;

i just changed the 8 to 2 now only give me 2 digits ... :-)

New member

Posts

Joined
Sat Oct 31, 2015 6:58 am
Who is online

Users browsing this forum: matteovisotto and 46 guests