Domas Posted December 30, 2018 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
piet Posted January 9, 2019 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
wakabayashi Posted January 9, 2019 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.
Domas Posted January 9, 2019 Author Posted January 9, 2019 Yes, i need hint, how to sort products list in BO...
wakabayashi Posted January 9, 2019 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...
Domas Posted January 9, 2019 Author 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)
wakabayashi Posted January 9, 2019 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);
wakabayashi Posted January 9, 2019 Posted January 9, 2019 @Domas Sorry I don't have time now, to find a solution.
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