How do I lock down a selection within a category to one choice only

WPPizza – A Restaurant Plugin for WordPress Support General Support How do I lock down a selection within a category to one choice only

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #15383
    merrynp
    Participant

      Hi there,
      I am using wp-pizza for a lamb farmer who wants online ordering.
      When you order a lamb through this farm, you can customise the cut of meat you choose from each category.

      For example, the Leg category in wp-pizza has three Menu Items for the customer to select one item from. The farmer wants the customer to make only one choice from each menu category.

      How can I lock down each category so the customer is only able to make one choice, rather than being able to select all three and placing an invalid order?

      The website is not live at the moment, but I can provide access if you need it.

      Look forward to hearing from you.
      Cheers
      Merryn

      #15386
      Olly
      Admin & Mod

        “out of the box” so to speak, you can’t

        however, if you want to get your hands dirty, you could write some javascript based on this
        https://www.wp-pizza.com/topic/running-your-own-custom-javascript-functions-on-cart-refresh/

        together with some ajax and the following filter “wppizza_filter_order_summary_session” to not allow (or more accurately unset) the addition of another item if there are already items that belong to that category

        furthermore, you might want to unset the “wppizza-add-to-cart” classes on items in categories where an item of that category has already been added to the cart. either by javascript or using the “wppizza_filter_price_class” filter to unset the “wppizza-add-to-cart” class for relevant items

        in any event though, this is not trivial by any means . never mind that it would not stop a customer to just do two separate orders anyway…

        #15387
        Olly
        Admin & Mod

          PS: i don’t even understand why your farmer would want to restrict this in the first place, but then again I do of course not know the exact details as to why this sort of thing might be desirable..

          #15404
          merrynp
          Participant

            ok – thank you for your feedback.
            I don’t know how to write javascript etc, but I will give it a go.
            Is there any way you can help with the writing of the script?

            long story short:
            If you buy half or a whole lamb, there are different sections to the animal (Leg, Loin, Shank, Shoulder etc) and there are multiple cuts that you can select from each section of the animal. Leg = 3 options, Loin = 5 options etc. And the customer is only able to select one cut, because when an animal is slaughtered, the customer has access to one cut from each side.

            Does that give context?

            🙂 Merryn

            #15405
            Olly
            Admin & Mod

              >I don’t know how to write javascript etc, but I will give it a go.
              good luck. however, as already mentioned , this is not trivial and should also include php/serverside scripting or you will still allow people with a bit of scripting knowledge and that want to mischievously mess around to order things by simply just altering the page code

              >Is there any way you can help with the writing of the script?
              no, sorry. i support the plugin as is. if you want to customize things, it’s up to you to do that

              #15406
              merrynp
              Participant

                HI again Olly
                Thank you for your reply, I totally understand that the free plugin is unsupported for code changes.

                Can you please advise one thing:
                Do I simply copy and paste the script from here:
                https://www.wp-pizza.com/topic/running-your-own-custom-javascript-functions-on-cart-refresh/
                Into the pages you mentioned above?

                Thanks for your help
                Merryn

                #15407
                Olly
                Admin & Mod

                  you can if you want, but
                  a) it doesn’t do anything as it is, you will have to write some code
                  b) things like WPPIZZA_EXTEND_CUSTOM_JS ,wppizza_extend_custom_js, the plugin name , description etc should probably be something more descriptive.
                  c) (i just updated the code in a couple of place) replace the “myprefix” with something sensible

                  #15408
                  merrynp
                  Participant
                    This reply has been marked as private.
                    #15409
                    Olly
                    Admin & Mod

                      sorry, but I do not offer customisation

                      perhaps though you would be better off using something like this
                      https://www.wp-pizza.com/downloads/wppizza-add-ingredients/

                      see some demos here
                      https://www.wp-pizza.com/twentytwelve/
                      and here
                      https://www.wp-pizza.com/twentytwelve/our-menu/user/

                      where you can restrict things per group
                      just imagine that the items dont say pizza or steak or something but “lamb” and then you can set the groups to be “leg” , “shoulder” etc with their respective options

                      might not be useful in your scenario, so it’s just an idea

                    Viewing 9 posts - 1 through 9 (of 9 total)
                    • The topic ‘How do I lock down a selection within a category to one choice only’ is closed to new replies.