Question on multiple "order" clauses in paginatation.
Question setup:
In controller:
var $paginate = array(
'Product' => array(
'limit' => 15,
'order'=>array('Collection.name'=>'asc',
'Product.productnumber'=>'asc')
)
);
which works well when I want to paginate Product and order by
'Collection.name'=>'asc', 'Product.productnumber'=>'asc'.
Example function in this controller:
function product_types($typeId = null, $manId = null) {
$this->set('products', $this->paginate('Product', array
( 'Product.channel_type_id'=>array
(2,3),'ProductsProductTypes.product_type_id'=>$typeId)));
}
But, in a different function _within the same controller_, I want to
order by Product.sortorder (a double field in products table):
function products($id = null, $manufacturerId= null) {
$criteria = array('Product.collection_id'=>$id,
'Product.channel_type_id'=>array(2, 3)); // paging criteria
$this->set('products', $this->paginate('Product', $criteria));
}
It doesn't appear I can change the order by clause in the "products"
function? In other words, I seem to be stuck with the 'order' defined
at the class level (order'=>array('Collection.name'=>'asc',
'Product.productnumber'=>'asc')). Am I making sense? I'm missing
something obvious?
Todd
--~--~---------~--~----~------------~-------~--~----~
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