Jump to content

Loading Prestashop classes in Wordpress


Stéphane1405

Recommended Posts

Hello,

 

I have got one Prestashop and one Wordpress running on the same machine.

I'm trying to use Prestashop order class in Wordpress .

I have included prestashop\config\config.inc.php and prestashop\init.php in my Wordpress script but it redirects Wordpress on Prestashop.

 

Any help would be greatly appreciated. :rolleyes:

STEF

Link to comment
Share on other sites

I eventually found the answer.

 

On your external script, use a constant ex: PRESTASHOP_EXTERNAL_SCRIPT

 

external_script.php

define('PRESTASHOP_EXTERNAL_SCRIPT', true);
include(dirname(__FILE__).'/../prestashop/config/config.inc.php');

then on prestashop/classes/shop/shop.php add the following

 

BELOW (L401) 

  // Hmm there is something really bad in your Prestashop !
                if (!Validate::isLoadedObject($default_shop))
                    throw new PrestaShopException('Shop not found');

ADD

if (defined('PRESTASHOP_EXTERNAL_SCRIPT')) {
                    $shop = $default_shop;
                } else {  

AND  below (L441)

header('HTTP/1.0 '.$redirect_code.' '.$redirect_header);
                header('Location: http://'.$url);
                exit;

ADD

}

Hope this will help.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...