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 12
when 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 %>