Page 1 of 1
Dashboard Order Status Sort Order
Posted: Tue May 20, 2014 4:25 am
by AbleMods
Is there any way to make the dashboard order status summary sort by the order status sort order instead of the name? It seems weird to be able to set the order of order statuses, yet the dashboard control doesn't respect it.
A few clients have mentioned it confuses them because they put the statuses in order of their business "flow" but it doesn't show like that on the dashboard.
Re: Dashboard Order Status Sort Order
Posted: Tue May 20, 2014 7:12 am
by Katie
Hi Joe,
I'm sorry that I don't have some code for you to fix this, but I did report it as a bug.
Thanks,
Katie
Re: Dashboard Order Status Sort Order
Posted: Wed May 21, 2014 9:01 am
by jguengerich
If you have the source, change the LoadOrderStatusSummaries method in CommerceBuilder\Orders\OrderRepository.cs to this:
Code: Select all
/// <inheritdoc />
public IList<OrderStatusSummary> LoadOrderStatusSummaries(DateTime orderDate)
{
orderDate = LocaleHelper.FromLocalTime(orderDate);
return NHibernateHelper.CreateCriteria<CommerceBuilder.Orders.OrderStatus>("OS")
.CreateCriteria("Orders", "O", NHibernate.SqlCommand.JoinType.LeftOuterJoin, Restrictions.Ge("O.OrderDate", orderDate))
.SetProjection(Projections.ProjectionList().Add(Projections.Property("OS.Id"), "StatusId")
.Add(Projections.Property("OS.Name"), "Status")
.Add(Projections.Count("O.Id"), "Count")
.Add(Projections.Sum("O.TotalCharges"), "Total")
.Add(Projections.GroupProperty("OS.Id"))
.Add(Projections.GroupProperty("OS.Name"))
.Add(Projections.GroupProperty("OS.OrderBy"))) // CUSTOM MODS changed order from OS.Name to OS.OrderBy, so needed to add OrderBy to grouping
.AddOrder(new NHibernate.Criterion.Order("OS.OrderBy", true)) // CUSTOM MODS changed order from OS.Name to OS.OrderBy
.SetResultTransformer(Transformers.AliasToBean(typeof(OrderStatusSummary)))
.List<OrderStatusSummary>();
}
Re: Dashboard Order Status Sort Order
Posted: Fri May 30, 2014 11:30 am
by AbleMods
That worked quite nicely, thanks !