Post by jalopez66 » Tue Sep 19, 2017 3:44 pm

the problem still happen any idea?

Newbie

Posts

Joined
Thu Apr 17, 2014 11:44 pm

Post by harsh.k1987 » Tue Sep 19, 2017 7:37 pm

Hello,
yes it looks like the version issue, if you arrange different version of php for different domain then problem will solve automatically.

Thanks

Best Regards
Harry Kumar
hkdev1987@gmail.com
skype : hk.dev


New member

Posts

Joined
Tue May 26, 2015 7:59 pm
Location - india

Post by boicute.14 » Tue Sep 19, 2017 8:19 pm

I dont think so, because i had this case, check your common.js file because addtocart use ajax on this.
You must find line

Code: Select all

$('#cart > ul').load('index.php?route=common/cart/info ul li');
in

Opencart Developer|Thiết kế website|Thiết kế website tại Đồng Nai


Newbie

Posts

Joined
Sat Oct 22, 2016 2:08 pm

Post by balloonsupply » Sat Oct 07, 2017 3:20 am

I think I'm having something similar. I'm getting an internal server error when checking out. I've tried several re-installations to no avail. Also, adding items to the cart, deleting them, to show zero, then adding new shows in the black cart button, but clicking on it shows empty until I hit F5 (refresh).

Opencart 3.0.2.0
php 7.0
It's a temporary store to start populating and style before transfer over to the live store: URL given in the error log below. There's products in the numbers category at the moment.

The installation has been made through my A2 cPanel. The site has A2 Optimized applied.

No template modifications have been made on the re-installations, although originally, I thought they were to blame, but everything worked exactly the same.

Modifications are: Asynchronous Javascript by A2 Hosting, Local copy OCMOD by iSenseLabs and TurboCache Cookies by A2 Hosting. Even with these disabled, I get the same problems.

The internal server error happens on the final checkout step (confirm order) when I try and checkout. A customer is created, but no order. If I try and place a 'second' order being logged in I get stopped at the Delivery Method, "Warning: Shipping method required!", even though it is selected!

The opencart error log shows:
2017-10-06 12:20:41 - PHP Warning: Missing argument 1 for Session::__construct(), called in /home/basucoah/www.village24.com/basuco/admin-cli.php on line 97 and defined in /home/basucoah/www.village24.com/basuco/system/library/session.php on line 24
2017-10-06 12:20:41 - PHP Notice: Undefined variable: adaptor in /home/basucoah/www.village24.com/basuco/system/library/session.php on line 25
2017-10-06 12:20:41 - PHP Notice: Undefined variable: adaptor in /home/basucoah/www.village24.com/basuco/system/library/session.php on line 36
2017-10-06 12:20:41 - PHP Notice: Error: Could not load cache adaptor session! in /home/basucoah/www.village24.com/basuco/system/library/session.php on line 36

I'm at a complete loss as how to resolve this. I can understand that 'session!' is for reasons unknown has not been defined, so it unknown, and therefore breaks everything that follows.

session.php:

Code: Select all

<?php
/**
 * @package		OpenCart
 * @author		Daniel Kerr
 * @copyright	Copyright (c) 2005 - 2017, OpenCart, Ltd. (https://www.opencart.com/)
 * @license		https://opensource.org/licenses/GPL-3.0
 * @link		https://www.opencart.com
*/

/**
* Session class
*/
class Session {
	protected $adaptor;
	protected $session_id;
	public $data = array();

	/**
	 * Constructor
	 *
	 * @param	string	$adaptor
	 * @param	object	$registry
 	*/
	public function __construct($adaptor, $registry = '') {
		$class = 'Session\\' . $adaptor;
		
		if (class_exists($class)) {
			if ($registry) {
				$this->adaptor = new $class($registry);
			} else {
				$this->adaptor = new $class();
			}	
			
			register_shutdown_function(array($this, 'close'));
		} else {
			trigger_error('Error: Could not load cache adaptor ' . $adaptor . ' session!');
			exit();
		}	
	}
	
