Magento – Magento sort collection with multiple attributes

magento-1.9sorting

I want to sort Magento product collection with multiple attributes at catalog product list page. I am using this code

$this->_collection->setOrder('price', 'desc');
$this->_collection->setOrder('price_plus_shipping', 'desc');

I also tried this code as well

$this->_collection->setOrder(array('price', 'price_plus_shipping'),Varien_Data_Collection::SORT_ORDER_DESC);

When i sort these both combine its not giving me accurate results but if i use both separately like when i am using only

price_plus_shipping

its working fine also as

price

its also working file
they are showing me accurate results. But i want to use them combine.
in Price i have product prices in price_plus_shipping i have alphabets like

a,b,c etc

Best Answer

Try this :

$this->_collection->setOrder([$field1, $field2, ...], 'DESC');

OR Try this :

$this->_collection->setOrder('price', 'desc');
$this->_collection->getSelect()->order('price_plus_shipping desc');