Solved

Wordpress Plugin?

Posted on 2015-02-05
8
96 Views
Last Modified: 2015-02-06
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.

Can someone recommend a plugin?

Thanks
0
Comment
Question by:Richard Korts
8 Comments
 
LVL 11

Expert Comment

by:N R
ID: 40592968
Why not woocommerce?  It handles the billing and products like you listed above, you can even offer certain products to certain zip codes.
0
 
LVL 16

Expert Comment

by:Lucas Bishop
ID: 40593064
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.
0
 
LVL 12

Expert Comment

by:profgeek
ID: 40594067
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.
0
 

Author Comment

by:Richard Korts
ID: 40594294
To Lucas Bishop,

That is what I would love to do.

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.

Thanks
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 12

Expert Comment

by:profgeek
ID: 40594765
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
 

Author Comment

by:Richard Korts
ID: 40594833
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.

Thanks
0
 
LVL 12

Accepted Solution

by:
profgeek earned 500 total points
ID: 40594860
If you're going to do much beyond a simple submit and reply, you'll probably want to use Ajax, which is built into WordPress.  Here's a tutorial you can start with:

http://premium.wpmudev.org/blog/how-to-use-ajax-with-php-on-your-wp-site-without-a-plugin/

Using Ajax, you don't reload the WordPress page.  Rather, you only load portions of it.

Here's another interesting tutorial:  

http://www.htmlgoodies.com/beyond/php/binding-php-functions-to-wordpresss-ajax-handler.html
0
 

Author Closing Comment

by:Richard Korts
ID: 40595008
Those references look real good; so I can use php functions to interact with the database. I'm very familiar with Ajax; use it a lot.

This will also be good training for me in expanding the capabilities of WordPress based sites.

Thanks!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

If you are looking for plug-ins to add functions to your WordPress small business web site, take some time to read though this comprehensive list.  These are all the plugins I use for my customers WordPress web sites, as well as my own.  Be sure to …
Wordpress Horizontal Drop-Down Menu In this tutorial I will show you had to add a WordPress horizontal navigation menu to your theme. I have searched and searched for a good tutorial on creating a WordPress nav menu without adding a plug-in or us…
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now