Login | Forgot password | Register

X

What is OpenID?

OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.

With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.

For more information visit the official OpenID site.

Jump to:

896 Posts in 260 Topics by 243 members

E-Commerce Module

SilverStripe Forums » E-Commerce Module » Pagination

Discuss the E-Commerce Module.

Page: 1
Go to End
Author Topic: Pagination 1096 Views
  • grilldan
    avatar
    Community Member
    135 posts

    Pagination Link to this post

    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.

  • Oceanc
    avatar
    Community Member
    7 posts

    Re: Pagination Link to this post

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

  • Martijn
    avatar
    Community Member
    104 posts

    Re: Pagination Link to this post

    Stevie Wonders how you did it

  • grilldan
    avatar
    Community Member
    135 posts

    Re: Pagination Link to this post

    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.

    1096 Views
Page: 1
Go to Top

Currently Online: Euphemismus

Welcome to our latest member: fearofbuttons

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

Comments on this website? Please give feedback.