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

Pagination


Go to End


6 Posts   5917 Views

Avatar
grilldan

Community Member, 135 Posts

8 July 2009 at 4:41pm

I don't know if anyone has tried to add pagination to the products pages, but I successfully added it. If anyone wants to do this as well, my contact information is in my profile.

If there is a big response to this, I will post a guide to do it, in here.

Avatar
Oceanc

Community Member, 7 Posts

12 July 2009 at 7:58am

Would you mind if you post a link for your site ?

Avatar
Martijn

Community Member, 271 Posts

28 July 2009 at 2:21pm

Stevie Wonders how you did it :)

Avatar
grilldan

Community Member, 135 Posts

7 August 2009 at 3:22am

Edited: 07/08/2009 3:23am

First, add this code to "/ecommerce/code/ProductGroup.php"

class ProductGroup_Controller extends Page_Controller {

...
	
function ProductList() {
  if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1) $_GET['start'] = 0;
  $SQL_start = (int)$_GET['start'];
  $doSet = DataObject::get(
    $callerClass = "Product",
    $filter = "`ParentID` = '".$this->ID."'",
    $sort = "",
    $join = "",
    $limit = "{$SQL_start},8"
  );
 
  return $doSet ? $doSet : false;
}

In the above statement, the "8" in the $limit variable is how many results you would like per page.

Then add this to "/themes/*_ecommerce/templates/Layout/ProductGroup.ss"

<div id="pages">
  <% if ProductList.MoreThanOnePage %>
  <p>
    <% if ProductList.PrevLink %>
    	<a href="$ProductList.PrevLink">&laquo; Previous</a> |
    <% end_if %>

    	Page:
    <% control ProductList.Pages %>
        <% if CurrentBool %>
            $PageNum
        <% else %>
            <a href="$Link" title="Go to page $PageNum">$PageNum</a>
        <% end_if %>
    <% end_control %>

    <% if ProductList.NextLink %>
    	| <a href="$ProductList.NextLink">Next &raquo;</a>
    <% end_if %>
  </p>
  <% end_if %>
</div>

*edit*

I cant post a link to the site, because it was done via freelance, and is still under development.

Avatar
jondbaker

Community Member, 19 Posts

22 March 2010 at 4:47pm

Edited: 22/03/2010 4:55pm

Going along with your example, is there then a way to have next/previous links within the Product pages that allows you to click between them once you made an initial choice on the ProductGroup page?

I'd like to translate this to my portfolio page. I have a ProjectsHolder page that displays thumbnails that each link to different Projects. I'd like to have a feature on each Project page that displays 'previous/next' links to navigate between Projects (instead of the user having to go back to the original ProjectHolder to access other Projects).

Avatar
biapar

Forum Moderator, 435 Posts

1 June 2010 at 2:17am

I think a pagination with JQuery....