1

I am in the process of integrating wordpress with opencart.

I have succesfully installed wordpress at mydomain.com/wp , it works fine and I can access everything as needed.

I have this, placed just before the start of my opencart header tag on a specific page.

<?php 
/* Short and sweet */
define('WP_USE_THEMES', false);
require('wp/wp-blog-header.php');
?>

and I am receiving an "Error Establishing a Database Connection" error, clearly it is finding wp-blog-header, wordpress at mydomain.com/wp is also working fine and thus connecting to the DB which is why I am confused as to what the problem is. I have a feeling it could be related to this specifically the FILE in wp-config but I am not sure?

if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');
5
  • In that header I would define the ABSPATH to point directly to a WP installation, like define('ABSPATH', '/my/webroot/path/wp/'); - hmm? It then should use this defined and do not re-define the ABSPATH after wp-config is included...
    – shadyyx
    Commented Jun 14, 2013 at 15:42
  • does dirname(FILE) just refer to the current file calling it, or wp-config itself? Commented Jun 14, 2013 at 15:44
  • dirname(__FILE__) will return the absolute path to the concrete (current) file, that means to Your header file (I do not know whether it is a controller or template file...).
    – shadyyx
    Commented Jun 14, 2013 at 16:03
  • I tried just writing the absolute path, did nothing. used echo getcwd(); ..none of this makes sense ... Also @shadyyx the __FILE__ is in mysite.com/wp/wp-config.php , not my header which is mysite.com/blog Commented Jun 14, 2013 at 16:06
  • Did you try using the blog modules available in the market for creating a full-fledged blog in OpenCart? That must be easy and less time consuming. Here is the one if you like to consider that option - fmeaddons.com/opencart/blog-news-articles-module.html
    – user4104804
    Commented Dec 11, 2014 at 7:55

1 Answer 1

0

The problem is that the DB_PASSWORD conflicts with one that OpenCart apparently uses this. Changing DB_PASSWORD to DP_WPPASSWD (or a name of your choosing) solves the error. However I now have another error.

Fatal error: Call to a member function main() on a non-object in /xxx/wp/wp-includes/functions.php on line 779

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.