/**
  * Returns a list of all the comments attached to this record.
  *
  * @return PaginatedList
  */
 public function Comments()
 {
     $order = Commenting::get_config_value($this->ownerBaseClass, 'order_comments_by');
     $list = new PaginatedList(Comment::get()->where(sprintf("ParentID = '%s' AND BaseClass = '%s'", $this->owner->ID, $this->ownerBaseClass))->sort($order));
     $list->setPageLength(Commenting::get_config_value($this->ownerBaseClass, 'comments_per_page'));
     $controller = Controller::curr();
     $list->setPageStart($controller->request->getVar("commentsstart" . $this->owner->ID));
     $list->setPaginationGetVar("commentsstart" . $this->owner->ID);
     $list->MoreThanOnePage();
     return $list;
 }
 /**
  * All viewable product groups of this group.
  *
  * @param int $numberOfProductGroups Number of product groups to display
  * 
  * @return PaginatedList
  * 
  * @author Sebastian Diel <*****@*****.**>, Ramon Kupper <*****@*****.**>
  * @since 04.01.2014
  */
 public function getViewableChildren($numberOfProductGroups = false)
 {
     if ($this->viewableChildren === null) {
         $viewableChildren = new ArrayList();
         foreach ($this->Children() as $child) {
             if ($child->hasProductsOrChildren()) {
                 $viewableChildren->push($child);
             }
         }
         if ($viewableChildren->count() > 0) {
             if ($numberOfProductGroups == false) {
                 if ($this->productGroupsPerPage) {
                     $pageLength = $this->productGroupsPerPage;
                 } else {
                     $pageLength = SilvercartConfig::ProductGroupsPerPage();
                 }
             } else {
                 $pageLength = $numberOfProductGroups;
             }
             $pageStart = $this->getSqlOffsetForProductGroups($numberOfProductGroups);
             $viewableChildrenPage = new PaginatedList($viewableChildren, $this->getRequest());
             $viewableChildrenPage->setPaginationGetVar('groupStart');
             $viewableChildrenPage->setPageStart($pageStart);
             $viewableChildrenPage->setPageLength($pageLength);
             $this->viewableChildren = $viewableChildrenPage;
         } else {
             return false;
         }
     }
     return $this->viewableChildren;
 }
 /**
  * Returns the list of replies paged, with spam and unmoderated items excluded, for use in the frontend
  *
  * @return PaginatedList
  */
 public function PagedReplies()
 {
     $list = $this->Replies();
     // Add pagination
     $list = new PaginatedList($list, Controller::curr()->getRequest());
     $list->setPaginationGetVar('repliesstart' . $this->ID);
     $list->setPageLength($this->getOption('comments_per_page'));
     $this->extend('updatePagedReplies', $list);
     return $list;
 }