Customize sort order of ingredients

WPPizza – A Restaurant Plugin for WordPress Support Add-Ons Extensions Add Ingredients Codesnippets Customize sort order of ingredients

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #3441
    Olly
    Admin & Mod

      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;
      }
      
      #4319
      johnspeasmaker
      Participant

        I found the function.php file but, sadly, I don’t know how to edit it. Got any tips?

        #4333
        Olly
        Admin & Mod

          just 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 presumably

          having said that, with a bit of googling it’s not that difficult to figure out

          #5033
          spartiadb
          Participant

            Hi,

            How can I edit the ID of my ingredient ? I sort my ingredient by ID.

            Thanks you for your work.

            #5035
            spartiadb
            Participant

              I would like edit the ID of ingredient like the sort of “custum group”.

              #5036
              Olly
              Admin & Mod

                you 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;
                
                #5337
                Olly
                Admin & Mod


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

                  #9194
                  Regine Endres
                  Participant

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

                    grouping of ingredients on the backend
                    http://www.elmexicano.net.au/wp-content/themes/ElMexicano/media/grouping%20of%20ingredients%20backend.png

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

                    order of ingredients in cart
                    http://www.elmexicano.net.au/wp-content/themes/ElMexicano/media/order%20in%20cart.png

                    order in final order page;
                    http://www.elmexicano.net.au/wp-content/themes/ElMexicano/media/order%20in%20final%20order%20page.png

                    order in email
                    http://www.elmexicano.net.au/wp-content/themes/ElMexicano/media/order%20in%20email.png

                    Thanks

                    Kind regards

                    Regine

                    #9204
                    Olly
                    Admin & Mod

                      i 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

                      #9655
                      Regine Endres
                      Participant

                        Hi Olly,

                        just wondering if you had a chance to look at the sort order?

                        Thanks

                        Kind regards

                        Regine

                        #9659
                        Olly
                        Admin & Mod

                          should/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

                          #9662
                          Regine Endres
                          Participant

                            Thanks Olly,

                            much appreciated.

                            Kind regards

                            Regine

                          Viewing 12 posts - 1 through 12 (of 12 total)
                          • The topic ‘Customize sort order of ingredients’ is closed to new replies.