1999 Posts in 530 Topics by 433 members
E-Commerce Modules
SilverStripe Forums » E-Commerce Modules » Problem With Pagination!!!!
Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.
Moderators: martimiz, Nicolaas, Howard, Sean, Ryan M., biapar, Willr, Ingo, Jedateach, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 665 Views |
-
Problem With Pagination!!!!

11 June 2010 at 11:10am Last edited: 11 June 2010 1:14pm
Hi guys basically this is my structure
http://pastie.org/1000170-------- 1.1 layer Product Group
-------- 2.1 layer Product Group
ProductItem 1
ProductItem 2
ProductItem 3-------- 2.2 layer Product Group
ProductItem 4
ProductItem 5
ProductItem 6
-------- 1.2 layer Product Group
-------- 2.3 layer Product Group
ProductItem 7
ProductItem 8
ProductItem 9-------- 2.4 layer Product Group
ProductItem 10
ProductItem 11
ProductItem 12when i click on layer 1.1 i wanna be able to see productitem from 1-6 with pagaination (Pagination not working)
when i click on layer 1.2 i wanna be able to see productitem from 7-12 with pagaination (Pagination not working)
and
when i click into 2.1 layer i will be able to see productitem from 1-3 with pagination (working perfectly)
when i click into 2.2 layer i will be able to see productitem from 4-6 with pagination (working perfectly)
when i click into 2.3 layer i will be able to see productitem from 7-9 with pagination (working perfectly)however some how the layer 1 pagination is not working
but second layer is working fine
this is the code i'm using http://pastie.org/1000178<?php
/**
* Return ProductGroups as children of the current page
*/
function ChildGroups() {return DataObject::get("ProductGroup", "ShowInMenus = 1 AND ParentID = " . $this->ID);
}
/**
* Returns the Products as children of the current page.
*/
public function ChildProducts() {
return DataObject::get("Product", "ShowInMenus = 1 AND ParentID = " . $this->ID);
}
/**
* Returns the Products as children of the current page with pagination.
*/
function ProductListPagination() {
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},2"
);
return $doSet ? $doSet : false;
}
?>/**
* Silverstripe code, to display the Product list for Layer 1!!
*/<% if ChildGroups %>
<div class="product_summary">
<% control level(3) %>
<ul id="ProductList">
<% control ChildGroups %>
<% if ChildProducts %>
<% control ProductListPagination %>
<% include ProductGroupItem %>
<% end_control %>
<% end_if %>
<% end_control %>
</ul>
<% end_control %>
</div>
<% end_if %> -
Re: Problem With Pagination!!!!

11 June 2010 at 1:04pm
hi guys
i did the following testif i hard code the 2 layer's parent id in, like the following
function ProductListPagination() {
if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1) $_GET['start'] = 0;
$SQL_start = (int)$_GET['start'];
$doSet = DataObject::get("Product", "`ParentID` = 19 OR `ParentID` = 21", "", "", "{$SQL_start},2");
return $doSet ? $doSet : false;
}the pagination will work but it will display the product item twice!!! @@....... any solution ?
| 665 Views | ||
|
Page:
1
|
Go to Top |

