WPPizza – A Restaurant Plugin for WordPress › Support › Add-Ons › Extensions › Add Ingredients › Support › Button to trigger Ingredients?
- AuthorPosts
- 1 April, 2016 at 2:11 pm #16994
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?
Thanks in advance,
Manny
1 April, 2016 at 2:23 pm #16995just use the same id’s classes as in the “original” elements
1 April, 2016 at 2:51 pm #16998How 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?
1 April, 2016 at 3:36 pm #16999use 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….
1 April, 2016 at 7:26 pm #17002Awesome, thanks Olly, just making sure I implement this in the most future proof way possible.
Cheers,
Manny
1 April, 2016 at 7:50 pm #17003Hey 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?
1 April, 2016 at 7:57 pm #17004obviously 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 in1 April, 2016 at 7:59 pm #17005Hmm 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?
1 April, 2016 at 8:06 pm #17006I’m guessing this is the best route to make this happen?
1 April, 2016 at 8:08 pm #17007>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)
1 April, 2016 at 8:10 pm #17008I 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 ?
1 April, 2016 at 8:10 pm #17009its the “wppizza-add-ingredients” class you need to add which is tied to the surrounding id’s
look at your elements inspector…1 April, 2016 at 8:12 pm #17010you 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 you1 April, 2016 at 8:15 pm #17011entirely 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
1 April, 2016 at 8:15 pm #17012What 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.
1 April, 2016 at 8:17 pm #17013Its 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.
1 April, 2016 at 8:20 pm #17014of 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 fit1 April, 2016 at 8:22 pm #17015How 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.
1 April, 2016 at 8:24 pm #17016>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 likevar 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….
1 April, 2016 at 8:33 pm #17017FYI: 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 - AuthorPosts
- The topic ‘Button to trigger Ingredients?’ is closed to new replies.