WPPizza – A Restaurant Plugin for WordPress › Support › Add-Ons › Extensions › Add Ingredients › Codesnippets › Customize sort order of ingredients
- AuthorPosts
- 11 June, 2014 at 9:39 am #3441
please note: as of v4.5+ of the add ingredient extension you can now custom sort items using simple drag and drop without having to use this filter
if you wish to custom sort the ingredients other than by price or name, add the following to your theme’s function.php and set the sortorder as required
add_filter('wppizza_filter_ingredients_custom_sort', 'my_ingredients_custom_sort'); function my_ingredients_custom_sort($ingredients) { /************************************ do your sorting on the ingredients array here you could - for example - do a simple krsort($ingredients); to sort them by id in reverse *************************************/ return $ingredients; }
5 July, 2014 at 8:24 pm #4319I found the function.php file but, sadly, I don’t know how to edit it. Got any tips?
7 July, 2014 at 6:41 pm #4333just like you edit any other php file really (i.e with a texteditor)
if you don’t know how to write/edit php you should probably consider finding someone who does
as well as someone who understands wordpress filters and the like presumablyhaving said that, with a bit of googling it’s not that difficult to figure out
10 September, 2014 at 11:37 am #5033Hi,
How can I edit the ID of my ingredient ? I sort my ingredient by ID.
Thanks you for your work.
10 September, 2014 at 11:59 am #5035I would like edit the ID of ingredient like the sort of “custum group”.
10 September, 2014 at 12:50 pm #5036you cannot/should not change id’s. period.
(well, in theory you could return different id’s when using this filter, but you will seriously break things)if you want to set the sortorder by id, do something like this
$map=array(10,12,11,6,3);//set ALL your ingredients id's in the order you want them sorted. $sortedIngredients=array(); foreach($map as $key){ if(isset($ingredients[$key])){ $sortedIngredients[$key]=$ingredients[$key]; } } return $sortedIngredients;
25 September, 2014 at 9:29 pm #5337
please note – as of v4.5+ :
although this filter is still part of the plugin/extension (in case you want to do something really funky) if you want to custom sort the order of ingredients the way you like, you can now just drag and drop to get the order you desire….20 April, 2015 at 12:32 pm #9194Hi Olly,
I have got my additional ingredients grouped on the online order page.
The sort order of the additional ingredients is working fine there, but on every other spot the sorting of the additional ingredients is alphabetically.Can it sort it in the same why as they are grouped and sorted on the order page? As the food is prepared in a specific order it would help reduce the error quote.
Here some screen shots:
sort of additional ingredients on the backend
http://www.elmexicano.net.au/wp-content/themes/ElMexicano/media/additional%20ingredients%20backend.pnggrouping of ingredients on the backend
http://www.elmexicano.net.au/wp-content/themes/ElMexicano/media/grouping%20of%20ingredients%20backend.pnggrouping of ingredients on frontend and how it sorts it when selected
http://www.elmexicano.net.au/wp-content/themes/ElMexicano/media/grouping%20of%20ingredients%20frontend.pngorder of ingredients in cart
http://www.elmexicano.net.au/wp-content/themes/ElMexicano/media/order%20in%20cart.pngorder in final order page;
http://www.elmexicano.net.au/wp-content/themes/ElMexicano/media/order%20in%20final%20order%20page.pngorder in email
http://www.elmexicano.net.au/wp-content/themes/ElMexicano/media/order%20in%20email.pngThanks
Kind regards
Regine
20 April, 2015 at 6:38 pm #9204i will check in the next few days and update the plugin if necessary.
might be something i have omitted .i’ll post here once i know what’s going on or if there is a reason why it is the way it is
3 May, 2015 at 11:20 am #9655Hi Olly,
just wondering if you had a chance to look at the sort order?
Thanks
Kind regards
Regine
4 May, 2015 at 1:26 pm #9659should/will be available in the next version (haven’t had the chance yet to release it, but probably later this week)
you will find a dedicated / new option in settings as to how you want to arrange the *added* ingredeients
4 May, 2015 at 2:16 pm #9662Thanks Olly,
much appreciated.
Kind regards
Regine
- AuthorPosts
- The topic ‘Customize sort order of ingredients’ is closed to new replies.