Variable Prices

Viewing 19 posts - 1 through 19 (of 19 total)
  • Author
    Posts
  • #8514
    ecarr2
    Participant

      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!
      Emily

      #8520
      Olly
      Admin & Mod

        as 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 hoops

        hope that helps

        #8521
        ecarr2
        Participant

          Thats 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?

          #8522
          Olly
          Admin & Mod

            already there….

            #8527
            ecarr2
            Participant

              Snap – that seems to have broken my functions.php, I’m getting an internal error now when I view the site. Any suggestions?

              #8528
              Olly
              Admin & Mod

                sounds more like a coding error your end to be honest.
                i am using that exact same code here and it works just fine

                you need to find out what your internal error is

                #8530
                ecarr2
                Participant

                  Okay – 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!

                  #8532
                  Olly
                  Admin & Mod

                    if 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)

                    #8533
                    Olly
                    Admin & Mod

                      or 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

                      #8538
                      ecarr2
                      Participant

                        Thanks.. 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?

                        #8539
                        ecarr2
                        Participant

                          I appreciate your help though man, the plugin itself is awesome.

                          #8540
                          Olly
                          Admin & Mod

                            > 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

                            #8553
                            ecarr2
                            Participant

                              Hey 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!!

                              #8554
                              Olly
                              Admin & Mod

                                >Nothing different
                                not likely 🙂

                                >THANK YOU FOR ALL OF YOUR HELP!!
                                you’re welcome, glad you got it working

                                #19712
                                kiae
                                Participant

                                  first 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 ?
                                  thanks

                                  #19716
                                  Olly
                                  Admin & Mod

                                    there’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

                                    #19807
                                    kiae
                                    Participant

                                      Thanks 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
                                      Kiae

                                      #19813
                                      Olly
                                      Admin & Mod

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

                                        #19875
                                        kiae
                                        Participant

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

                                        Viewing 19 posts - 1 through 19 (of 19 total)
                                        • The topic ‘Variable Prices’ is closed to new replies.