WPPizza – A Restaurant Plugin for WordPress › Support › General Support › Variable Prices
- AuthorPosts
- 19 March, 2015 at 2:03 am #8514
Hello there!
Love your plugin but I have a question – I currently have the plugin set up so that the menu is display only (no ordering). A few of the items on the menu, however, are priced at “Market Value” such as seafood… so the owner does not have a price to display on the site. I tried to put “Market Value” in in place of the price, but was bummed to see that it won’t save this way and defaults to $0.00. I decided then that I was going to either leave it blank or use a hyphen instead… but again, the plugin keeps replacing these with a $0.00 when displayed.
Is there a way to do this so that it doesn’t look like certain items on the menu are “free”? I dont want to have to set these items aside in a separate list, it wouldnt look nearly as good as your plugin does!
Thanks!
Emily19 March, 2015 at 2:05 am #8520as you noticed, the prices fields only accept prices.
however, as of v2.11.8.6 (should be available in a couple of days or so) you will be able to add this to your themes functions.php
add_filter('wppizza_filter_output_format_price','my_function'); function my_function($priceformatted){ /*get rid of any formatting first and cast to integer*/ $price=(int)str_replace(array(',','.'),'',$priceformatted); /*if zero, display some text instead*/ if($price==0){ $priceformatted='some text';/*set this to whatever text you need to be displayed*/ } return $priceformatted; }
note: this is only advisable like this if you do not offer any actual ordering – as you said you don’t – and it applies to *all* menu items with a price of zero – though you could set the one it applies to to an impossibly high price (let’s say 99999.00) and do
if($price==9999900){ etc
. otherwise you’ll have to jump through some more hoopshope that helps
19 March, 2015 at 2:29 am #8521Thats absolutely EXACTLY the fix I was looking for! When do you expect that next version will be coming out so that I can keep my eye out for it?
19 March, 2015 at 2:36 am #8522already there….
19 March, 2015 at 1:41 pm #8527Snap – that seems to have broken my functions.php, I’m getting an internal error now when I view the site. Any suggestions?
19 March, 2015 at 2:02 pm #8528sounds more like a coding error your end to be honest.
i am using that exact same code here and it works just fineyou need to find out what your internal error is
19 March, 2015 at 3:07 pm #8530Okay – I have no errors and the page comes back up the moment I remove that piece of code that you just gave me though, so that kinda stinks. Thanks for trying though!
19 March, 2015 at 3:13 pm #8532if you get an internal server error you CLEARLY got some error somewhere.
enable debug , it might help you
(my guess is you have a rogue space somewhere or a closing bracket too many/ too few)19 March, 2015 at 3:16 pm #8533or a missing/too many
<?
and/or?>
or you are using<?
when you should be using<?php
..lots of possibilities, none of which have anything to do with the code above
19 March, 2015 at 4:34 pm #8538Thanks.. I havent written any PHP at all though in any of the files so all of my files are just those which came stock with the theme and one file copy and pasted directly out of the WordPress Codex to activate a child theme. If I had written anything myself I would say that was def the problem, but I havent so Im just not sure. I’m def not going to start editing Elegant Themes files bc I feel like they know what theyre doing and I’m 99% sure it would absolutely not work after I edited it. haha. Could it possibly interact poorly with the Theme itself?
19 March, 2015 at 4:35 pm #8539I appreciate your help though man, the plugin itself is awesome.
19 March, 2015 at 4:46 pm #8540> Could it possibly interact poorly with the Theme itself
no, it’s a straight forward filter to be put in the functions.php file (or your child functions php file if you created a child theme – which is always preferable)
of course, make sure that your child theme works first before messing around with anything in there
19 March, 2015 at 8:42 pm #8553Hey just want to let you know, I uploaded my functions.php file with your code in it for like the 5th time just hoping and it WORKED this time!! Nothing different, exact same file that I used earlier – I dont know why or how it worked but it did and I’m STOKED!! THANK YOU FOR ALL OF YOUR HELP!!
19 March, 2015 at 8:49 pm #8554>Nothing different
not likely 🙂>THANK YOU FOR ALL OF YOUR HELP!!
you’re welcome, glad you got it working25 July, 2016 at 11:54 am #19712first of all, i want to thank you for this awesome plugins :D. i use this plugin for my catering business.
i used this filter and get result “$ custom price”. can i filter this currency symbol next to price with value 0 ? i know i can do this by setting in layout, but i also want to display the currency symbol next to each price in another menu items with price not 0.
do you have filter for this ?
thanks25 July, 2016 at 12:11 pm #19716there’s a filter you could use
wppizza_filter_summary
which holds all order data in cart (and a bunch of other stuff)you could probably filter on [items][price] . very roughly something like
if ([items][price] <= 0) { [items][price_formatted] = 'my string' }
you need to adjust the above with proper coding for filters of course, but it should give you an idea
Note, you can screw up a lot of things if you use this incorrectly. make sure you test it thoroughly
PS: This kind of thing/filter ill be a lot easier in wppizza v3.x when it’s ready. However, this will be a while yet and the above will have to do for now
28 July, 2016 at 8:13 am #19807Thanks for your help olly. Cant wait for the v3.x
I managed to do it somehow and im using imposible price instead of 0. Coz if i use 0 it would screw up my settings with value 0 :v
i have one question again..
i love the mini chart that showing at top when main cart is not in view..but the problem is in mobile view ,when im at the top page the mini cart would block the navigation menu.
is there any option that i could use in layout to disable this when im at the top page? I still dont understand jquery or css declaration yet.
sorry if i have too much to ask
Thanks
Kiae28 July, 2016 at 10:22 am #19813in the future, please post a new topic
anyway, you should look in the wppizza->layout settings for the minicart. possibly an added offset for the body might do the trick.
30 July, 2016 at 5:29 pm #19875Sorry olly… this is the last post.
still i dont know how to add an offset.
I change the z-index mini-cart-fixed from 2000 to 0 . It works somehow, when im at the top the mini cart hidden behind my nav menu.
Thank you. - AuthorPosts
- The topic ‘Variable Prices’ is closed to new replies.