	/**
	 * 
	 *
	 * @return	string
 	*/	
	public function getId() {
		return $this->session_id;
	}

	/**
	 *
	 *
	 * @param	string	$session_id
	 *
	 * @return	string
 	*/	
	public function start($session_id = '') {
		if (!$session_id) {
			if (function_exists('random_bytes')) {
				$session_id = substr(bin2hex(random_bytes(26)), 0, 26);
			} else {
				$session_id = substr(bin2hex(openssl_random_pseudo_bytes(26)), 0, 26);
			}
		}

		if (preg_match('/^[a-zA-Z0-9,\-]{22,52}$/', $session_id)) {
			$this->session_id = $session_id;
		} else {
			exit('Error: Invalid session ID!');
		}
		
		$this->data = $this->adaptor->read($session_id);
		
		return $session_id;
	}
	
	/**
	 * 
 	*/
	public function close() {
		$this->adaptor->write($this->session_id, $this->data);
	}
	
	/**
	 * 
 	*/	
	public function __destroy() {
		$this->adaptor->destroy($this->session_id);
	}
}
admin-cli.php:

Code: Select all

<?php


if(php_sapi_name() != "cli"){
    die("Not Command Line");
}

$cli_options = getopt("", array("route:"));

if(is_null($cli_options['route'])){
    die("missing route.");
}

// Configuration
if (is_file('admin/config.php')) {
    require_once('admin/config.php');
}

// Startup
require_once(DIR_SYSTEM . 'startup.php');


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


// Settings
$query = $db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE store_id = '0'");
foreach ($query->rows as $setting) {
    if (!$setting['serialized']) {
        $config->set($setting['key'], $setting['value']);
    } else {
        $config->set($setting['key'], unserialize($setting['value']));
    }
}


// Loader
$loader = new Loader($registry);
$registry->set('load', $loader);
// Url
$url = new Url(HTTP_SERVER, $config->get('config_secure') ? HTTPS_SERVER : HTTP_SERVER);
$registry->set('url', $url);
// Log
$log = new Log($config->get('config_error_filename'));
$registry->set('log', $log);
function error_handler($errno, $errstr, $errfile, $errline) {
    global $log, $config;
    // error suppressed with @
    if (error_reporting() === 0) {
        return false;
    }
    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;
}
// 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('file');
$registry->set('cache', $cache);
// Session
$session = new Session();

$controller->user['user_id'] = 1;
$temp_token = md5(mt_rand());
$session->data['token'] = $temp_token;
$_GET['token'] = $temp_token;
$session->data['user_id'] = 1;


$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('default');
$registry->set('language', $language);
// 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));

// Event
$event = new Event($registry);
$registry->set('event', $event);
$query = $db->query("SELECT * FROM " . DB_PREFIX . "event");
foreach ($query->rows as $result) {
    $event->register($result['trigger'], $result['action']);
}
// Front Controller
$controller = new Front($registry);

// Router
$action = new Action($cli_options['route']);
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
// Output
$response->output();
.htaccess: (I've **********'d out the personal information)

Code: Select all

# START A2 LiteSpeed Cache for **********.
# Type: OpenCart
<IfModule LiteSpeed>
    CacheEnable public
    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} ^GET|HEAD|PURGE$
    RewriteCond %{HTTP_HOST} village24.**********.com|village24.com [NC]
    RewriteCond %{REQUEST_URI} !admin|account|checkout|cart [NC]
    RewriteCond %{HTTP_COOKIE} !logged_in|cust_logged_in|cart|compare|wishlist [NC]
    RewriteCond %{QUERY_STRING} !nocache [NC]
    RewriteRule .* - [E=Cache-Control:max-age=60]
</IfModule>
# END A2 LiteSpeed Cache for **********.
<ifModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType text/css "access plus 1 week"
ExpiresByType application/pdf "access plus 1 week"
ExpiresByType text/x-javascript "access plus 1 week"
ExpiresByType application/x-shockwave-flash "access plus 1 week"
ExpiresByType image/x-icon "access plus 1 week"
ExpiresDefault "access plus 1 week"
</ifModule>
# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.

