Post by fireatwire » Wed Aug 25, 2010 3:22 pm

Has someone tried to combine opencart with wordpress, both in multi-languages? What do I need to do to get it work?

New member

Posts

Joined
Wed Feb 03, 2010 5:21 am

Post by mystifier » Fri Aug 27, 2010 6:18 pm

I have been playing around with Wordpress as a front-end to (multi-store) Opencart on a development website but, aside from the fact that it is a single (combined) database and shared stylesheet, the two admins are completely seperate.

It is effectively nothing more than having two templates that look the same.

Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products


User avatar
Active Member

Posts

Joined
Tue May 18, 2010 5:15 pm

Post by fireatwire » Wed Sep 01, 2010 5:37 pm

Do you have different languages? How do you link the "wordpress language" to your opencart language when hitting the shop-link and switching to the shop?

New member

Posts

Joined
Wed Feb 03, 2010 5:21 am

Post by mystifier » Wed Sep 01, 2010 7:18 pm

I don't use multi-languages in either Wordpress or Opencart.

My Wordpress simply has a (multi-store) shop selector page so I guess I would have a version in each language. As far as Opencart goes, each store can have a different default language no problem, so you could have uk.yourstore.com and spain.yourstore.com with a common admin opening in different languages.

Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products


User avatar
Active Member

Posts

Joined
Tue May 18, 2010 5:15 pm

Post by fibebo » Sun Nov 14, 2010 3:45 pm

hello there,
I've integrated OC into WP as it was suggested in this topic. I have managed to look the design the same. What I can't figure out is how to return to the wp section - blogs etc. from the shop? I would put the main site's link to the Home tab and/or when people click on the header/logo. Or would ad a new tab...
Please give me a detailed answer with codes.

Thank you!

Newbie

Posts

Joined
Sun Nov 14, 2010 3:16 pm

Post by dramony » Mon Nov 15, 2010 11:16 am

can you show us some demo? thanks.

User avatar
Active Member

Posts

Joined
Sat Oct 24, 2009 12:34 pm

Post by fibebo » Mon Nov 15, 2010 8:04 pm

demo?
It is my own site. Not something to release - unfortunately.

Newbie

Posts

Joined
Sun Nov 14, 2010 3:16 pm

Post by dramony » Tue Nov 16, 2010 9:47 am

can we a have a look at your site?

User avatar
Active Member

Posts

Joined
Sat Oct 24, 2009 12:34 pm

Post by fibebo » Fri Nov 19, 2010 4:12 am

If you promise to tell me the secret. :)

I wonder why is it so complecated.
Last edited by fibebo on Sat Nov 27, 2010 5:23 am, edited 1 time in total.

Newbie

Posts

Joined
Sun Nov 14, 2010 3:16 pm

Post by cmebd » Fri Nov 19, 2010 9:03 am

Very nice site...... :)

A stupid question is the one you -don't- ask.........(Anon)

)C1.5.0.1 (IN devel)
OC V1.4.9.5
OC V1.4.9.2
OC V1.4.7
OC V1.3.4


User avatar
Active Member

Posts

Joined
Fri Nov 13, 2009 11:17 am
Location - Tasmania, Australia

Post by broadsighted » Tue Nov 30, 2010 4:34 am

I'd like to know if it's possible for them to use the same database.

Wordpress is installed at root, and OpenCart is installed under the directory gallery/.

Can't I just create another table within the "Wordpress Database" for OpenCart? Would OpenCart and Wordpress interfere with each other?

How can I make this work? Or is another database necessary....

Thanks. :)

Image


Newbie

Posts

Joined
Tue Nov 30, 2010 4:27 am
Location - Denver, CO

Post by mystifier » Thu Dec 02, 2010 7:20 am

Of course Wordpress and Opencart can reside in a single database. It is a good idea to use a prefix for both such as wp_ and oc_ to keep a clear segregation.

Although the databases are still effectively seperate, other than that they are in the same physical database for convenience, it does make queries that contain information from both easier.

Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products


User avatar
Active Member

Posts

Joined
Tue May 18, 2010 5:15 pm

Post by unknownmale1 » Thu Dec 09, 2010 5:45 am

I think i am going a backwards way about this....Basically I am aiming for a feed of the latest word press posts to show up on the homepage.

so I added this to home.php

Code: Select all

