我在locahost设置了opencart商店然后我将所有内容上传到在线托管并更改了root opencart文件夹和Admin文件夹中config.php文件中的路径。
前线工作正常,但管理员方面无法正常工作。它只显示一个空白页面。
我调试My Index.php文件,方法是在回波数字的某些地方放置回声来检查它是否正在执行该点。
我试图解决这个错误。我更新了这里给出的文件代码。一个变化是My Log最近生成了这个错误 -
PHP Fatal error: Call to a member function isLogged() on a non-object in /var/www/html/home/catalog/model/catalog/product.php on line 8
我也在为我的product.php提供代码
所以它在下面的这一行给出错误 - $ controller-> dispatch($ action,new Action('error / not_found'));
我还包含了我的Index.php文件。
我在admin文件夹中的Config.php页面: -
<?php
define('HTTP_SERVER', 'http://domain/home/admin/');
define('HTTP_CATALOG', 'http://domain/home/');
// HTTPS
define('HTTPS_SERVER', 'http://domain/home/admin/');
define('HTTPS_CATALOG', 'http://domain/home/');
echo '1';
// DIR
define('DIR_APPLICATION', '/var/www/html/home/catalog/');
define('DIR_SYSTEM', '/var/www/html/home/system/');
define('DIR_DATABASE', '/var/www/html/home/system/database/');
define('DIR_LANGUAGE', '/var/www/html/home/admin/language/');
define('DIR_TEMPLATE', '/var/www/html/home/admin/view/template/');
define('DIR_CONFIG', '/var/www/html/home/system/config/');
define('DIR_IMAGE', '/var/www/html/home/image/');
define('DIR_CACHE', '/var/www/html/home/system/cache/');
define('DIR_DOWNLOAD', '/var/www/html/home/download/');
define('DIR_LOGS', '/var/www/html/home/system/logs/');
define('DIR_CATALOG', '/var/www/html/home/catalog/');
echo '2';
// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'username');
define('DB_PASSWORD', 'password');
define('DB_DATABASE', 'databasename');
define('DB_PREFIX', 'oc_');
echo '3';
?>
索引.php代码
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
?>
<?php
// Version
define('VERSION', '1.5.6');
// Configuration
if (file_exists('config.php')) {
require_once('config.php');
}
echo '4';
// Install
if (!defined('DIR_APPLICATION')) {
header('Location: ../install/index.php');
exit;
}
// Startup
require_once(DIR_SYSTEM . 'startup.php');
echo '5';
// Application Classes
require_once(DIR_SYSTEM . 'library/currency.php');
require_once(DIR_SYSTEM . 'library/user.php');
require_once(DIR_SYSTEM . 'library/weight.php');
require_once(DIR_SYSTEM . 'library/length.php');
echo '6';
// Registry
$registry = new Registry();
echo '7';
// Loader
$loader = new Loader($registry);
$registry->set('load', $loader);
echo '7';
// Config
$config = new Config();
$registry->set('config', $config);
echo '8';
// Database
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$registry->set('db', $db);
echo '9';
// Settings
$query = $db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE store_id = '0'");
echo '10';
foreach ($query->rows as $setting) {
if (!$setting['serialized']) {
$config->set($setting['key'], $setting['value']);
} else {
$config->set($setting['key'], unserialize($setting['value']));
}
}
echo '11';
// Url
$url = new Url(HTTP_SERVER, $config->get('config_secure') ? HTTPS_SERVER : HTTP_SERVER);
$registry->set('url', $url);
echo '12';
// Log
$log = new Log($config->get('config_error_filename'));
$registry->set('log', $log);
echo '13';
function error_handler($errno, $errstr, $errfile, $errline) {
global $log, $config;
switch ($errno) {
case E_NOTICE:
case E_USER_NOTICE:
$error = 'Notice';
break;
case E_WARNING:
case E_USER_WARNING:
$error = 'Warning';
break;
case E_ERROR:
case E_USER_ERROR:
$error = 'Fatal Error';
break;
default:
$error = 'Unknown';
break;
}
if ($config->get('config_error_display')) {
echo '<b>' . $error . '</b>: ' . $errstr . ' in <b>' . $errfile . '</b> on line <b>' . $errline . '</b>';
}
if ($config->get('config_error_log')) {
$log->write('PHP ' . $error . ': ' . $errstr . ' in ' . $errfile . ' on line ' . $errline);
}
return true;
}
echo '14';
// Error Handler
set_error_handler('error_handler');
// Request
$request = new Request();
$registry->set('request', $request);
// Response
$response = new Response();
$response->addHeader('Content-Type: text/html; charset=utf-8');
$registry->set('response', $response);
// Cache
$cache = new Cache();
$registry->set('cache', $cache);
// Session
$session = new Session();
$registry->set('session', $session);
// Language
$languages = array();
$query = $db->query("SELECT * FROM `" . DB_PREFIX . "language`");
foreach ($query->rows as $result) {
$languages[$result['code']] = $result;
}
$config->set('config_language_id', $languages[$config->get('config_admin_language')]['language_id']);
// Language
$language = new Language($languages[$config->get('config_admin_language')]['directory']);
$language->load($languages[$config->get('config_admin_language')]['filename']);
$registry->set('language', $language);
echo '15';
// Document
$registry->set('document', new Document());
// Currency
$registry->set('currency', new Currency($registry));
// Weight
$registry->set('weight', new Weight($registry));
// Length
$registry->set('length', new Length($registry));
// User
$registry->set('user', new User($registry));
//OpenBay Pro
$registry->set('openbay', new Openbay($registry));
$registry->set('play', new Play($registry));
$registry->set('ebay', new Ebay($registry));
$registry->set('amazon', new Amazon($registry));
$registry->set('amazonus', new Amazonus($registry));
// Front Controller
$controller = new Front($registry);
echo '16';
// Login
$controller->addPreAction(new Action('common/home/login'));
echo '17';
// Permission
$controller->addPreAction(new Action('common/home/permission'));
echo '18';
// Router
if (isset($request->get['route'])) {
$action = new Action($request->get['route']);
} else {
$action = new Action('common/home');
}
echo '19';
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
echo '20';
// Output
$response->output();
echo '21';
?>
第8行到第13行在Product.php中出现此错误
if ($this->customer->isLogged()) {
$customer_group_id = $this->customer->getCustomerGroupId();
} else {
$customer_group_id = $this->config->get('config_customer_group_id');
}
答案 0 :(得分:1)
您已在添加该组的设置中为商店创建默认客户组。
管理员system->setting->option
帐户部分。
答案 1 :(得分:0)
对我来说,问题是缺少DIR_APPLICATION
常量的尾部斜线。确保所有常量都使用尾部斜杠,这是/admin/config.php
的动态设置:
// DIR
define('DIR_APPLICATION', __DIR__ . '/');
define('DIR_SYSTEM', dirname(__DIR__) . '/system/');
define('DIR_LANGUAGE', __DIR__ . '/language/');
define('DIR_TEMPLATE', __DIR__ . '/view/template/');
define('DIR_CONFIG', dirname(__DIR__) . '/system/config/');
define('DIR_IMAGE', dirname(__DIR__) . '/image/');
define('DIR_CACHE', dirname(__DIR__) . '/system/cache/');
define('DIR_DOWNLOAD', dirname(__DIR__) . '/system/download/');
define('DIR_UPLOAD', dirname(__DIR__) . '/system/upload/');
define('DIR_LOGS', dirname(__DIR__) . '/system/logs/');
define('DIR_MODIFICATION', dirname(__DIR__) . '/system/modification/');
define('DIR_CATALOG', dirname(__DIR__) . '/catalog/');
答案 2 :(得分:-1)
尝试更改文件和文件夹权限。 php和htaccess文件应该是644个文件夹应该是755。