# 2. In your opencart directory rename htaccess.txt to .htaccess.

# For any support issues please visit: http://www.opencart.com

Options +FollowSymlinks

# Prevent Directoy listing
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|.twig|\.ini|\.log|(?<!robots)\.txt))">
 Require all denied
## For apache 2.2 and older, replace "Require all denied" with these two lines :
# Order deny,allow
# Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/

RewriteBase /basuco/
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

### Additional Settings that may need to be enabled for some servers
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200

# 7. disable open_basedir limitations
# php_admin_value open_basedir none
Would really appreciate the help. It's porbably something simple, but I can't can't figure out what to do next.

Newbie

Posts

Joined
Tue Sep 26, 2017 10:21 pm

Post by yodapt » Sat Oct 07, 2017 5:06 am

Have you tried switching to PHP 5?

Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com


User avatar
Active Member

Posts

Joined
Fri Jun 17, 2011 6:39 pm


Post by balloonsupply » Sat Oct 07, 2017 5:15 am

in cPanel, I changed to 5.6 through Software > Select php verson.
Just had a play around, cart is still "sticky" needing a forced refresh (F5).

EDIT:

I got opencart up and running without these issues, but it was a clean install using the download from Opencart rather than the cPanel installer. I can confirm that it wasn't anything in the database, not my own modifications: The new installation is simply missing the hosting turbo cacheing malarky messing it all up. I'm convinced that the problems are because of A2 hosting's modifications (which I'm sure are great for static sites), and for that reason, unless I hear a good solution from them, I will be looking for another host (recommendations of UK based hosting welcome through private message, thanks!).

Newbie

Posts

Joined
Tue Sep 26, 2017 10:21 pm

Post by babykangaroo22 » Tue Jan 23, 2018 4:01 am

balloonsupply wrote:
Sat Oct 07, 2017 5:15 am
in cPanel, I changed to 5.6 through Software > Select php verson.
Just had a play around, cart is still "sticky" needing a forced refresh (F5).

EDIT:

I got opencart up and running without these issues, but it was a clean install using the download from Opencart rather than the cPanel installer. I can confirm that it wasn't anything in the database, not my own modifications: The new installation is simply missing the hosting turbo cacheing malarky messing it all up. I'm convinced that the problems are because of A2 hosting's modifications (which I'm sure are great for static sites), and for that reason, unless I hear a good solution from them, I will be looking for another host (recommendations of UK based hosting welcome through private message, thanks!).
Hello Team

I seem to be having these exact same issues now. On two hosting providers, Krystals and Bluehost. However when i run this on my friends own DigitalOcean Hosting we are able to get the cart working fine (as per the open cart demo site)

Was there ever an actual fix, as well as this post, i found a similar one where hosting was mooted as the root cause but no fix was stated.

Any help would be greatly appreciated.

Many Thanks

Joey


Posts

Joined
Tue Jan 23, 2018 1:54 am

Post by Vasari » Fri Feb 09, 2018 10:50 pm

Hi, I'm having the same problem on checkoui with version 3.02, have disabled A2 Turbocache as mention in forum but still no go.
Have you resolved this issue, would be very grateful for answer

Newbie

Posts

Joined
Tue Oct 24, 2017 12:14 am

Post by babykangaroo22 » Sat Feb 10, 2018 5:42 pm

Vasari wrote:
Fri Feb 09, 2018 10:50 pm
Hi, I'm having the same problem on checkoui with version 3.02, have disabled A2 Turbocache as mention in forum but still no go.
Have you resolved this issue, would be very grateful for answer
My hosting provider made some changes to how my webserver, litespeed, was caching and it resolved the issues for me. They added the following to my htaccess file;

RewriteEngine On
RewriteRule (.*) - [E=Cache-Control:no-cache]

Hope that helps you out :-)


Posts

Joined
Tue Jan 23, 2018 1:54 am
Who is online

Users browsing this forum: Bing [Bot] and 322 guests