define('WP_USE_THEMES', false);
require('./wordpress/wp-load.php');
query_posts('showposts=1'); 
but as both wordpress and opencart are on the same database they have DB_PASSWORD as a constant which it sees as pre-defined.

I tried creating a new wp-config.php and wp-load.php by duplicating them, renaming them and directing to them, but got in a whole mess of trouble.

anyone see a work around?

thanks.

Active Member

Posts

Joined
Sat Aug 28, 2010 6:46 pm

Post by kdmp » Mon Jan 24, 2011 9:55 am

I ran into the same problem as Moyger...Using $this when not in object context in registry.php on line 10.

I am attempting the same thing as 3rdcorner. Any reason why this would happen?

Using 1.4.9 OpenCart and 3.0 Wordpress... Wordpress is in the root and Opencart in ./shop/

Code: Select all

<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up till <div id="main">
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */
 require_once('./shop/config.php');
//require_once(DIR_SYSTEM . 'startup.php');
require_once(DIR_SYSTEM . 'engine/registry.php');
require_once(DIR_SYSTEM . 'library/session.php');
require_once(DIR_SYSTEM . 'library/request.php');
require_once(DIR_SYSTEM . 'library/db.php');
require_once(DIR_SYSTEM . 'library/customer.php');
   
// Session
$session = new Session();
Registry::set('session', $session);

// Request
$request = new Request();
Registry::set('request', $request);

// Database 
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
Registry::set('db', $db);

$customer = new Customer();
$logged = $customer->isLogged();

?><!DOCTYPE html>
Is this error due to the change over from self:: to $this->?

Kevin Davidson
Purolator Shipping Module
Canpar Shipping Module
VQMod - Paypal Transaction ID to Payment Details


Active Member

Posts

Joined
Thu Jun 04, 2009 10:40 am
Location - Ontario, Canada

Post by kdmp » Tue Jan 25, 2011 12:29 am

An easier question is this....how can I check for a logged in session for opencart from Wordpress? I just want to show the correct the links.

I have opencart in the directory shop. Wordpress is in the root. After I logged in to opencart as a customer, I went back to the wordpress page that I have print_r($_SESSION). I would have half expected to see customer_id in there somewhere.

Kevin Davidson
Purolator Shipping Module
Canpar Shipping Module
VQMod - Paypal Transaction ID to Payment Details


Active Member

Posts

Joined
Thu Jun 04, 2009 10:40 am
Location - Ontario, Canada

Post by xds » Thu Apr 28, 2011 12:10 am

3rdcorner wrote:So far I've gotten wordpress to pull in customer login information from OpenCart by including the bare minimum requirements for /system/library/customer.php

Here's what I include in my wordpress header.php:

Code: Select all

require_once('./shop/config.php');
//require_once(DIR_SYSTEM . 'startup.php');
require_once(DIR_SYSTEM . 'engine/registry.php');
require_once(DIR_SYSTEM . 'library/session.php');
require_once(DIR_SYSTEM . 'library/request.php');
require_once(DIR_SYSTEM . 'library/db.php');
require_once(DIR_SYSTEM . 'library/customer.php');
	
// Session
$session = new Session();
Registry::set('session', $session);

// Request
$request = new Request();
Registry::set('request', $request);

// Database 
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
Registry::set('db', $db);

$customer = new Customer();
$logged = $customer->isLogged();
For this to work on opencart 1.5 I have made the following changes:

Code: Select all

require_once('../development/oc/config.php');
require_once(DIR_SYSTEM . 'engine/registry.php');
require_once(DIR_SYSTEM . 'library/session.php');
require_once(DIR_SYSTEM . 'library/request.php');
require_once(DIR_SYSTEM . 'library/db.php');
require_once(DIR_SYSTEM . 'library/customer.php');

// Registry
$registry = new Registry();

// Session
$session = new Session();
$registry->set('session', $session);

// Request
$request = new Request();
$registry->set('request', $request);

// Database 
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$registry->set('db', $db);

$customer = new Customer($registry);
$logged = $customer->isLogged();

Thanks for 1.5!


xds
New member

Posts

Joined
Mon Jul 12, 2010 9:53 am

Post by heizo » Thu May 26, 2011 4:01 am

Ive gotten many of the features asked for working in pre 1.5 open cart installations. Here is the forum for example code (scroll to the last pages for complete code).

