Jump to content
thirty bees forum

How to sort products by reference in AdminOrders ?


Recommended Posts

  • 2 weeks later...

@Domas search in file AdminOrdersController.php for the function "getProducts($order)"

And try to add this before the return:

array_multisort( array_column($products, "reference"), SORT_ASC, $products );

If it works, I would suggest to make an override afterwards...

Link to comment
Share on other sites

@wakabayashi Thanks, working. How can add another sort arraymultisort( arraycolumn($products, "reference"), SORTASC, $products, array_column($products, "location"), SORT_ASC, $products ); doesn't working. I want to sort products by reference(it's already working) and location (from table productwarehouse_location)

Link to comment
Share on other sites

Not sure. In general this sounds a bit strange to me. You have multiple times the same reference? I have just googled. Maybe this works:

// get a list of sort columns and their data to pass to array_multisort $sort = array(); foreach($products as $k=>$v) { $sort['reference'][$k] = $v['reference']; $sort['location'][$k] = $v['location']; } // sort by event_type desc and then title asc array_multisort($sort['reference'], SORT_DESC, $sort['location'], SORT_ASC,$products);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...