views:

60

answers:

2

Hi

I'm new in wordpress. I want to create a website to display my product stocks. An I want to use wordpress to maintain the content of the website.

I was wondering is there any way of using my own PHP scripts to access my 'product database' information within from WP and display them. Bascially, wordpress will use it's own database for text contents and my database to display product information.

Any help would be greatly appreciated.

Thanks,

Mab

p.s. I need two separate product databases because, I'll be using the product database to maintain the supply chain and clients will log in to the system (which will not use wordpress) to check prices, quantity and place orders (but no transaction). I just want to use wordpress to display company profile, what it does and one page will let users to browse available product but no cart or transaction at this point.

A: 

You can add arbitrary PHP code in your templates. I'd recommend using a category or page specific template to include your product database as needed.

David Schmitt
You have to be very careful, though, as WP still uses a fair number of global variables with common names, such as `$id`. For a amusing/disturbing look at how NOT to migratve away from the usage of global variables, look at the `get_the_ID()` function in `./wp-includes/post-template.php`
Marc B
A: 

Here are some ways you can integrate with your product database:

1 - As mentioned above you can add arbitrary PHP code in your templates. This includes having a second DB connection to your product database.

2 - If WP is simply there for product display purposes, you can create table(s) in the same DB as WP and have a job to synch the new table(s) and the main products table(s). You can then use the $wpdb object to query the DB. You do not need to create a second DB connection. In fact, you might get away with not having to create tables at all. you can do periodic inserts/update in the tables WP uses for the media library.

I would love to hear what solution you end up using. I'm sure there will be others who can contribute to this thread.

rxn