I'm trying to sort the result of an order query. Currently there is a .SqlMetaWhereClause() before de .FindPurchaseOrders() call and it's working fine. I'm reading the developpers guide and I saw a parameter named OrderByClause to sort the result.
Unfortunatly there is nothing much in the documentaton about what value needs to be assigned to achieve the result expected. I would like to sort orders by creationDate older first.
I'm using Commerce 8 and a migration process to 11 is ongoing. If I could have an answer for both version, it would be appreciated.
I'm wondering if someone could help or point me examples.
I will need to double check to be 100% sure, but top of my head, you can asssign <fieldname> if the field is in OrderGroup class (corresponding to OrderGroup table) and "META.<fieldname>" if the field is in PurchaseOrder class (corresponding to OrderGroup_PurchaseOrder table), that applies to your custom fields as well
And you can use DESC or ASC, so for example, if you want to get the latest created orders, use "OrderGroupId DESC"