Hey guys, I have some products that are being paginated, and the output array is as follows: http://bin.cakephp.org/view/1466382004 .
How can I make $paginator->sort() work for the avg_rating field? It seems that sort() only wants to work on fields directly within the fieldset of the product. This is how I am currently getting the avg_rating variable from the controller: 'fields'=>array( 'Product.id', 'Product.title', 'Product.short_description', 'Product.price', 'Product.quantity', 'Product.is_infinite_quantity', 'Product.is_stocked', '(SELECT AVG(`ProductReview`.`rating`) FROM `product_reviews` AS `ProductReview` WHERE `ProductReview`.`product_id` = `Product`.`id` AND `ProductReview`.`is_active` = 1) AS avg_rating', '(SELECT COUNT(*) FROM `product_reviews` AS `ProductReview` WHERE `ProductReview`.`product_id` = `Product`.`id` AND `ProductReview`.`is_active` = 1) AS cnt_review' ), Thanks! --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---