November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
There is currently no "out of the box" way to order by MetaField values when searching for orders in Commerce. This is because the stored procedure being used, ecf_OrderSearch, does not return all columns of an OrderGroup meta class table (e.g. OrderGroup_PurchaseOrder) in one of the subqueries being built.
One quick hack you could do is to change the ecf_OrderSearch stored procedure to do exactly what I just said does not happen, by changing
SELECT DISTINCT U.[KEY], U.RANK
to
SELECT DISTINCT U.*
and then using something like
OrderByClause = "META.Created ASC"
but "SELECT *" is not the ideal solution in an ideal world.. This would probably be a feature request for a future release.
Here we go again. Something apparently easy to do, does not behave as expected in Commerce...
So Created (creation timestamp) is actually a metafields (in the db) even tho is a property of the OrderGroup (so all tables that extend OrderGroup ofcourse has it) ... and everyone go huh?!?!?!
I can specify a where clause on the metafield using the property SqlMetaWhereClause on the OrderSearchParameters. So where so i specify an OrderByClaus for metafields? (it does not exist and the OrderByClaus does not recognize the meta fields columns).
So the question is ... tada ... how do i order my search on metafield values?