Solved

Wordpress Plugin?

Posted on 2015-02-05
8
111 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 17

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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Gradient CSS 4 36
CSS z-index issue 3 37
Wordpress Cherry Theme Shortcodes 6 31
How do I setup Wordpress to use Master / Slave MySQL database setup? 4 53
Did you use a default hosting installation of wordpress with the intention of it being your actual site?  Maybe you’ve installed it as a Blog to your current site and recently converted it to be the main site and do away with the old .htm pages.  An…
How to install BuddyPress on your self-hosted WordPress site It’s been called everything from “social networking in a box” to “Facebook without the terms of service,” but until Feb. 16, BuddyPress was a relatively unknown outside the WordPress MU…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …

860 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