Jump to content
thirty bees forum

How to sort products by reference in AdminOrders ?


Recommended Posts

Posted

Good day guys, need help : how can i sort products in BO AdminOrders by reference or reference AND warehouseproductlocation (example :demo7, demo6, demo_5 and etc) Any comments are welcome ! Thanks 0_1546169091702_Screenshot (4).png

  • 2 weeks later...
Posted

I just remembered that I saw once a tutorial about adding sorting options. Maybe you can start here: http://nemops.com/sort-by-sales-prestashop/#.XDXOSlxKhPY

Posted

@piet thats probably not what he is lookin for. I believe he is talking about the BO. There you would need to change a controller, I guess. Maybe a tpl file could also work.

Posted

@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...

Posted

@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)

Posted

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);

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...