Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blank Page At Opencart Admin Side

I have setup opencart store at locahost then i uploaded the all stuff to online hosting and changed paths in config.php file in root opencart folder and Admin folder .

Front is working fine but Admin side not working . It just shows a blank white page.

I debug My Index.php file by placing echo at some places by echo numbers to check it is executing upto that point or not .

I was trying to solve this error . I updated my Files code given here. One change is My Log has recently generated this error -

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

I am also giving code for my product.php

So It gives error at this line below - $controller->dispatch($action, new Action('error/not_found'));

I have also included my Index.php file.

My Config.php page in admin folder :-

<?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';


?>

Index .php Code

<?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';
?>

Line 8 to Line 13 In Product.php Where This error come

if ($this->customer->isLogged()) {
            $customer_group_id = $this->customer->getCustomerGroupId();
        } else {
            $customer_group_id = $this->config->get('config_customer_group_id');
        }   
like image 447
Heemanshu Bhalla Avatar asked Nov 10 '22 17:11

Heemanshu Bhalla


1 Answers

You have create an default customer group for the store, in the setting you have add that group.

Admin system->setting->option

Account Section.

like image 121
Tanmoy Avatar answered Nov 15 '22 11:11

Tanmoy