Jump to:

2076 Posts in 857 Topics by 449 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » Adding a 'View All' to pagination options

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, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1198 Views
  • neilcreagh
    Avatar
    Community Member
    88 Posts

    Adding a 'View All' to pagination options Link to this post

    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

  • neilcreagh
    Avatar
    Community Member
    88 Posts

    Re: Adding a 'View All' to pagination options Link to this post

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

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts

    Re: Adding a 'View All' to pagination options Link to this post

    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

  • ciaranhickey
    Avatar
    Community Member
    17 Posts

    Re: Adding a 'View All' to pagination options Link to this post

    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

  • neilcreagh
    Avatar
    Community Member
    88 Posts

    Re: Adding a 'View All' to pagination options Link to this post

    Thanks guys!

    1198 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.