[SOLVED] How to convert Opencart 2.2.0.0 to SSL and resolve Undefined Error while editing orders?
Follow these easy steps to convert your Opencart 2.2.0.0 instance from HTTP to HTTPS.
- Register a CloudFlare account.
- Add your domain with the Free plan.
- Change domain nameserver with the ones provided by Cloudflare
- Click on Crypto menu option and do the following
a. Order SSL certificate.
b. Set Always use HTTPS to ON.
c. Set Require Modern TLS to ON.
d. Set Automatic HTTPS Rewrites to ON. - On the OpenCart 2.2.0.0 admin panel, browse to System / Settings / Server option and set Use SSL to Yes.
- On CPanel/Webmin
- Edit .htaccess file in root folder and replace the following
RewriteCond %{HTTP_HOST} ^domain.com$ RewriteRule ^/?$ "http\:\/\/www\.domain\.com" [R=301,L]
-
with
RewriteCond %{HTTPS_HOST} ^domain.com$ RewriteRule ^/?$ "https\:\/\/www\.domain\.com" [R=301,L]
- Edit config.php in public_html (root) folder and replace
- Edit config.php in public_html/admin folder and replace
- Edit admin.php, catalog.php, default.php, and install.php in public_html/system/config folder and replace
- Edit public_html/catalog/controller/common/header.php and replace
- NOTE: Use this fix to resolve Undefined Error while editing orders in OC 2.2.0.0
- Go to public_html/admin/controller/sale/ folder and edit order.php
- Replace
- Save the file.
- Go to Opencart Admin Panel select Extensions/Modification and click the Refresh button
with$data['store_url'] = $this->request->server['HTTPS'] ? str_replace("http", "https", $order_info['store_url']) : $order_info['store_url'];
$data['store_url'] = $this->request->server['HTTPS'] ? str_replace("http", "http", $order_info['store_url']) : $order_info['store_url'];
define('HTTPS_SERVER', 'http://www.domain.com/');
with
define('HTTPS_SERVER', 'https://www.domain.com/');
// HTTP
define('HTTP_SERVER', 'http://www.domain.com/admin/');
define('HTTP_CATALOG', 'http://www.domain.com/');
// HTTPS
define('HTTPS_SERVER', 'http://www.domain.com/admin/');
define('HTTPS_CATALOG', 'http://www.domain.com/');
with
// HTTP
define('HTTP_SERVER', 'https://www.domain.com/admin/');
define('HTTP_CATALOG', 'https://www.domain.com/');
// HTTPS
define('HTTPS_SERVER', 'https://www.domain.com/admin/');
define('HTTPS_CATALOG', 'https://www.domain.com/');
$_['site_ssl'] = false;
with
$_['site_ssl'] = true;
$server = $this->config->get('config_ssl');
-
with
$server = str_replace('http:', 'https:', $this->config->get('config_url'));
If you found this post useful then follow and support me on