Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Wordpress Plugin?

Posted on 2015-02-05
8
Medium Priority
?
135 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 12

Expert Comment

by:Nathan Riley
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 18

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
Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

 

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
 
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 2000 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

Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

721 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