http://forum.opencart.com/viewtopic.php?f=128&t=26860

My Blog / Site

$1 Hosting and Free Domain Name for OpenCart, Wordpress, Joomla, Droopal


New member

Posts

Joined
Wed Feb 09, 2011 1:12 am

Post by SupraTwinTurbo » Thu Jun 02, 2011 8:37 am

heizo wrote:Ive gotten many of the features asked for working in pre 1.5 open cart installations. Here is the forum for example code (scroll to the last pages for complete code).

http://forum.opencart.com/viewtopic.php?f=128&t=26860
Hmmm... I checked the link and the last pages have no complete code. Can you verify?

User avatar
New member

Posts

Joined
Thu Mar 24, 2011 12:43 pm
Location - NYC, NY USA

Post by joejac » Sun Jun 05, 2011 10:34 pm

Hello,
This is very nice topic.
My question is, If a web site has 3 years with WordPress (WP) and all the products, descriptions and prices, are already in WP,

1.- Could it be possible to add a buy button for each product in WP that takes to OpenCart (OC) so the visitor can browse WP for products and click in their respective buy button?.

2.- Can I pass to OC through the buy button the product information like name, brief description, price and quantity via get or post in the URL?

OpenCart should add that product to the shopping cart, OpenCart will also be displayed inside an iframe of a WP page, so the buyer can see how is going his shopping cart, and do the checkout when he is ready.

I do not need to show OC menu, just the registration and shopping cart, because products description and prices are already in WP, I do not want to eliminate the products from WP and to include them in OC, too much work I think.

How can I do all this integration?, are there tutorials, examples or related links or documentation?

Hope I was able to explan myself.
Thanks for your nice help in advance
Best regards
joejac

Newbie

Posts

Joined
Sun Apr 10, 2011 7:17 am

Post by innuoluke » Sat Jun 18, 2011 4:43 pm

For the people who have installed Opencart, and then put wordpress in a sub directory (like me!), I have found the following solution to the "using $this in non-object context" error.

Replace the code from above with this, still in your wordpress header.php:

Code: Select all

//Pull in some stuff from opencart so that we can check if the user is logged in TO OPENCART (not necessarily wordpress!!)
require_once('../config.php');	//Changed to point at Opencart root (one level up)
require_once(DIR_SYSTEM . 'engine/registry.php');
require_once(DIR_SYSTEM . 'library/session.php');
require_once(DIR_SYSTEM . 'library/request.php');
require_once(DIR_SYSTEM . 'library/db.php');
require_once(DIR_SYSTEM . 'library/customer.php');

// THIS BIT IS NEW!
// Registry
$registry = new Registry();

// Session
$session = new Session();
$registry->set('session', $session);	//Changed

// Request
$request = new Request();
$registry->set('request', $request);	//Changed

// Database 
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$registry->set('db', $db);	//Changed

$customer = new Customer($registry);
$logged = $customer->isLogged();
That should fix the error, and if you print_r() the $_SESSION you will see customer_id when the user is logged in to opencart :)

Hope this helps... I found this thread from a google search, so hopefully this can help a few more people than just me!

EDIT:
OK, so having re-read some of this thread this is the same as the Opencart 1.5 code, but nevertheless, its helpful! :P

I did come across a few more errors when wordpress was trying to access the database later in the page load (particularly around the comments area of the page). I solved this problem by moving all of the code above OUT of the header.php and putting it into the wordpress index.php (in my case "/news/index.php").

By doing this the page loads the relevant stuff from opencart into the session right at the start, and is then able to overwrite variables if they are needed within wordpress itself.

If it helps, I put the code above after "define('WP_USE_THEMES', true);" but before "require('./wp-blog-header.php');".

The only "problem" I can see with having this code in the index.php rather than header.php is that the resulting variables etc will be visible to all themes, but personally I think this is an advantage as it means we can create a new wordpress theme if required and not have to remember to add the code again!

Oh... and the fact that upgrading wordpress will nuke the code out :-\ Bugger :(

Web developer for Cotswold Web Services / Innuo Ltd
Need help with your Opencart website? Give us a call to see how we can help.


Newbie

Posts

Joined
Sat Jun 18, 2011 4:36 pm
Who is online

Users browsing this forum: No registered users and 7 guests