function index( $category_id = null ) {
if (!$category_id) {
$this->Product->recursive = 0;
//$this->set('products', $this->paginate());
$this->paginate = array(
'limit' => 2);
$products = $this->paginate('Product');
$this->set(compact('products'));
}
if ( !empty( $category_id ) ){
$this->paginate = array(
'conditions' => array(
'Product.category_id ' => $category_id),
'limit' => 2);
$products = $this->paginate('Product');
$this->set(compact('products'));
}
}
So I pass the category_id to paginate the category of items.
First page works fine /products/2 paginates the first page of the "2"
catergory_id of products.
Click next and I get products/index/page:2 the "2 category_id" get dropped
so its back to paginating all products. How can I keep the pagination going
here?
Thanks
Dave
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment