Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

Adding a 'View All' to pagination options


Go to End


5 Posts   1904 Views

Avatar
neilcreagh

Community Member, 136 Posts

16 April 2011 at 1:53am

Hi, I've been trying to add a 'View All' to the pagination on a ProductGroup page in the eCommerce module eg.

< Prev | 1 | 2 | 3 | View All | Next >

So that clicking 'View All' would 'break' pagination and display all the products on one long page instead of limiting them.

Can anyone advise as to the best way to achieve this?

Thanks,
Neil

Avatar
neilcreagh

Community Member, 136 Posts

22 April 2011 at 1:18am

Anyone? Jedateach? Any help would be really appreciated, thanks.

Avatar
Jedateach

Forum Moderator, 238 Posts

25 April 2011 at 1:30pm

Edited: 25/04/2011 1:31pm

Hi Neil,

I'm not sure if we've got appropriate decorator hooks in there yet, which should be the ideal way to do it.

You'd probably need to get into the ProductGroup.php code, and customise the 'ProductsShowable' functiont so that you can disable the result limit. This should return all products, as long as you also start from 0.

Jeremy

Avatar
ciaranhickey

Community Member, 17 Posts

3 May 2011 at 1:08am

Hi Neil,

You could hardcode a parameter through the View All link such as ?end=1 and, as Jedateach said, then modify the ProductsShowable function to remove the pagination limit IF it detects the param you pass in...

eg.

if(isset($_GET['end'])){ 
 $limit = ""; 
} 
else{
 // existing code to handle pagination limits
 $limit = (isset($_GET['start']) && (int)$_GET['start'] > 0) ? (int)$_GET['start'].",".self::$page_length : "0,".self::$page_length;
}

Hope that helps.
Ciaran

Avatar
neilcreagh

Community Member, 136 Posts

3 May 2011 at 2:10am

Thanks guys!