Page 1 of 1

[MOD] Simple modification to allow all-SSL connections

Posted: Sat Apr 17, 2010 5:10 am
by richcon
I recently coded up a dead-simple method to allow all-SSL store connections. It would be cool to see this added to the core OpenCart code.

The discussion thread on this is: http://forum.opencart.com/viewtopic.php?f=20&t=13436

Basically, you can make all in-store links use "https" simply by using an https:// store URL in the admin panel. Currently the "index.php" code assumes the store URL will start with "http://" so it breaks when you use https. The following change fixes that assumption.

Simply change the following line:

Code: Select all

   define('HTTPS_SERVER', 'https://' . substr($config->get('config_url'), 7));
to:

Code: Select all

   $config_url = $config->get('config_url');
   define('HTTPS_SERVER', ($config_url{4} == 's' ? $config_url : 'https://' . substr($config_url, 7)));
Thanks!
Richard