Magento Load Collection Using Order By -


my query generating magento collection is

$usermodel = mage::getsingleton('user/user')->getcollection()->addfieldtofilter('user_id', array('in' => array($user_id)));  select `main_table`.user_name `user_table` `main_table` (user_id in('1', '3', '2')); 

i want use query:

select `main_table`.user_name `user_table` `main_table` (user_id in('1', '3', '2')) order field(user_id , 1,3,2); 

so display user name in same order id's input. i.e. "1,3,2"

which method used in magento load collection using order by?

thanks in advance!

you can zend_db_select collection , add order zend_db_select question:

zend db select : order field('id',some_array) - how?


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -