Button to trigger Ingredients?

Viewing 20 posts - 1 through 20 (of 33 total)
  • Author
    Posts
  • #16994
    manny
    Participant

      So from what I’ve seen in WP Pizza, the Ingredient options pop up once the Add to Order button is clicked. Is it possible to have the Ingredient options section pop up via a separate button? I’d like to allow users the option of viewing these Ingredient options before they go and try to add an item to the order.

      Something like this is what I had in mind (specifically the View Options link, which would hopefully trigger the ingredients section). Is this possible?

      http://imgur.com/hOC03Sd

      Thanks in advance,

      Manny

      #16995
      Olly
      Admin & Mod

        just use the same id’s classes as in the “original” elements

        #16998
        manny
        Participant

          How would I go about adding a View Options button to every menu item though? Can I add HTML in some sort of template, or would I need to do this via Javascript?

          #16999
          Olly
          Admin & Mod

            use the actions/filters in the loop templates,
            and/or edit the loop template
            and/or use jquery
            and/or …whatever else you can think of.

            be creative….

            #17002
            manny
            Participant

              Awesome, thanks Olly, just making sure I implement this in the most future proof way possible.

              Cheers,

              Manny

              #17003
              manny
              Participant

                Hey Olly, I decided to go the JQuery route, but right now only the first View Option button is working properly since I used that ID to test. Here is my JQuery code:

                
                <script>
                jQuery(document).ready(function($) {
                $('.wppizza-article').append('<a id="wppizza-article-2035-0-0" class="wppizza-trigger-click">View Options</a>');
                })
                </script>
                

                Is there an ID or Class I can use that will trigger each menu items respective Ingredients box?

                #17004
                Olly
                Admin & Mod

                  obviously you have to target each one individually….

                  and the “…..trigger-click” is definitely the wrong class to use.
                  you need to look the elements (id’s / classes) the individual prices are wrapped in

                  #17005
                  manny
                  Participant

                    Hmm so with the JQuery method, I would need a script for each menu item? Is there no way to add a generic ID or Class and have the respective ingredients box open?

                    If not possible, would it be possible via editing the template?

                    #17006
                    manny
                    Participant

                      I’m guessing this is the best route to make this happen?

                      https://www.wp-pizza.com/topic/addingfiltering-the-output/

                      #17007
                      Olly
                      Admin & Mod

                        >Hmm so with the JQuery method, I would need a script for each menu item

                        no, but you need to learn about the “each” method (or smilar)

                        #17008
                        manny
                        Participant

                          I see all the filters on the page I linked are for the Ingredients box. Are there filters for other areas, like to add content within .wppizza-article-info ?

                          #17009
                          Olly
                          Admin & Mod

                            its the “wppizza-add-ingredients” class you need to add which is tied to the surrounding id’s
                            look at your elements inspector…

                            #17010
                            Olly
                            Admin & Mod

                              you can do whatever you want with the filters . they are not tied to anything in particular
                              and there are various filters . whatever you do with them is up to you

                              #17011
                              Olly
                              Admin & Mod

                                entirely up to you of course, but to be honest, i cannot see the point of your exercise.
                                you are trying to add what clicking on the prices already does….

                                but maybe i’m missing something

                                #17012
                                manny
                                Participant

                                  What do you mean the filters aren’t tied to anything in particular? Doesn’t the element created within the custom filter show up in different places depending on the filter? So for wppizza_add_ingredients_filter_before_form the element will show before the ingredients, and for wppizza_add_ingredients_filter_after_form, they’ll show up after. I need a filter that adds an element within .wppizza-article-info right on page load.

                                  #17013
                                  manny
                                  Participant

                                    Its a UX thing. Not all items have ingredients so I’m trying to show that there are ingredient options for specific items. Ideally the Ingredients should show up on page load, but apparently that’s not possible, so I’m looking into adding this View Options button so users know that the menu item has available ingredients to choose from / substitute for, before they try to add the item to the cart, and when they click on View Options, the ingredients box should pop up, THEN they can add the the item to the cart, with the available ingredients. I know a menu item in’t auto added to the cart, first the ingredient box pops up and they need to add it to the cart again, but I think the View Options button route is better for user friendliness.

                                    #17014
                                    Olly
                                    Admin & Mod

                                      of course the use of the filters will make things turn up in particular areas – so “not tied to things” was a bad choice of words i guess
                                      but they do not just have one particular use but can be used as you see fit

                                      #17015
                                      manny
                                      Participant

                                        How would I go about adding this View Options button that when click pops open the ingredients box using a filter then? Is there a filter to add an element within .wppizza-article-info?

                                        If not I’ll try the JQuery Each method, but that seems like overkill if there’s a filter I can use.

                                        #17016
                                        Olly
                                        Admin & Mod

                                          >Its a UX thing. Not all items have ingredients so I’m trying to show that there are ingredient options for specific items.

                                          you could of course just set some icon, add some text to the description etc etc OR
                                          – perhaps that’s what you are missing – read the id’s that are in “wppizza_addingredients” , typically something like

                                          
                                          var wppizza_addingredients = {"ing":[77,67,30,17,16,7,5,3,48,47,110,119,135,142],......etc
                                          

                                          and add things that way . the id’s here refer to the items that have added ingredients….

                                          #17017
                                          Olly
                                          Admin & Mod

                                            FYI: the AI popup gets invoked by jQuery, changing the “wppizza-add-to-cart” class(es) to “wppizza-add-ingredients” based on var wppizza_addingredients = {“ing”:[……. as above and depending on the surrounding id’s /classes to get the ingredient for the right size and item

                                            sure you could add a filter to change the wppizza-add-to-cart to start off with.
                                            alas, that filter did not exist actually when the plugin was conceived, so it does it by jQuery as outlined above

                                          Viewing 20 posts - 1 through 20 (of 33 total)
                                          • The topic ‘Button to trigger Ingredients?’ is closed to new replies.