Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Sort collection
 
ant_jullien
Jr. Member
 
Total Posts:  7
Joined:  2013-05-23
 

Hello,

I just have a little problem on how to sort collection.

I use this code to sort my collection and it works :

$collection->setOrder('product_id''DESC')

But if I click on the header of a column to select another order it doesn\\\’t work anymore. I would like that \\\"product_id desc\\\” order is the default order only if the user has not selected column to sort.

Thanks for your help.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top