Domas Posted December 30, 2018 Share Posted December 30, 2018 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 Link to comment Share on other sites More sharing options...
Domas Posted January 9, 2019 Author Share Posted January 9, 2019 anyone? Link to comment Share on other sites More sharing options...
piet Posted January 9, 2019 Share Posted January 9, 2019 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 Link to comment Share on other sites More sharing options...
wakabayashi Posted January 9, 2019 Share Posted January 9, 2019 @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. Link to comment Share on other sites More sharing options...
Domas Posted January 9, 2019 Author Share Posted January 9, 2019 Yes, i need hint, how to sort products list in BO... Link to comment Share on other sites More sharing options...
wakabayashi Posted January 9, 2019 Share Posted January 9, 2019 @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 More sharing options...
Domas Posted January 9, 2019 Author Share Posted January 9, 2019 @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 More sharing options...
wakabayashi Posted January 9, 2019 Share Posted January 9, 2019 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 More sharing options...
Domas Posted January 9, 2019 Author Share Posted January 9, 2019 @wakabayashi not working this... Link to comment Share on other sites More sharing options...
wakabayashi Posted January 9, 2019 Share Posted January 9, 2019 @Domas Sorry I don't have time now, to find a solution. Link to comment Share on other sites More sharing options...
Domas Posted January 9, 2019 Author Share Posted January 9, 2019 @wakabayashi thanks anyway Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now