Tan*_*inh 2 php magento magento-1.8 magento-1.9
这是目标sql查询:......按field1 asc,price_index.min_price desc排序
这是我的代码
$productCollection->getCollection()
->setOrder('field1', 'asc')
->setOrder('price', 'desc')
Run Code Online (Sandbox Code Playgroud)
但是,在我的结果中,价格始终是第一个订购字段。有人可以帮助我吗?非常感谢
小智 5
$collection->getSelect()
->order('field1 asc');
Run Code Online (Sandbox Code Playgroud)
或按倍数排序:
$collection->getSelect()
->order(array('field1 asc', 'price desc'));
Run Code Online (Sandbox Code Playgroud)