Page 1 of 1

Can't Update/Modify New Orders After Changing to SSL Opencart 2.2.0

Posted: Wed Feb 22, 2017 10:49 am
by beeman
After changing to https, when I view new orders an undefined error window pops up and I can't update the status of the order. Orders made prior to ssl are fine with no errors. I'm using Opencart 2.2.0, hope someone can help.

Re: Can't Update/Modify New Orders After Changing to SSL Opencart 2.2.0

Posted: Fri Feb 24, 2017 4:44 am
by beeman
A temporary solution is to go into the database and change each order's "store_url" back to "http://www.storeurl.com" from "https://www.storeurl.com"

Not sure why when store_url is https it causes the error.

Re: Can't Update/Modify New Orders After Changing to SSL Opencart 2.2.0

Posted: Sun Feb 26, 2017 6:06 am
by victorj
oc version 2.2 has a bug regarding ssl.
You just need to fix a couple off files to make it work.

find:
system/library/url.php
open in editor

search

Code: Select all

public function link($route, $args = '', $secure = false) {
        if ($this->ssl && $secure) {
            $url = 'https://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/.\\') . '/index.php?route=' . $route;
        } else {
            $url = 'http://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/.\\') . '/index.php?route=' . $route;
        }
change to

Code: Select all

public function link($route, $args = '', $secure = false) {
        if ($this->ssl && $secure) {
            $url = 'https://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/.\\') . '/index.php?route=' . $route;
        } else {
            $url = 'https://' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['SCRIPT_NAME']), '/.\\') . '/index.php?route=' . $route;
        
}

find admin/controller/sale/order.php

around line 850

Code: Select all

$data['store_url'] = $this->request->server['HTTPS'] ? str_replace("http", "https", $order_info['store_url']) : $order_info['store_url'];
change to

Code: Select all

$data['store_url'] = $this->request->server['HTTPS'] ? preg_replace("/^http:\/\//", "https://", $order_info['store_url']) : $order_info['store_url'];

Re: Can't Update/Modify New Orders After Changing to SSL Opencart 2.2.0

Posted: Wed Mar 01, 2017 8:20 pm
by knowband.plugins
This may be because you have not made changes to all files.

Have you changed the SSL variable as true in opencart/system/config/admin.php ?

You have to check if all pages in your admin panel are having SSL URL.

Re: Can't Update/Modify New Orders After Changing to SSL Opencart 2.2.0

Posted: Mon Mar 06, 2017 6:54 am
by floatleft
@victorj, this was exactly what I've been seeking! I followed the textbook changes for SSL implementation and after numerous htaccess mods I had to step away from resolving this. I found your post today and am happy to report our SSL resolves on the front side and on the admin. Thank you.