Module 如何在wordpress中访问prestashop函数
我使用的是prestashop 1.4.3版本。我想在wordpress中获取用户数据。我尝试了下面的代码,但没有成功。给我这个致命的错误: 在中找不到类“FrontController” /第28行的opt/lampp/htdocs/domin.com/prestashop/init.php 这是我的剧本:Module 如何在wordpress中访问prestashop函数,module,prestashop,Module,Prestashop,我使用的是prestashop 1.4.3版本。我想在wordpress中获取用户数据。我尝试了下面的代码,但没有成功。给我这个致命的错误: 在中找不到类“FrontController” /第28行的opt/lampp/htdocs/domin.com/prestashop/init.php 这是我的剧本: $psabspath = ''; $psabspath = $_SERVER['DOCUMENT_ROOT'] . '/domin.com/prestashop/'; if ( $psa
$psabspath = '';
$psabspath = $_SERVER['DOCUMENT_ROOT'] . '/domin.com/prestashop/';
if ( $psabspath != '' && file_exists( $psabspath . 'config/config.inc.php' )
&& ( file_exists( $psabspath . 'classes/FrontController.php' ) ||
file_exists( $psabspath . 'classes/controller/FrontController.php' ) ) ) {
require_once( $psabspath . 'init.php' );
require_once( $psabspath . 'config/config.inc.php' );
class PrestaShopIntegration_FrontController extends FrontController {
public function __destruct()
{
if (Context::getContext()->cookie)
Context::getContext()->cookie->write();
}
public function init() {
$this->page_name = 'wordpress';
parent::init();
if ( isset( $this->context) ) {
if ( version_compare(_PS_VERSION_, '1.5.4', '>=') )
$this->setMedia();
if ( $this->checkAccess() ) {
$this->postProcess();
$this->initHeader();
if ( $this->viewAccess() )
$this->initContent();
else
$this->errors[] = Tools::displayError('Access denied.');
$this->initFooter();
}
}
}
}
}
您应该首先包括
config.php
文件,然后才能包括init.php
$psabpath='';
$PSABPath=$\u服务器['DOCUMENT\u ROOT'].'/myskinrecipes.com/shop/';
如果($psabpath!=''&&file_存在($psabpath.config/config.inc.php'))
&&(文件_存在($psabPath.'classes/FrontController.php'))||
文件_存在($psabpath.'classes/controller/FrontController.php')){
需要_once($psabpath.config/config.inc.php');
需要一次_($psabpath.init.php');
类prestashopiintegration\u FrontController扩展了FrontController{
公共函数_udestruct()
{
if(Context::getContext()->cookie)
Context::getContext()->cookie->write();
}
公共函数init(){
$this->page_name='wordpress';
父::init();
if(设置($this->context)){
如果(版本比较(_PS_版本,'1.5.4','>='))
$this->setMedia();
如果($this->checkAccess()){
$this->postProcess();
$this->initHeader();
如果($this->viewAccess())
$this->initContent();
其他的
$this->errors[]=Tools::displayError('Access denied');
$this->initFooter();
}
}
}
}
}
config.php
将加载Prestashop配置文件并加载整个框架
init.php
仅用于加载控制器。您应该首先包含config.php
文件,然后才能包含init.php
$psabpath='';
$PSABPath=$\u服务器['DOCUMENT\u ROOT'].'/myskinrecipes.com/shop/';
如果($psabpath!=''&&file_存在($psabpath.config/config.inc.php'))
&&(文件_存在($psabPath.'classes/FrontController.php'))||
文件_存在($psabpath.'classes/controller/FrontController.php')){
需要_once($psabpath.config/config.inc.php');
需要一次_($psabpath.init.php');
类prestashopiintegration\u FrontController扩展了FrontController{
公共函数_udestruct()
{
if(Context::getContext()->cookie)
Context::getContext()->cookie->write();
}
公共函数init(){
$this->page_name='wordpress';
父::init();
if(设置($this->context)){
如果(版本比较(_PS_版本,'1.5.4','>='))
$this->setMedia();
如果($this->checkAccess()){
$this->postProcess();
$this->initHeader();
如果($this->viewAccess())
$this->initContent();
其他的
$this->errors[]=Tools::displayError('Access denied');
$this->initFooter();
}
}
}
}
}
config.php
将加载Prestashop配置文件并加载整个框架
init.php
仅用于加载控制器。致命错误:在第105行的/opt/lampp/htdocs/domin.com/prestashop/config/config.inc.php中找不到类“Configuration”。第105行有以下代码配置::loadConfiguration();好的,我将下载您的特定Prestashop版本,测试它并尽快返回给您。我已经测试了它,它正在使用新的安装config/config.inc.php
first loadconfig/autoload.php
。此文件将加载每个Prestashop类,包括classes/Configuration.php
。您是否在autoload.php
中做了任何更改?如果你的商店正常工作,这个脚本也应该正常工作……你是否尝试过让你的商店进入开发模式,改变第一行的define(“PS\u mode\u DEV”,false)
在defines.inc.php中
到define(“”“PS\u MODE\u DEV”,true)代码>?也许屏幕上会显示更多的错误。您还可以检查apache日志文件中的错误。致命错误:在第105行的/opt/lampp/htdocs/domin.com/prestashop/config/config.inc.php中找不到类“Configuration”。第105行有以下代码配置::loadConfiguration();好的,我将下载您的特定Prestashop版本,测试它并尽快返回给您。我已经测试了它,它正在使用新的安装config/config.inc.php
first loadconfig/autoload.php
。此文件将加载每个Prestashop类,包括classes/Configuration.php
。您是否在autoload.php
中做了任何更改?如果你的商店正常工作,这个脚本也应该正常工作……你是否尝试过让你的商店进入开发模式,改变第一行的define(“PS\u mode\u DEV”,false)
在defines.inc.php中
到define(“”“PS\u MODE\u DEV”,true)代码>?也许屏幕上会显示更多的错误。您还可以检查apache日志文件中的错误。