Checking Postcode Functions

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #6141
    Nicholas Mordecai
    Participant

      Hi Olly, Sorry if I didn’t close any other open topics, they’re all fixed now, thanks!

      I need to write some javascript to force users to enter their postcode before entering the main website and ordering. If the postcode matches then they are allowed in, if not to go to a contact page to capture data.

      I’m quite happy to query the wp_db but was curious as you are already checking the post code on the check out, if there was a function already in place I could just call?

      If not, don’t worry I’ll just write it from scratch 🙂

      Thanks

      Nick

      #6142
      Olly
      Admin & Mod

        >Sorry if I didn’t close any other open topics
        no problem

        >but was curious as you are already checking the post code on the check out,
        just set it up that way. read here under NOTES:
        https://www.wp-pizza.com/downloads/wppizza-delivery-by-postcode/

        not sure why you’d want to restrict access like that in the first place though. as you would also restrict access for searchengines presumably …!

        #6143
        Olly
        Admin & Mod

          furthermore:
          >I’m quite happy to query the wp_db

          nothing to query if nothings been set anywhere. i.e postcodes only get captued once orders are submitted of course (by which time the above is pretty irrelevant, no ?)

          #6144
          Nicholas Mordecai
          Participant

            I mean, when the postcodes are setup in the admin system. I only want customers to be able to order if they have certain postcodes.

            If postcode entered == “postcode.label”
            {
            // Allow to enter site
            }
            Else
            {
            // Display contact form and refuse entry
            }

            #6145
            Olly
            Admin & Mod

              >I mean, when the postcodes are setup in the admin system
              ok.
              not much to query though.
              pretty much all options are in the options table in a serialised array.
              i.e – in a wordpress way:
              $wppizzaOptions=get_option(WPPIZZA_SLUG);
              (ideally, assuming that that constant is available wherever you put your script)

              or just

              $wppizzaOptions=get_option(‘wppizza’);

              you’ll find it in $wppizzaOptions[‘order_form’] somewhere, depending on which field you used

              or if you want to go really wild check this:

              https://www.wp-pizza.com/topic/extending-the-plugin-with-a-class/

              $this->pluginOptions in that class would return the same as $wppizzaOptions above

              #6146
              Nicholas Mordecai
              Participant

                So may I ask, when in the checkout, where do you pull the data from to populate the drop down box from which you select your post code?

                Nick

                #6147
                Olly
                Admin & Mod

                  from the same options table/data…(?)
                  (thought that’s obvious but I might misunderstand the question)

                  #6148
                  Nicholas Mordecai
                  Participant

                    Yeah sorry I think I’m getting a little confused!

                    I will look through the database and the options table.

                    It’s probably easier for me to just query the options table for any pre-existing post codes and run a logical script on the outcome of the query. Thanks 🙂

                    While I have you here, I have no doubt someone else has asked this but couldn’t find it when I searched the forum. Generating emails, is that just html in a file in /wp-content/plugin/wppizza..

                    If so, can I just amend it as I see fit?

                    Nick

                    #6149
                    Olly
                    Admin & Mod

                      >It’s probably easier for me

                      dunno how that’s easier, but whatever works for you

                      >Generating emails, is that just html

                      no. there is html of course, but a bunch of php too
                      (assuming we are talking about /templates/wppizza-order-email-html.php )

                      use filters(ideally)
                      https://www.wp-pizza.com/topic/html-email-editing/
                      https://www.wp-pizza.com/topic/filteredit-header-of-html-emails/

                      , or copy and edit
                      https://www.wp-pizza.com/topic/can-i-send-html-emails/

                      #6150
                      Nicholas Mordecai
                      Participant

                        Okay thanks, I’ll see how I get on. I’ll comment on this thread if I get really stuck but don’t want to bother you too much. It’s not your place to write code for me!

                        Thanks for thinks think that was exactly what I was after!

                        Thanks Olly! 🙂

                        Nick

                      Viewing 10 posts - 1 through 10 (of 10 total)
                      • The topic ‘Checking Postcode Functions’ is closed to new replies.