Wordpress Plugin?

We have been asked to build a capability on a customer site (WordPress) that allows a simple type of lookup, normally something I would do with a simple mySQL database.

The customer keys in their zip code & a number indicating the size of their operation & the system looks up the cost of a maintenance program (actually 3 maintenance programs). Then a page will display the costs for the 3 programs & benefits of each, customer selects one & continues.

I recognize that WordPress itself is built on a MySQL database, but I need a 2nd one or a plugin that does this kind of thing.

It seems like you have the know how to build this yourself, rather than forcing a plugin to the equation. Why not just add additional table(s) to the WP database to accommodate the data you plan to use in your workflow and also store the customer data as well. Put a prefix on the tables and you'll be able to easily identify them when browsing the database structure.

It sounds like you want to roll your own query/response pages in WordPress. You can create a form page in WordPress and then attach an action to the form that will call your own php program, which you can put in your WordPress workspace. Since this is a security risk (in WordPress's view, at least), it has built-in mechanisms to prevent your doing this. There is a way around it.

If you are using a get method in your form page, you can do this: In WordPress, there is a list (query_vars) of acceptable query name/value combinations that can be used. WordPress will ignore any name/value combinations in a query string where the name is not in query_vars. So if one needs to send a custom query string to another page in WordPress, a custom name must be added to query_vars in order to allow the name/value combination to be handled from within WordPress.

You can write a simple plugin that just reads in the query_vars table, adds the custom names, and writes query_vars back out. During the WordPress session, any query strings that contain the name/value combination(s) added to query_vars will be passed through for handling by php code on the called page. If this is indeed what you want to do, let me know by posting a response here and I can share a beta quick and dirty plugin that I use for my own development site. You could modify it for your own use, assuming you know how to code PHP.

The issue is I don't know how to do that so that the theme (look & feel) of the website pages will look consistent.

The flow of the application is like this.

(0) There is a menu item called "Service Contract".

(1) On the Service Contract page, he customer enters their zip code & a thing called "Number of Zones"; that could be a pulldown with 1 - 50 or something like that. I have used Contact Form 7, I know a little about it.

(2) The system takes the entered data & looks up a price; there are 3 choices Bronze, Gold & Silver. A page is displayed with the description of the program, the price & a mechanism to select one. Of course all this is simple if I could use php.

(3) If the customer chooses one, it goes to a 3rd page (form) that asks for Name, Address, etc., Credit Card #, Expiration date, etc. This information is processed (probably through Authorize.net), an email is sent to the admin of the company with all the details & a Thank you page displayed that shows the amount spent & possible some or all of the info entered.

So all I need is some way to combine "custom" php code with the existing WordPress theme, database, etc.

It sounds like profgeek is talking along the same lines.

Any info that deals with this in some detail (like examples of doing what I am talking about) would be GREAT.

I can't speak to the database side because I haven't done that. On the form side, I use a plugin called Gravity Forms to create my forms. I also use the Genesis theme. To create a form page, I just create a page in WordPress and add the form to it. In the Gravity Forms plugin I set that form so that it calls a response page. I then created that page and added my php code in the "scripts" section of the page. When I first tested this it didn't work because of the way WordPress handled my trying to pass the arguments back to another WordPress page. Creating the little plugin solved that problem.

What I was doing is similar to what you want to do except that my response page didn't access the database at all. I think you could either add a table to the WordPress database or create another database and just access the database from php as an external database (use the url). Should work either way so long as you have the appropriate database permissions when you access the database from php.

0

Richard KortsAuthor Commented: 2015-02-06

To profgeek,

Thanks. The site is using Contact Form 7; I think it has that capability too.

I'm just not comfortable with where to put the php & how to communicate back & forth with WordPress

Where do I put the php programs?

How do I pass the results of a php program to a WordPress page?

Is there some sort of GENERAL documentation that addresses this?

I can do all the php / MySQL stuff if I can add tables to the database & figure out the connection string that gets me to the database.