Basically just overwrite paginate function, something like:
http://book.cakephp.org/view/249/Custom-Query-Pagination On Oct 1, 2009, at 5:37 PM, Kyle Decot wrote: > > Thanks. That's exactly what I want but with pagination. I also want to > order the results by distance. Any idea how to apply this to > pagination? > > On Oct 1, 3:24 pm, Andras Kende <and...@kende.com> wrote: >> Hello, >> >> This works for me ( not paginating ) >> >> $points = $this->find('all', array( >> 'order' => ' >> distance ASC, >> 'fields' => " >> Table.*, >> (3958 *3.1415926* SQRT(({$y2} - {$y}) * ({$y2} - {$y}) + COS >> ({$y2} / 57.29578) * COS({$y} / 57.29578) * ({$x2} - {$x}) * ({$x2} - >> {$x})) / 180) >> AS distance", >> 'conditions' => " >> 1=1 >> HAVING distance <= {$distance} >> " >> )); >> >> Andras >> >> On Oct 1, 2009, at 2:54 PM, Kyle Decot wrote: >> >> >> >> >> >>> I am paginating some results and if the user provides a address, >>> then >>> I am geocoding the address and doing a radius search. I would like >>> to >>> order those results by distance though. How do I add a dynamically >>> created field (distance) to my paginated results? > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---