Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Wordpress - OScommerce issue


barakas

Recommended Posts

Posted

I recently Intergrated Wordpress with my Oscommerce, and I had an issue I hope someone can help me with

 

The contribution I used, is designed to work with the wordpress database tables in the same SQL database as what I'm using for OScommerce already. To keep things tidy and managable, I'd like to have a seperate database for the wordpress stuff.

 

I'm sure this is a relatively easy fix, but I am only really good for modifying existing code, and I can't see where I could add the name of the new database to work.

 

Here's the code

 

$wp_term_relationships_query = tep_db_query("select c.object_id from wp_terms a, wp_term_taxonomy b, wp_term_relationships c, wp_posts d where a.term_id = '$category' and a.term_id=b.term_id and b.term_taxonomy_id=c.term_taxonomy_id and c.object_id=d.id and d.post_status='publish' order by object_id desc limit 1");

$wp_term_relationships = tep_db_fetch_array($wp_term_relationships_query);

$getpost = $wp_term_relationships['object_id'];

$wp_post_query = tep_db_query("select * from wp_posts WHERE id = '$getpost' limit 1");

$wp_post = tep_db_fetch_array($wp_post_query);

$getauthor = $wp_post['post_author'];

 

$char=array("Â");

$charto=array("");

$oscpost=rtrim(str_replace($char, $charto, $wp_post['post_content']));

 

if ($use_nicenick == true) {

$wp_author_query = tep_db_query("select * from wp_users WHERE id = '$getauthor' limit 1");

$wp_author = tep_db_fetch_array($wp_author_query);

$wp_email_query = tep_db_query("select * from wp_users WHERE id = '$getauthor' limit 1");

$wp_email = tep_db_fetch_array($wp_email_query);

} else {

$wp_author_query = tep_db_query("select * from wp_usermeta WHERE user_id = '$getauthor' AND meta_key = 'first_name' limit 1");

$wp_author = tep_db_fetch_array($wp_author_query);

$wp_email_query = tep_db_query("select * from wp_users WHERE id = '$getauthor' limit 1");

$wp_email = tep_db_fetch_array($wp_email_query);

}

 

$post_date = convert_datetime($wp_post['post_date'], "F j, Y g:ia");

 

$info_box_contents = array();

$info_box_contents[] = array('text' => $wp_post['post_title']." (". $post_date . ")");

 

I assume i use the tep_db_query function, but I can't see where I'd type in the name of a new database.

 

I have already created a new database with all the right Wordpress tables inside, but can't figure out where to go from here.

Posted

Okay I think I've found the function i need to put in

 

define('DB_NAME', 'database_name_here');

 

But once I've defined it, how do I link it up to the rest of the code?

Posted

There's a config file in Wordpress, the same as in OSC - wp-config.php

 

Put your database details in and upload...

 

// ** MySQL settings ** //

define('DB_NAME', '*******'); // The name of the database

define('DB_USER', '*******'); // Your MySQL username

define('DB_PASSWORD', '*******'); // ...and password

define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value, might be IP address instead of localhost

define('DB_CHARSET', 'utf8');

define('DB_COLLATE', '');

Posted

The problem is in wp.php , not wp-config.php

 

The wp-config.php is set up to go to the right database, but that is set up in the wordpress installation seperate

 

the wp.php is a oscommerce file, and these entries are attempting to draw from the database

 

$wp_term_relationships_query = tep_db_query

 

But, they are attempting to draw from the default database database

 

I get this error on my OScommerce site

 

1146 - Table 'mydatabase.wp_terms' doesn't exist

 

everything else is working fine, i just need it to get the tep_db_query function to go to the wordpress database.

 

I assume that the tep_db_query goes to the database set up in the includes/configure.php, I just need a way to manually input the DB_name

Posted

the thread I mentioned is about a different contrib but what I meant to say is tht the wordpress database table names have changed in version 2.7 .

 

When I posted that I knew the new names but now i cant remember but you can easily figure them out

  • 1 month later...
Posted

Has anyone figured out how to call from a SEPERATE database.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...