Jump to:

23480 Posts in 18951 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Pagination issue 2.4

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 211 Views
  • Judderman
    Community Member
    1 Post

    Pagination issue 2.4 Link to this post


    I'm Editing one of my older 2.4 sites as the client has requested the jquery pagination needs to be a physical one which i added to the Category page yesterday, this was working initially but has since stopped giving me any results. I cant fault the code or find any reason why in the instance of the pagination function its no longer giving any results?

    The first function retrieves all the products to this category, this works but when i reference the function or replicate the process in pagination it doesn't return any results or errors?

    //Return the list of products for this category
       public function getProductsList(){
          return $this->Products(Null, 'Title ASC');
       //Return the list of products using pagination
       function getChildPages() {
          if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1) $_GET['start'] = 0;
             $SQL_start = (int)$_GET['start'];
             $listedProducts = $this->getProductsList();
             $doSet = new DataObjectSet();
             foreach ($listedProducts as $listedProduct) {
                if ($listedProduct->canView()) {
          $doSet->setPageLimits($SQL_start, 12, $doSet->Count());
       return $doSet;

    In the page we have:

    <div class="product_navigation">
    <% if getChildPages.MoreThanOnePage %><p><% if getChildPages.PrevLink %><a href="$getChildPages.PrevLink">&lt; Prev</a> | <% end_if %><% control getChildPages.Pages %><% if CurrentBool %><strong> $PageNum </strong><% else %><a href="$Link" title="Go to page $PageNum">$PageNum</a><% end_if %><% end_control %><% if getChildPages.NextLink %> | <a href="$getChildPages.NextLink">Next &gt;</a><% end_if %></p><% end_if %>
    <div class="products">
       <% control getChildPages.Pagination %>
       <div class="box">
          <a href="$Link" title="$Title">
          <div class="img_holder">
          <% if MainImage %>
        <% else %>
             <img src="$ThemeDir/images/comingsoon.jpg" alt="Image coming soon" />
          <% end_if %>
          <h1>$Year $Make<br/>$Model</h1>
          <p>more information &raquo;</p>
    <% end_control %>

    Any help would be welcomed

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.